BPM Email Help

,

I am building a BPM that will send out an email to our purchasing agent whenever a requisition is made. I am trying to link the PurAgent table and the PartClass table so that I can pull in the email for our purchasing agent. the error I’m running into says that the partclass table does not have a BuyerID.

However, I clearly see the BuyerID on in the part class table. Any ideas on why this is happening?

image

Db.PartClass.BuyerID isn’t a specific value. Which PartClass do you want the BuyerID for?

Try creating a variable to hold BuyerID, and assign it with a SetFiled widget. In the set field’s expression, you have something like:

Db.PartClass
  .Where(r => r.Company = callContextClient.CurrentCompany 
    && r.ClassID == !reference to the parts Class!)
  .select (r=>r.BuyerID)
  .DefaultifEmpty("")
  .FirstOrDefault()

Then use that variable in your expression for getting the email address.

1 Like

To add:

It’s difficult to see where this BPM is called. The join email/class/buyerid may be accessed a different way, based on the tt available.

1 Like

All,

So what this BPM is triggering on is this:

image

There are no temporary tables within the designer.

I think I’ll have to do what @ckrusen was saying, manually assign several variables and compare them against tables.

@ckrusen, I can build a BAQ for Partclass and get individual buyer ids so why does it say it does it not exist within the error above?

image

1 Like

@ckrusen

OH! Okay, so I think I get what you mean. In this case I want to run the ReqDetail Class against the Part class and get the buyerID that way. Then run the BuyerID against the the PurAgent Table BuyerID to get the buyer Email. With that logic in mind, how do I specify the curent ReqNum and ReqLine from the ReqDetail table?

1 Like

I am guessing you want check this field?

Maybe there is a better Method to have your BPM. When the ReqDetail with a ReqDetail.Class is added?

@knash,

Right now we only want the BPM to trigger if the Req is dispatched. And yes that is the field I am now using for some of the logic. Thanks for the help thus far!

We email purchasing on the update method.

There is an if check that determines when to create the email. Wonder if that will work for you?

1 Like

Here is what I did for Req’s, two pieces:

  1. Notify Dispatcher and Requester of updates: Data Directive on ReqLog Table. Create Variables to Store To & From values and get the values via C# Expression based on thier User ID.

  2. When a Req goes to purchasing it immediately creates a PO Suggestion Record in the SugPoDtl table (New PO Suggestions) and it already determines the BuyerID in that process. So you can create a Data Directive on SugPoDtl with a condition where there is a new record and ReqNum > 0 then use a C# Expression based on the BuyerID to get their email address from the PurAgent table.

1 Like

@knash,

I’ve been trying that and have been met with two results. Firstly, if I use pre-processing it will lock me out of entering new lines on the Req entry screen. Secondly, if I use post-processing it won’t do anything. The condition I’m using is Req Head Status Type and set it to be equal to “P” for pending. Would you mind sharing what condition you’re using?

@Rick_Bird,
I’m going to have a crack at that in the morning. Thanks for the help!