Hello, I have been trying to get a custom field to update when the User clicks "Finish" on the Business Process Flow.
I attempted using a plugin to update but I cant seem to grab the Opportunity entity with the plugin as it only fires when I have the steps fire on the actual bpf instance. Because the bpf instance is a linked table Im not able to do a query with Retrieve Multiple to pull up the Opportunity ID.
As far as I can tell no field is updated when "Finish" is clicked so I'm not able to have anything fire based on an update field.
Ive been trying to get it to work with Javascript and I am able to get it to execute when the button is pushed using addOnProcessStatusChange() and using an IF statement to check if the status is "finished" but because of save/load events going on in the form it dosnt save the field I update via code.
If I add the Xrm.Page.data.entity.save() to the function after the field is updated then it has a dialog pop up asking if you want to save changes before loading the form which isn't a very good UI experience.
Ive add a function to the "OnSave" event but because this event fires before anything else I'm unable to change the field being the ProcessStatusChange returns "active" rather than "finished". So I have no way to tell if the User is in the correct spot to update the field.
Is there a way I can tell what button is pushed? Or a way to tell if a process is archived? The StateCode field only allows "Open","Lost" or "Won" so Im unable to go off of that being it is neither Won or Lost yet. The StatusCode shows "In Progress" even after clicking Finish until it is closed as Lost or Won so Im unable to go off of that aswell.
How do you work with this button?
*This post is locked for comments