EpiButton In Customization To Trigger BPM

Hello,

I have created an EpiButton on a customization, and I have created a bpm that will send an email informing employees that a new job has been created. I want to be able to click the epibutton in my customization and it trigger the bpm to run. How would I go about accomplishing this?

You’ll need to fire that BO in which you put your BPM. Where did you put your BPM? which method?

It is a method directive, I put it as post-processing, and it is an update method.

ok so you need to trigger the update. The easiest way is to set the RowMod=“U” on your “Main” dataview then call oTrans.Update();

oTrans.MainDataView.dataView[oTrans.MainDataView.dataView.Row]["RowMod"]="U";
oTrans.Update();
3 Likes

Would I need to do this in the customization or put an execute custom code in the bpm?

As you stated in your original question you need to trigger your BPM via a button click. BPM runs server side, button click (customization) is client side.
The above code triggers your BPM by invoking the Update method (Server Side)
so this would have to be placed in your customization button click.

1 Like

Thank You sir

Hello Chilyer and Jose!

I wanted to thank you both for the dialogue on this particular topic of using an epibutton customization to fire off an email alert, or trigger a BPM. For me personally, this is huge. I read through the above posts and even tried using the suggested code Jose provided while in my own particular customization I am working on in DMR Processing.

What I would like to see are some more detailed steps in order to get an epibutton to fire a BPM. I have my button created (currently unbound as it’s an epibutton so assuming no binding is required?). I created a post processing method directive for custom update using the condition of my button field is changed on the specified row. Please advise if another condition type should be used or how to point to my specific epibutton in the BPM. Following the condition I want to clear two different fields so the “Set Field” option will work for me as would the “Send Email”.

Once the Method Directive (post processing for update or custom update) has been created this is where I get lost. Not sure where to go in the customization window to point my epibutton to the Method Directive. My guess is Form Event Wizard should be used for my epibutton on a click and then somehow put in the code referencing the Method Directive, but again this is where I get lost and could use some help.

Thank you both and to anyone else who can help get me on the right path! Being able to use epibuttons in cusomizations would be extremely useful!

I have attached a couple screenshots for what I have populated currently.

Event Wizard Clear Signoff Button Code

Geof

You can’t reference the method directly, you have to trigger it. So if you have the BPM on update, you need to trigger a save so that update runs. Then you can set a BPMdata field to be able to use as a condition to run or not.

Brandon,

Thank you for the help. Couple of questions with respect to your response:

  1. By ‘trigger it’ I gather you mean set up the BPM such as a Method Directive Post Processing on Update or Custom Update, or whatever trigger you want? This would mean that the BPM fires whenever an Update or Save happens so every time you are in a menu and “Update” or save, the BPM would fire sending off the email notification or in my case, set field value to null. How do you stop that BPM from clearing out a field or sending an email every time a save action happens and only limit the BPM to fire when the epibutton is selected?

  2. Where is this BPMdata field you are referencing? Are you referring to a property of the epibutton that needs to point to a BPM trigger event? I am not sure where/how this is done in customization maintenance - Form Event Wizard?

Thank you again!

Geof

So set something the CallContextBPM like this.

Then in your BPM you have call context variables that you can use to filter.

Ok I will give this a try. When using an epibutton instead of the example you provided of CheckBox01, would I bind my epibutton to the Call Context BPM Data field of Checkbox01 in customization properties or how is this connection made if not there?

With your epi button field, you set the BPM context variable to true, then you have to trigger and update somehow. (change something trivial and save in code). Then the BPM will fire, and you have a condition so it only completes when that BPM context is true. Don’t forget in your BPM to set that variable back to false after you do what you want to do.

Brandon,

I am working through your suggestions and trying to understand your meaning, but coming up short. In a nutshell what I think you are telling me is to bind my epibutton to the Call Context BPM Data of Checkbox01.

I think you then mean to use the Event Wizard to do a control type filter on the Epibutton of my custom control (QAClearSignoff in my case) and the available control event of click to run the code you listed above setting “CheckBox01” = true.

When CheckBox01 = true has been set the BPM can then fire per the condition and then execute subsequent actions.

Hope I am following you - just trying to understand the process and what I need to do to make this work. This does seem like an awful lot of effort. By creating a custom checkbox field a user can check and then save I can then use method directives to do the same sort of things even unchecking the box as the last step in the BPM. I guess I don’t see why the developers made using buttons so complicated when a checkbox can do the same thing much easier…

That’s a perfectly valid solution, and you are right, it’s easier. Buttons make things happen on the UI, and the system is designed so that it only sends stuff to the server when there is something to send. So a button in and of itself is a bit difficult to simply trigger stuff server side. Adding a checkbox is something that will trigger the server to do something, so it’s a good way to trigger your update.

As far as the specifics you are asking about, you don’t need to bind the button to anything. A button doesn’t display anything, so the only reason to bind it to anything is for something like row rules. Once you make the button, you can use the wizard to create a button event for you. This gives you an empty method to put whatever code you want into that that method that will fire when you click it. So what I would probably do is change your new checkbox, then add an oTrans.Update() and it should trigger your update method. See the post below about using oTrans.Update()

Or… Like you said, put the check box on there, check the box and hit save.

Thank you Brandon I will try that out and see if I can get it to work. The checkbox is working just fine as expected for the time being but it would be nice to really understand and nail down buttons and getting them to do things for the project I am working on and future ones.