I'm trying to use a Workflow to Set Field Value fo...
# suiteflow
j
I'm trying to use a Workflow to Set Field Value for a transaction line field 'Net Amount' to be a calculation of line field {line.amount} factoring in transaction header discount field {discountrate}. The calculation depends on whether {discountrate} is null, a percent, or an amount. I am getting an error 'Invalid Expression'. Below is the expression. Can anyone help here? I'm guessing it has to do with the wildcard for 'contains %'.
c
Missing an
END
j
Thanks. No longer getting Invalid Expression error, but the calculations are incorrect.
a
Take out the ELSE CASE WHEN in the middle You just need. CASE WHEN (first expression) WHEN (second expression) ELSE (last expression) END
j
Thank you. It is calculating correctly when {discountrate} is a % but not when it's an amount.
Can another expression be used to define when the {discountrate} is an amount (does not contain % symbol)? Or is this an issue with how the field is stored in NS database?
k
Can I ask why you are doing this?
Is there some reason Amount(Gross) on the transaction doesn't work?
j
Our printed Invoice form sources this field, so that discounts are reflected at the line-level instead of on the bottom line. This is beneficial to international customers when paying duties & taxes. The goal is to add this field to additional transaction types, i.e. Sales Order, so that if a discount is added upon order approval in NS, it syncs back to our B2B sales platform (NuOrder) with the discounted pricing.
r
@Justin Try the following. The <0 addresses a dollar value in the discount rate field (if you look at the XML of a transaction the field value is negative when a $ is entered). The last example address the discount rate field containing a %. {discountrate} is Null {discountrate}<0 {discountrate} Like '%' || % || '%'