Goal: To calculate an overall priority score, where the calculation of the score varies based on the value of a category and the inputs to the score are several (e.g. 4) select fields with number-based option weights.
Context: Since I can't use conditionals (if category == 'a') in the write your own expression of a custom formula field, I am now using automation for checking the category and calculating the scores in varied ways based on the category. Additional context: the output field or score is a number field, since I suspect a formula would be overwritten by frontend calculations. I'm trying to find a solution that uses the option weights defined by users on the frontend rather than hardcoding weights in the backend automation.
Problem & Ask: I have been unable to access the select fields' number-based option weights in automation. I can get the select option value (e.g. 'High', 'Medium', 'Low'), but the weight assigned to it (e.g. 30, 20, 10) has been difficult to access. Are these stored in the backend, and if so, how might you access the number-based (or rating-based) option weight of a select field in automation?
Steps taken: I've tried logging several variations of the fields themselves or the formulas: {{select1}}, {{select1.value}}, {{select1.optionWeight}}, {{select1.value.optionWeight}}, {{select1.weight}}. I've also tried with and without math, {{#=}}{{/}}. The log will show "High" or "High + High + High + High" for some variations, but it has not returned the option weight 30 nor the score 120. Just to show an example, I've included a simple addition below. I've used both fieldnames (select1, select2, etc.) and field IDs (customfield_11111, customfield_22222); both work to retrieve the select options but not the respective number-based option weights.
Example:
{
"fields":{
"score": {{customfield_11111}} + {{customfield_22222}} + {{customfield_33333}} + {{customfield_44444}}
}
}
Hi @Caitlyn C , the option weights are not available to Automation yet unfortunately.
Hi @Tanguy Crusson, thanks for letting me know. I'll try to build a workaround for now then - perhaps using the lookup table @Walter Buggenhout shared. Would love to use conditionals in the JPD formula field or option weights in Automation in the future if possible!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Caitlyn C and welcome to the Community!
Before diving into the tunnel you're already in with you, may I suggest to take a step back? The option weights in JPD are designed to be used in JPD formula fields. If you say you want have limitations there (the additional conditions you want to apply) and for that reason would like to use automation instead, you might want to consider moving the numerical logic into automation as well.
In automation you can create a lookup table where you map the values from (standard) fields to numerical values that your can then leverage in your calculations.
A fellow champion wrote a community article explaining how to set this up. That might be a feasible workaround for what you are trying to achieve.
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.
Hi @Walter Buggenhout! Thanks for the welcome and the quick response! The post you shared about lookup tables is indeed helpful and something I may use for another project or perhaps a better backup plan to my hardcoded logic. The table is nicely organized and seems relatively easy to use. However, it doesn't quite fit my use case here.
For this use case, I have 3 types of users: 1) the users who only use frontend and "High", "Medium", "Low", without reference to the weight, 2) users who do 1 and assign weights on frontend but don't use automation, 3) users who do 1, 2, and also use automation. The lookup table or hardcoded weights would work better if I only had user types 1) and 3), but I have some users who will want to add their own weights on the frontend and have them used/consumed on the backend without having to use automation.
To one of your other points, when you say, "The option weights in JPD are designed to be used in JPD formula fields," does this mean they are not accessible on the backend or from automation? Perhaps just another point of clarification to confirm my understanding: there is no way to use conditionals in the JPD formula fields, correct?
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.