MS Dynamics CRM 2013/2015/2016

MS Dynamics CRM 2013/2015: Disable the ‘+’ icon on Sub-Grid based on Status Reason

Scenario: Disable the “+” icon on the sub-grid. I.e. Disable “+” icon on the Budget entity’s sub-grid (Funds) when the Budget records status reason is “Approval Pending” or “Approved”.

Solution:

1. Download and Import the Ribbon Work Bench solutionUploadWorkbench

2. Add a Custom JavaScript Script with the function “DisableNewButton”

function DisableNewButton() {var status = Xrm.Page.getAttribute(‘statuscode’).getValue(); //if status reason is Approved or Approval Pending if (status == 100000001 || status == 100000002) { returnfalse; } else returntrue; }

3. Open Workbench and select the solution which has the entity on which “+” icon should be disabled for Sub-Grid.

OpenSolution

4. Select the “Fund” entity, select the “Add New {0}” button and “+NEW {0}” button, right click and click on Customise Command.

ButtonCustomize

5. Select Enable Rules and Add New Rule

AddEnableRule

6. Right click the newly created enable rule and click on “Add Rule” AddRule

7. Select the “Custom Javascript Rule”

CustomRule

8. Fill the properties with “FunctionName” and “Library”. Set Default value to “True” and InvertResult to “False”

CustomRuleFunction

9. Select the command for both buttons, right click and click the “Edit Enable Rules” AddEnableRuleToCommand

10. Add the newly created enable rule

AddCustomRule

11. Publish the solution.

:Kishore Dhanekula

2 Responses to MS Dynamics CRM 2013/2015/2016

  1. Thank you for this post. Nice Article.

  2. Leela says:

    Awsome.. Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s