Thursday, June 13, 2019

How to pass execution context as a parameter from a button click in Dynamic CRM


For this we can user Ribbon Workbench and add Crm Parameter as our first parameter and pass Primary Control as a value. 
Please refer below image for details.



In JavaScript we can access the field or other values as:

function openDymoPrintAssistance(context)
{
    var formContext = context.getFormContext();
    var clinicappointmentId = formContext.data.entity.getId();
    clinicappointmentId = clinicappointmentId.substring(1, clinicappointmentId.length - 1);


If you are looking for how to create a perfect button, refer here

https://vjcity.blogspot.com/2019/06/how-to-create-custom-button-in-dynamic.html

1 comment:

Anonymous said...

Great tutorial.

The only problem that I found is the first line of the JS.
I had to change it to:

var formContext = context;

Otherwise it shows the error: context.getFormContext() is not a function.