Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
In this blog, we are going to create a request using ExecuteWorkflow action and would execute the request that would execute a custom workflow. This approach would eliminate the need to create an Ajax request and is supported across web client, UCI and Mobile.
Note: Make sure to keep your existing custom workflow available to run as an on-demand process.
Now with the help of execute request we are going to trigger that workflow.
Solution: Following is the piece of code to achieve the above objective.
In the above piece of code, we have created a dynamics request object named “ExecuteCustomWorkflowRequest” and we have passed current account id to it along with workflow id. We would recommend to retrieve workflow id dynamically. As of now, we have passed hard coded workflow id for demonstration purpose, which can be found in the URL of workflow as highlighted in blue colour in the following screenshot:
Once the “triggerCustomWorkflowRequest” request is built, we would pass it to execute method which would then invoke “ExecuteWorkflow” action. This action will execute our workflow to create task related to the account record whose id was passed in the “triggerCustomWorkflowRequest” request.
Upon execution of our custom workflow via execute method, following task is created.
Also, following is a link to execute workflow via HTTP Request: https://www.inogic.com/blog/2016/11/execute-workflow-using-web-api-in-dynamics-365-2/
For more information on execute method visit the following link: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/online/execute
You can find complete list of WebApi actions here: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/actions?view=dynamics-ce-odata-9
Hope it helps.
Business Applications communities