My case is an Engineering Change Request that the operators can trigger from their work queue.
Essentially if they open a job and spot an error or improvement to the method they can click a button that will open a data form to record their request and send it to the Engineering/Scheduling team to alter.
I have created the BPM and am able to customises the dashboard to place the button however I am struggling to call a method that will trigger the BPM.
I am trying rightly or wrongly to call the adapterUD01.Update method but it wonât fire when I click the button.
Is this possible or am I going about it the wrong way? any help would be appreciated.
public class Script
{
// ** Wizard Insert Location - Do Not Remove âBegin/End Wizard Added Module Level Variablesâ Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void CallUD01AdapterUpdateMethod()
{
try
{
// Declare and Initialize EpiDataView Variables
// Declare and create an instance of the Adapter.
UD01Adapter adapterUD01 = new UD01Adapter(this.oTrans);
adapterUD01.BOConnect();
// Call Adapter method
bool result = adapterUD01.Update();
// Cleanup Adapter Reference
adapterUD01.Dispose();
} catch (System.Exception ex)
{
ExceptionBox.Show(ex);
}
}
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
MessageBox.Show ("HI!");
CallUD01AdapterUpdateMethod();
}
Or just a regular dashboard that an operator will view, and if something looks like an ECR is required, theyâd click the button. That button click would cause a form to open, which they could enter the info, and it would result in sending an email?
Does the dashboard use UD01 at all? Or where you just trying to hook on to a BPM tied to that?
Hereâs what I got to work (hopefully someone else has a better solution)
Make a BAQ that just needs to exist for the BPM to be triggered
In your dashboard customizationâs button click event:
a. Change the adapter to DynamicQueryAdapter
b. Call method GetByID using the BAQ from step 1
ex: var result = dqa.GetByID("E10H-BAQTrigger");
Make a BPM on DynaicQuery.GetByID
a. Add a condition that checks for the queryID equal to the BAQ ID from step 1.
b. Call your BPM Form
Thanks Calvin,
I have been able to use the UD01 Adapter and just worked my way through the list of Methods and got GetaNewUD01 to work. Iâm not sure of the reasoning here however it is enough to get me on to the next step.
I would really recommend going with what Calvin suggested with the UBAQ. This basically gets you your own little function, and you even have the added ability to add lookup information using a BAQ that could be helpful to include in your email.
Trying to use UD01 when you arenât actually doing anything with writing to UD01 can be kind of a pain (like you are experiencing). You could also consider actually writing the information into a UD table then you have a built in history logging of what got sent and then you can use those methods and you will be able to use some of those methods.
As a side note, the reason that UD01.Update() isnât working is the system looks to make sure you actually have a row to be written to UD01 before it calls update. So you need a row with a rowmod of A (added) or U (updated) and if you donât have either of those, update will not fire.
Brandon - Does calling UD01.GetNewUD01 do anything bad if that new record is never used?
Or does it just create a temp data structure, and doesnât really do anything until the adapter updated? What if it was a table that is setup as a child table? Or that table happened to have a BPM to generate an automatic sequence for a key field.
It just gets you a new row in memory. Itâs wonât hurt anything, but doesnât really do anything helpful either. And if you ever decide to use UD01 in the future, now you might have conflicts which you will have to work around. Just because you can, doesnât mean you should
In future versions, this is where functions is going to be awesome because we can finally get past the âHow do I hack something to get the server to do somethingâ.
Currently, we uses UBAQs to house this stuff and just call the BAQ (and in effect, the BPMâs within that BAQ) to do all that stuff. That way we donât have to bother hanging BPMâs off of irrelevant processes.
P.S. I wasnât even suggesting to use a UBAQ. I was hacking, by using the DynamicQuery.GetByID() method. Which also affords a way to detect if the method is called from that customization (via the queryID)