I'm trying to create automation to calculate custom fields. My current scenario is I have 3 different fields with dropdown values. If the dropdown has a certain alpha value it's equal to a numeric value. I need to extract the value from these 3 dropdowns and add them up in the new field.
So far my automation has the custom field values as a property and if I'm just setting one it's fine - I'm struggling with the syntax to essentially add these together:
For example {{#if(equals(UBV, "XXL"))}} 13 {{/}} works fine and populates the field. But I need to account for each potential value. Below is what I'm trying to do, but I keep getting the following error:
Error parsing template: Failed to close 'if(equals(RROE, "XL"))' tag
{{#=}}({{#if(equals(UBV, "S"))}} 1 } + {{#if(equals(UBV, "M"))}} 3 } + {{#if(equals(UBV, "L"))}} 5 } + {{#if(equals(UBV, "XL"))}} 8 } + {{#if(equals(UBV, "XXL"))}} 13 {{/}}) + ({{#if(equals(TC, "S"))}} 1 } + {{#if(equals(TC, "M"))}} 3 } + {{#if(equals(TC, "L"))}} 5 } + {{#if(equals(TC, "XL"))}} 8 } + {{#if(equals(TC, "XXL"))}} 13 {{/}})+({{#if(equals(RROE, "S"))}} 1 } + {{#if(equals(RROE, "M"))}} 3 } + {{#if(equals(RROE, "L"))}} 5 } + {{#if(equals(RROE, "XL"))}} 8 } + {{#if(equals(RROE, "XXL"))}} 13 {{/}})
I've found adding a table is helpful so I've got that and now have:
{{#=}}{{ShirtSize.get(UBV)}}+{{ShirtSize.get(TC)}}+{{ShirtSize.get(RROE)}} {{/}}
Which works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kate W_ and welcome to the Community!
I can imagine it's difficult to find out what's wrong here; my eyes hort from looking at the pile of {{((#))}}{{/}} symbols. And I haven't even tried to compose the entire calculation 😛
Just to make your data easier to process and make the calculation easier to understand, may I suggest setting up lookup tables for your different custom fields instead? You will get a list of options and the corresponding values that will be much easier to refer to.
Check out this Community article to learn how to set them up and use them. I suspect it will make it way easier to deal with all the conditional logic behind the use case ...
I hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.