2
votes

In a javascript function, I want to open the window that is usually opened when the user clicks on the "Assign" button in the lead form.

In the ribbon workbench, I see that the function that is called on the click of Assign is XrmCore.Commands.Assign.assignObjectLegacy, in the library Main_system_library.js.

Is it possible to call this function in javascript?

2

2 Answers

1
votes

Doing such things like using internal libraries, calling internal methods are unsupported in Dynamics CRM. Future version of product changes may affect this implementation.

Instead, try to use jQuery to find the button element & invoke the onclick event like $('#assignbuttonid').click(). This is too unsupported because we cannot use DOM manipulation but somewhat ok.

Otherwise I don’t see any alternate supported solution to do this.

1
votes

Using jQuery is one way to mimic the feature but like Arun said it's unsupported and risk to break in the next update. Instead, I would call a custom action. An action is basically a workflow. You can assign your entity via javascript and it will be supported.

Here is a sample you can use: https://community.dynamics.com/crm/b/nishantranaweblog/archive/2017/05/27/sample-code-to-call-action-using-web-api-in-crm