Skip to main content
Question

get Collection element valeur workflos

  • January 12, 2025
  • 2 replies
  • 102 views

Forum|alt.badge.img+10

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? :)

2 replies

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • 880 replies
  • January 13, 2025

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')[0].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


Forum|alt.badge.img+9
  • Hero (Employee)
  • 132 replies
  • January 16, 2025

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings