web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dynamics CRM, Business Process Flow

(0) ShareShare
ReportReport
Posted on by

How to trigger crm plugin when business process flow is set to finished ? and how to capture details (like BPF Guid) of the business process flow which is moved to finished using crm plugin ?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    AndrewLy365lyf Profile Picture
    6 Most Valuable Professional on at

    I would convert the plugin to a custom workflow, then create an on-demand workflow process that fires the custom workflow.  Once the on-demand workflow has been created you can edit the BPF and trigger it at exit/entry to a stage.

    As for passing in the ID for the BPF, I don't believe that this information gets passed to plugins/workflow as it's not an attribute belonging to the entity for which the operation is being performed.  It is however supported through client side script.  You could try to persist this value through client side JavaScript, capturing the ID using the following code:

    var processId = procObj.getId();

    (See [View:https://msdn.microsoft.com/en-au/library/dn817878.aspx] for more details on the Xrm.Page.data.process library)

    Then setting this value to a custom attribute on the entity.  That should work without problems.

    Regards

    Andrew

    > If you found this answer helpful please support our community by marking as verified answer <

  • Community Member Profile Picture
    on at

    Hi Andrew,

    Thank you for quick reply.

    My requirement is something diff  in your suggested approach you have mentioned that to create workflow and then executing custom workflow based on that. But in that case i need to create workflow on all the worflow entity and that is customization which is not allowed in publishing guideline.

    Also i need some information based on pre state of the event and perform some operations on the same.

    To achieve this i have created one plugin class which will execute on state change event (SetState & SetstateDynamic  message) And i am able to trigger plugin on the same but now point is how to capture information of the workflow on which that plugin is triggered using EntityMoniker ?

    Please suggest the solution for the same.

  • Suggested answer
    AndrewLy365lyf Profile Picture
    6 Most Valuable Professional on at

    I see, in that case you can't use a custom workflow as you require pre-state information.  Given this requirement you may have use a combination of client-side scripting triggering your custom workflow.

    I would start but creating a new Javascript resource, and add an event handler to stage change.

    Xrm.Page.data.process.addOnStageChange(handler);


    Then have this event handler populate the GUID of the BPF to an attribute.  Then finally execute a page save request.

    Xrm.Page.data.entity.save();


    Set your custom plugin to filter on update of this new attribute.  Hopefully i'm reading your query properly.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans