Personalized Community is here!
Quickly customize your community to find the content you seek.
Microsoft Customer Co-creation
Help impact how the tools and services you rely on are developed. Microsoft Customer Co-creation connects you directly with our engineers so you can provide feedback before a single line of code is written. Interested? Learn more at Microsoft Customer Co-creation
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Suppose I want to add a button in ribbon for Products entity/form.
When user clicks on this button, it should call to an external web api and send some data from selected product.
The response returned from web api should display to user in a modal. (This response is just simply a success/failed message)
I am new to Dynamics 365 and have not been able to figure out how to achieve this.
So there are basically 3 questions-
2) Within this JS method, you need to call your own external web api. The code to call/consume external api depends upon the api you are calling so yuou need to figure this out. Below are some general linblks which may help you:
3) To display the response from the web api, you can simply use alert method to popup the value. If you want some good UI popup, you can explore alert.js. Alternatively you can use below supported CRM methods: debajmecrm.com/.../dynamics-v9-0-show-alert-confirm-error-in-modal-style-with-new-client-api-in-dynamics-version-9-0
Hope this helps.
Thanks for quick reply.
Do you know anyway we can add ribbon button purely using a C# solution? And on click on it, we again use only C# to call and retrieve result from web api?
To add ribbon button you need to edit the ribbon xml. Using C#, I don't think there is any supported way, not an easy way I can confirm :). Ribbon workbench is the preferred tool which provides you with GUI to add button. If you search crm + ribbon, you will only find references for this tool only
Why you want to add the button using C#? Use Ribbon workbench and add the button.
You can create WCF service or REST API which you can expose in the web server and then using button call the rest service , to execute your server side logic.
Hey Goutam, Thanks for response!
I used Ribbon Workbench as you and Ravi suggested but I do not want to execute my API using JS. It requires credentials to access API which I cannot put in JS file.
Is there a way to publish some C# solution and execute it from JS code. This C# code will execute API and return the results to JS code which eventually can be presented to user.
Or if there is any other better way? I'm open to suggestions.
You cannot call C# code directly from a ribbon button. The only possible action is calling a JS code. However CRM has something called custom action & custom workflow activity which can be used to achiev eyour task.
1) Add a ribbon button using ribbon workbench.
2) Call a custom JS method from that button.
3) Create a custom workflow activity (C#) which calls your web service and returns the output as output parameter.
4) Create a custom action with output parameter defined. Within this custom action, call you customer workflow activity and set the output of that custom workflow activity to the output of your custom action.
5) Now call this custom action from your custom JS and display the output as an alert.
I have done the similar implementation so post here if you face any issues. Below are some resources which woule be helpful:
carldesouza.com/dynamics-crm-rest-builder . You can download the tool here- github.com/.../releases
2) Creating Custom Workflow Activity:
3) Creating Custom Action with Custom Workflow Activity: You can refer this sample just to understand on creating custom action, passing paramters and calling custom workflow activity. community.dynamics.com/.../creating-an-action-using-a-custom-workflow-activity
Post here if you face any issues.
Business Applications communities