- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2023 07:47 PM
Hello Community,
I'm looking for a script which will change sub status of incident form to "permanently resolved" if status is resolved.I wrote one script for the same on change of "status" field in incident form.
This below code is actually displaying the back end value first which is 8 and then changes to its display value within a microsecond to display value-"permanently resolved". Please help someone to correct this code and suggest me some solutions.
var status=g_form.getValue('state');
if(status=='6')
g_form.setValue('hold_reason', '8');
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 01:21 AM
Hello @XYZ,
Requirement indicates that you want to set the value for sub-status as “permanently resolved", If the state is “Resolved”.
- Write onChange client script as follows :
- Table : Incident
- Type : OnChange
- Field name : State
- Script :
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue == '6'){// Checking Value of state
g_form.setValue('u_sub_status','5') // Setting Value of Sub status as Permanently Resolved i.e. 5
}
}
Refer below screenshot for result :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2023 08:18 PM
Hi ,
OOB hold_reason field is visible only if the state is resolved. I guess you have modified this behaviour.
If that's the case the script seems fine to me. Could you please check the backend value of permanently resolved choice ?
If my answer has helped with your question, please mark it as helpful and give it a thumbs up!
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2023 10:05 PM
Hello @XYZ,
Requirement indicates that you want to set the value for sub-status as “permanently resolved", If the state is “Resolved”.
- Write onChange client script as follows :
- Table : Incident
- Type : OnChange
- Field name : State
- Script :
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue == '6'){// Checking Value of state
g_form.setValue('u_sub_status','5') // Setting Value of Sub status as Permanently Resolved i.e. 5
}
}
Refer below screenshot for result :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 01:21 AM
Hello @XYZ,
Requirement indicates that you want to set the value for sub-status as “permanently resolved", If the state is “Resolved”.
- Write onChange client script as follows :
- Table : Incident
- Type : OnChange
- Field name : State
- Script :
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue == '6'){// Checking Value of state
g_form.setValue('u_sub_status','5') // Setting Value of Sub status as Permanently Resolved i.e. 5
}
}
Refer below screenshot for result :