ShipTo Data Directive: Display "before" and "after" state values in email?

Desire: Send an email when Customer ShipTo state changes. In the email, display the “before” state value and the “after” state value in the email.

So far:

In-transaction data directive on ShipTo called “CheckForStateChange”

  1. Condition: the ttShipTo.State field has changed from any to another
  2. If true, Set BPM Data field callContextBPMData.Character01 = ttShipToRow.State
  3. Then, Enable standard directive

Standard data directive on ShipTo called “EmailStateChangeDetails”

  1. Condition: Check that the directive was enabled from CheckForStateChange directive (above)
  2. If true, send an email with the body saying
    "before state: " callContextBPMData.Character01
    “after state:” myFieldQuery ttShipTo.State

Problem: The “before” state is always equal to the “after” state.

I was told by someone wise on here to always put a pop-up in the directives to see the actual data that is going back and forth. Many times the dataset does not include what you think it does.

Try that and see if the data you are expecting is actually there.

Thanks. What kind of popup displays all of the data?

Put a “Show Message” widget in, click on the “designed” field, and a new window will appear. Click in the body of the window and click the Insert button. Choose either Field Query or Table Query and select the fields you want to see. When done, when you transact you will now get a popup with the table/field you selected. It is one of the best tips that I have gotten on here.

Thanks. I just always see the “after” value… I’m not sure what happens to the “before”, even though I’m in the In-Transaction Data Directive.

Oh, I missed that it was a data directive. What you will have to do is a BPM to capture the before value and put it in a BPM data field to retrieve it when you get to the data directive.

What was the solution to this issue?
Use a Standard or In-transaction Data Directive?
What table do you capture the “before” field value?
Wat table do you capture the “after” or “changed” field value?

You need to create a Method Directive on whatever method is being called to make the change. In that directive you would capture the old value and put it in a field in the callContextBPMData. Then create a Standard Data Directive that displays the old (from the call context) and new fields.

Should it be a Pre-Processing Method directive? I have tried this on BO.SalesOrder.Update using a condition that NeedByDate, ShipViaCode, or FOB is changed from any to another, then using three Set BPM Date Field widget to capture those fields, but I am not getting the expected results. This is my Method Directive:


Should I not be using the ds variables?

My Data directive does send an email, but the callContextBPMData… shows nothing.

What am I doing wrong?

Hi

I am trying to achieve the same thing, did you figure out how to get the previous value?

Thank you.

You need the Unchanged row. You can get it in code like below or something similar an expression widget.

OldCustomer = ttCustomer.Where(r => r.Unchanged()).FirstOrDefault(); 

if (OldCustomer != null)
{

if (ttCustomerRow?.TermsCode != OldCustomer?.TermsCode || ttCustomerRow?.CreditLimit != OldCustomer?.CreditLimit || ttCustomerRow?.TerritoryID != OldCustomer?.TerritoryID)
{

Thank you. I tried this in SalesOrder and it worked.

But does not seem to work when I am trying to track changes in my Job Start Date. I have created an In Transaction Data Directive in JobHead table with condition of, if JobHead Start Date changes from Any to Other then a Show Message with the Unchanged JobHead Start Date. I get the pop up message when the start date changes, but it is just blank, does not give me the previos value.

Have also tried doing it in Method directive in Job Entry Update, but I don’t get anything from here, even the pop up message. Do you know how I can track the before and after for the Job Start Date? I was able to succefully track before and after data from Job ReqDue date but unfortunately not for the Start Date.

Thank you so much.

There are times when you use a field has changed condition that the old row doesn’t get sent into code and you have to just use code to see if the field has changed.