Hi
I received an interesting requirement to implement but not sure if its possible.
What we have:
What is required:
Right now I was able to limit Agent role to disable assigning owners completely, but can't find a way to allow it just under specific conditions.
Please feel free to share your ideas.
Thanks.
Thank you Andrew.
Sorry my response took so long, we had a major release and I was involved in that.
I'm not an experienced Dynamics user and I'm sure I could use your response to solve my problem, but sadly for now I'm not exactly sure how to implement it.
Had to go with the script:
function disable_owner_change() { setTimeout(function () { // Had to set timeout because form was loading slow and can't get the OwinerID var roleId = '2a0f75b3-8f50-ea11-a883-000d6a8bfcc8'; // Agent RoleID var currentUserRoles = Xrm.Utility.getGlobalContext().userSettings.securityRoles; // Get current user security roles var userRoleId = currentUserRoles[0]; // Getting the first role (and the only role in my case) if (userRoleId == roleId && currentUserRoles.length == 1) { // Checking if current user is Agent and it's the only role var OwnerIDorig = Xrm.Page.getAttribute("ownerid").getValue()[0].id; // Check the current Opportunity owner role var OwnerID = OwnerIDorig.toString(); if (OwnerID == "{78F45BC3-4E75-EA54-A823-000D3A30F547}" || OwnerID == "{65564BC7-E593-EA12-A871-000D3A76E885}") { // Check if current Opportunity owner is Admin (in dev or prod env) Xrm.Page.getControl("header_ownerid").setDisabled(false); } else { Xrm.Page.getControl("header_ownerid").setDisabled(true); } } }, 3000); }
I'm pretty sure it's not the elegant script version but had no time to dig it up.
Please fill free to modify it or suggest an edit, will be glad to use it.
Thanks.
Hello,
If my reply (or replies) answers your question take a minute and verify the answer. You can do it by clicking "Yes" at the top of the reply (or replies) under the label "Does this answer your question?"
Hello,
Guido mentioned that you can do it via plugin and I second this but you can do it using Real-Time Workflow as well.
The action to handle with the workflow is "Assign" and in order to check the roles of users you can use one of the free custom workflow activities toolkits (for example my toolkit - a reference to it is available in the signature) and if it's not allowed to reassign - just stop the workflow with an error. You can see an example here - gtcrm.wordpress.com/.../
afaik you will need a plugin to implement this scenario
Daivat Vartak (v-9d...
225
Super User 2025 Season 1
Vahid Ghafarpour
136
Super User 2025 Season 1
Eugen Podkorytov
106