Email Template Table Field

How do I add ds.Customer here? or is it possible to add?

1 Like

Hey Sam,

Given that you’re using a BPM on the SalesOrder business object. What you could do is either through custom code or via the “Invoke BO Method” widget, grab the customer record you need by passing the “CustNum” field off of the “OrderHed” table which you do have access to. After establishing access, grab the fields you need off the customer table and store them into variables you’ve created within the BPM.

Here is a quick example that shows how to access the customer table through code using a BPM variable called “custNum” that stores the CustNum field from OrderHed.

var cust = (from r in Db.Customer where r.CustNum == custNum && r.Company == this.CompanyID select r).FirstOrDefault();

if(cust != null)
{
  custName = cust.Name;
}

Here are the BPM Variables I used for the code example.

And here is a snippet of widget used for populating the custNum from OrderHed.

if you’d prefer to grab the entire customer record instead of just a few fields. You’ll want to first set up a BPM variable of type “CustomerTableset”.

image

After doing so, grab a “Invoke BO Method” widget and set it up as shown. Passing in the CustNum from the OrderHed table like the code example.

Once you’ve done that, your populated CustomerTableset will be among the table options for you to select in your send email widget.

One thing to note, you’ll probably want a condition widget on the BPM to verify the CustNum field on OrderHed is populated, just to play it safe.

I hope that this helps!

4 Likes