Skip to main content

Could someone tell me how to get the value of and element inside a collection in a workflow please?

i’m trying to get Ligne.Cf_Sale_Unit_Price  but i can’t figure it out 

 

Also, can i have the syntaxe for the execution.getVariable and setVariable please?

Thank you in advance.

 

@kamnlk ​@dsj any idea please? :)

Hi ​@IFSRUNINNOVAL

 If your collection has only one record (and you are sure about it :D), it’s possible to use the following syntax to get the value

prixHT = execution.getVariable('Linge')n0].Cf_Sale_Unit_Price;

 

Otherwise, you need to use a Sequential Multi Instance  task (loop) to get value from each instant.

 

Hope it helps!

Damith


as dsj mentioned we can use the same approach use for a collection can be used for getting value inside an item

var test = execution.getVariable("Ligne").cf_Sale_unit_price


var BigDecimal = Java.type('java.math.BigDecimal');
execution.setVariable('test', BigDecimal.valueOf(test));

 

syntax is like below

var test = execution.getVariable("variable_name")

execution.setVariable("variable_name", variable_value)

 


Reply