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

  • Suggested answer
    AndrewLy365lyf Profile Picture
    AndrewLy365lyf 6 Most Valuable Professional on at
    RE: Dynamics CRM, Business Process Flow

    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.

  • RE: Dynamics CRM, Business Process Flow

    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
    AndrewLy365lyf 6 Most Valuable Professional on at
    RE: Dynamics CRM, Business Process Flow

    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 <

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans