Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Assign button works for some users but dont for some others, even with the same security roles as within the same business unit

Posted on by 72

We have a Microsoft Dynamics CRM 2015 On premise. Recently the business rule for Entity A has change, and now only Sys Admin and Security Role A can assign those records from Entity A.

In order to achieve this task a  javascript function has been created:

function ifCondition() {
try
{
if (UserHasRoles('System Role A') == true)
{return true;}
else if (UserHasRoles('System') == true)
{return true;}
else
{return false;}
}
catch (err) {
return false;
}
} // End Function ifCondition

in the entity form we have another JS with reference the above function:

if (ifCondition())

{EnableField("ownerid");}

else {DisableField("ownerid");}

This part works like a charm.

in the ribbonDiffxml we created 

this enabledrule

<EnableRule Id="Custom.new_entityA.NameofEnabledRule.EnableRule">
<CustomRule FunctionName="DisableField" Library="$webresource:new_/shared/scripts/Javascriptfilewithfunction.js" />
</EnableRule>

and on the Command definition we have these Enabled and Display Rules:

<CommandDefinition Id="Mscrm.AssignPrimaryRecord">
<EnableRules>
<EnableRule Id="Mscrm.FormStateNotNew" />
<EnableRule Id="Mscrm.AssignPrimaryPermission" />
<EnableRule Id="Mscrm.NotOffline" />
<EnableRule Id="Custom.new_entityA.NameofEnabledRule.EnableRule" />
</EnableRules>
<DisplayRules>
<DisplayRule Id="Mscrm.AssignPrimaryPermission" />
<DisplayRule Id="Mscrm.NotClosedActivity" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="Mscrm.CommandBarActions.assignObject" Library="/_static/_common/scripts/CommandBarActions.js">
<CrmParameter Value="PrimaryEntityTypeCode" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
<CommandDefinition Id="Mscrm.AssignSelectedRecord">
<EnableRules>
<EnableRule Id="Mscrm.SelectionCountAtLeastOne" />
<EnableRule Id="Mscrm.VisualizationPaneNotMaximized" />
<EnableRule Id="Mscrm.NotOffline" />
<EnableRule Id="Mscrm.IsValidForHierarchyView" />
<EnableRule Id="Custom.new_entityA.NameofEnabledRule.EnableRule" />
</EnableRules>
<DisplayRules>
<DisplayRule Id="Mscrm.AssignSelectedEntityPermission" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="Mscrm.GridCommandActions.assignSelectedRecords" Library="/_static/_common/scripts/CommandBarActions.js">
<CrmParameter Value="SelectedControl" />
<CrmParameter Value="SelectedControlSelectedItemReferences" />
<CrmParameter Value="SelectedEntityTypeCode" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>

Now, the problem. Sys admin can see and assign the records perfectly both in lower environment, in Prod, and a Prod like environment with a copy of Production

Users which have System Role A when this change was introduce, CANNOT assign in Prod using the Assign button, but can in lower environments and in the Prod like environment. By the way the CAN ASSIGN the record by change the ownerid field (as it is unlock for them) in all of the environments.

Admin users setup to matchs Users of the same business unit as System Role A users with System Role A security role CAN assign in all environments.

So my problem is those initial users (stakeholders) which need to Assign using the Assign button can not... what can it be? any given idea?

*This post is locked for comments

  • Hittori Profile Picture
    Hittori 72 on at
    RE: Assign button works for some users but dont for some others, even with the same security roles as within the same business unit

    Thanks Zohaib for your answer, but as i think mention, if not i will do it now. We took the org backup copy, put in a different environment lets call it BACKUPPROD Environment, and when the users access to that environment, they are able to assign, while in PROD they cannot :(

  • Suggested answer
    Zohaib Uddin Khan Profile Picture
    Zohaib Uddin Khan 2,811 on at
    RE: Assign button works for some users but dont for some others, even with the same security roles as within the same business unit

    Check the following and you will get the answer:

    1. Security Roles have different permissions in different environments.

    2. Users are part of different team due to which users have different permissions in different environments.

    Make sure all environment permissions are same.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans