- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2022 05:06 AM
Each of the field values need to have the following points assigned to each value for the calculation
a. Capability
1. Low = 1 point
2. Medium = 2 points
3. High = 3 points
b. Associates
1. < =100 = 1 Point
2. 101 to 1,000 = 2 Points
3. 1,001 to 10,000 = 3 Points
4. 10,001 to 50,000 = 4 Points
calculation should sum up the associated points for each value selected in capability, Associates fields
The "Effort " field needs to be a calculated field based on two other fields which are mentioned, and populate these choice depend on calculation
- a. Not Prioritized - 0 points
- b. Low - less than or equal to 5 points
- c. Medium - greater than 5 points but less than or equal to 9 points
- d. High - 10 or higher points
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2022 08:53 AM
Hi @venkat Y
You can create Choices of field as below:
Then you can write below code in your 2 onChange Client Script for Capabilities and Associates field:
var cap = parseInt(g_form.getValue("u_capability");
var ass = parseInt(g_form.getValue("u_associates");
var eff = cap+ass;
if(eff==0)
{
g_form.setValue('u_effort','Not Prioritized'); // value of choice 'Not Prioritized'
} else if (eff<=5) {
g_form.setValue('u_effort','Low'); // value of choice 'Low'
} else if (eff>5 && eff<=9) {
g_form.setValue('u_effort','Medium'); // value of choice 'Medium'
} else if (eff>10) {
g_form.setValue('u_effort','High'); // value of choice 'High'
}
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2022 07:00 AM
Hi @venkat Y
You can use onchange client script on both capability and assocaites field.
//for setting the value in Effort field use below logic:
if(parseInt(g_form.getValue("capability") + parseInt(g_form.getValue("associates") <=5)
{
g_form.setValue("effort",Low);
}
....
..
//follow the same logic for rest of the options
Hope it helps:)
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2022 07:33 AM - edited 11-12-2022 07:36 AM
@Murthy Ch Thanks for the solution, but How to assign points to those choices to read and is it possible in one script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2022 07:55 AM
Hi @venkat Y
It is possible in one script.
For assigning the points to choices you can do like below if you are using choice type field.
So that it will give choice values when we are using g_form.getValue("fieldname") in client script.
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2022 08:03 AM - edited 11-12-2022 08:37 AM
@Murthy Ch these choices are reference choices..,and how choice values act like points..