Trigger & script - get updated values (CurrentEntity) before save?

I have trigger ("Sales: Before saving sale") and a script which looks at the sale status and when it is changed to "Lost" a check on some fields are made. But I notice the EventData displays the status as "Open" even though I have selected the status "Lost" when the trigger is executed. I have seen "CurrentEntity" in posts on the community but I cannot that to work and give me any value at all.

Am I approaching this the wrong way?

RE: Trigger & script - get updated values (CurrentEntity) before save?

Hi,

Might be that status is a bit special, but on debugging I see that you have access to these variables;

Documentation of values here.

 

By: Michel Krohn-Dale 7 Dec 2020

RE: Trigger & script - get updated values (CurrentEntity) before save?

Will check that, thanks!

Also noticed that a UDEF checkboxes is not reflected in EventData correctly. I click one of them so that one should have a 1 as value and the rest 0, but all had 0.

By: Patrik Larsson 7 Dec 2020

RE: Trigger & script - get updated values (CurrentEntity) before save?

But is there a list somewhere what values are available as CurrentEntity?

By: Patrik Larsson 7 Dec 2020

RE: Trigger & script - get updated values (CurrentEntity) before save?

Hi,

I only use the below to check if a value is "Sold" or "Lost", not using "SaleStatus" anymore, since the below always updates correctly:

//  Where "-1" is "Lost" and "-2" is "Sold".
if( eventData.getInputValue( "SaleEntity.Rating.Id" ) == "-1" )
  // Do something
By: Chris-Anton Eriksen 16 Dec 2020