Maximiliano
12/08/2023, 4:05 PMRyan Valizan
12/09/2023, 4:43 PMBefore Record Submit
action and employ either a custom script or a formula that iterates through the line items to find the highest value. If scripting is an option, SuiteScript could be used to loop through line items to find and set the highest value on the body field.
In a formula-only approach, you might need to use a series of CASE
statements or a custom formula field that calculates the maximum line value, which you could then source to the body field. This can get complex if you have many line items and might not be as straightforward as a scripted solution.
Here’s a simplified pseudo-formula for illustration:
CASE
WHEN {item1} > {item2} AND {item1} > {item3} AND {item1} > {item4} THEN {item1}
WHEN {item2} > {item3} AND {item2} > {item4} THEN {item2}
WHEN {item3} > {item4} THEN {item3}
ELSE {item4}
END
This formula checks which line item has the highest value and then populates the body field with that value. Note that you’ll need to replace {item1}, {item2},...
, with your actual line item field references.
If you have more than a few lines, or if the lines can change, a scripted approach would be more dynamic and maintainable.yagyakumarnag
12/12/2023, 3:30 AM