Hi expert,
Now the requirement: create a custom button with ribbon workbench. Ribbon command use JavaScript webresource library call a external logic app flow. The error message:
and
My code as below
Hi expert,
Now the requirement: create a custom button with ribbon workbench. Ribbon command use JavaScript webresource library call a external logic app flow. The error message:
and
My code as below
Sorry for making confuse. Actually I have remove the event handler from form, no record is opening/refreshing to trigger flow any more. Here is the complete code:
I still don't understand why the initial version of the code didn't work. Also, the code placed on a hander of the ribbon button click is not executed when the record is opened/refreshed. If it is get executed - either it's written the wrong way or it's registered the wrong way.
Can you please provide the full code (including namespaces and so on) not the truncated version?
Hi Andrew, Bipin,
Thank you so much for your help.
I have tried to use the code Var formContext=primaryControl.getFormContext(), it still not works. The error message:
Referring the blog - Error : getFormContext is not a function in UCI , Ribbon Button (http://microsoftdynamics.in/2020/08/22/error-getformcontext-is-not-a-function-in-uci-ribbon-button/), I rewrite the code (beginning part) as below:
// continuedly
Now it's work!
But the new question is how to block the webresource to trigger the logic app when I loading/refreshing the Contact record, I only want to trigger the flow through click the custom button.
Any idea? Thanks.
Hi,
Can you move fullname code above and add alert(fullName);
To see if you are able to get full name value .
If you still get an error then try getting formContext as below
Var formContext=primaryControl.getFormContext();
Getting contactid that way is legit - learn.microsoft.com/.../getid
According to the error you provided (cannot read property of undefined, reading entity) I believe your code fails on the line
var contactId = formContext.data.entity.getId();
All this looks like indirect troubleshooting and doesn't make a lot of sense, to be honest. Check my video on how you can troubleshoot your code - www.youtube.com/watch
Thank you!
Here is the screen:
I'm thinking, for getting Contact record GUID, I need change the code line
FROM
Gotcha. Your code looks good. Can you please provide the screenshot of your command from ribbon workbench? It seems that you do not pass the context inside - it should be CRM type, PrimaryControl.
Hi Andrew,
Thank you for your response and question. The custom button is on the ribbon of the form.
Hello,
Is it a ribbon of the grid or a ribbon of the form?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156