BPM Data form on the fly

Hi,

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();
}

}

Are you storing the operators input in the DB? Or just trying to have their text be used in the email to message to engineering?

I won’t be saving the inputs just passing them to an email.

You can build an email message via code from within the customization.

EDIT

Checkout this link instead of the previous posted code.

edit #2

In aaron’s code, the last line can be just

client.SendAsync(message,null);

Thanks, but I was hoping to trigger a Dataform so that I could collect the recommendations before sending an email.

Is it an updatable dashboard?

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)

  1. Make a BAQ that just needs to exist for the BPM to be triggered
  2. 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");
  3. 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 :wink:

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.

But that’s been my Bread-n-Butter!!!

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)

1 Like

Thanks for the support guys, I will give it a go this morning.

Thanks Calvin, Works like a charm.