I have been able to pass the formContext to the javascript function that I call from the ribbon when I call it from a Form button, but the same trick when calling from the HomePageGrid pass me a null value.
I use in both cases the Primary Control CRM parameter as stated in multiple places.
You can see on the left side how my PrimaryControl CRM parameter is passing a null value when selecting an item on the Grid. On the right side you can see how my PrimaryControl CRM parameter is passing the formContext correctly.
is it there any way to pass the executionContext/formContext/Context?. As you can see I have tried that is the Primary Control value is null to pick up Xrm.page.context and xrm.ui.getglobalContext.... and still doesn't work.
Any idea of what to do?
This is the configuration in the Ribbon Workbench
Updated for minohimself:
I have set the SelectedControl in the Ribbon and I am receiving on the first parameter the Mscrm.GridControl. And I dont see the formContext as you see it.
I might be doing something wrong, because it is obvious that you are able to see the context? can you point me in the right direction?
What I can see from your javascript code is that you have a theia.button which has a function called ExecuteActionWithErrorMessage that receives at least 4 parameters, including objectid, formContext, entityName, and actionName).
In my case my function is called and should receive the formContext and a yes/no (T/F) statement to decide how to manage the security roles.
So, should I include your four parameters, so I can retrieve as well the objectid, formcontext, entityname and actionname?
Thanks for your quick turn around and help.
UPDATE 2:
Here you can see my Ribbon Workbench Command
and here you can see my Debugger View:
as you can see what you see it is not what I see. I am on a Ms. Dynamics CRM v9.0.15.9 (version 1612) on-premises.