We need integration between CRM and 3rd party using Javascript.
When a user starts any workflow let's say WorkflowA, we have to send a message to 3rd party system with CRM userid and entity record id using Javascript.
1- Is there any way to detect workflow instances when a CRM user started it and get the status too("Success", "In Progress","Failed")?
2- Is there any way to detect if a CRM user has started any workflow?
What have I tried:
I have checked the WEB API, and I do not see any event that can help me to catch the workflow session from the user. One way would be continuously checking asyncoperation table but it is not good to fetch data after 2 seconds from every user(Just imagine if there are 150+ CRM users!!). The ideal would be if there is an event that can be captured in Javascript or detect workflow instances from the user side in the browser.
I have checked XRM functions too, but could not find any event that can help me to capture the workflow instance of the user!
select top 5 createdon,completedon,* from asyncoperation order by createdon desc