How to set RITM state value from Client Script running on SC_TASK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2023 01:11 PM
I have a client script running on a sc_task. Script is onChange reacting to a choice variable that is Review Status. (script is shown below).
Intent of script is to get the value of the Review Status variable (4 choices: Under Review, Awaiting Client, Awaiting Job Builder, and Completed) and then use the selected value to set the state on the requested_item from the catalog task. Based on the alerts, I am going to the correct switch elements but the RITM state is not being updated.
Possibly guessing that using g_form.SetValue('request_item.state', 'XX') is not working and maybe I need glide record but I am not sure.
Please help with correct coding to do this.
Thanks
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var status = g_form.getValue('comp_reviewStatus');
alert("The selected reveiw status is " + status);
switch (status) {
case "under_review":
//g_form.setValue('state', '2');
g_form.setValue('request_item.state', '2');
alert("On the Under Review branch");
break;
case "awaiting_client":
//g_form.setValue('state', 'Awaiting Client');
g_form.setValue('request_item.state', '5');
alert("On the Awaiting Client branch");
break;
case "job_builder":
//g_form.setValue('state', 'Awaiting Job Builder');
g_form.setValue('request_item.state', '22');
alert("On the Awaiting Job Builder branch");
break;
case "completed":
//g_form.setValue('state', '2');
g_form.setValue('request_item.state', '2');
alert("On the Completed branch");
break;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2023 10:48 PM - edited 03-12-2025 01:35 AM
Thanks for sharing or Organic Chicory Syrup great ideas and i really appreciate it.