- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 03:52 AM - edited 05-09-2023 09:40 AM
Hi all,
Wondering if you can help me with this.
I created a demand risk assessment section/tab and added some fields. Depending of what I chose (Yes/no OR High/medium/low), I want to make a sum of the values I have given to the choices (I have explained the points into the image below), and by clicking the UI action "Demand risk calculation" the sum of all the points should automatically populate in the read only "Risk score" field at bottom, and also populate High/medium/high in the read only "Risk level" field (if sum is 2 = Low, if sum is 3 to 9 = Medium and if sum is 10+ = High).
Many Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 06:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 04:16 AM
As mentioned by you as you already mentioned the backend values as integers
You can simply sum up all the values as mentioned below(Assuming your UI action of client side):
var sum = parseInt(g_form.getValue("your_field_name1")) + parseInt(g_form.getValue("your_field_name2")) + parseInt(g_form.getValue("your_field_name3"));
if(sum>10){
g_form.setValue("risk_level","high");
}else if(sum >2 && sum<10){
g_form.setValue("risk_level","medium");
}else{
g_form.setValue("risk_level","low");
}
g_form.setValue("risk_score",sum);
g_form.save();
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 04:26 AM
Hi @Prince Arora , Should this script be a client script or a business rule??
Also I only created the UI action, but haven't scripted anything in it as I needed help with that one too, can you please also help with UI action script ?? Thank you 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 04:31 AM
This is the script you have to mention in the client side UI action, just mention the script in your UI action and update the backend names according to you fields name and try it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2023 06:27 AM
Hi @Prince Arora , I have done as you suggested and correctly updated backend names of fields and choice values, but when I click the UI action something odd happens an all the tabs disappear and system is unable to load the page, so not working.