- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 05:11 AM
Hi guys
I have written one client script on onChange of Assignment group ,assigned_ to should be empty and state changes to new.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.setValue('assigned_to','');
//g_form.clearValue('assigned_to');
g_form.setValue('state', 1);
}
But it is not working I don't know why
Please help me with this
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 05:33 AM
Hi Monu gupta
try below code to clear the assigned_ to value i.e make it as empty.it should work, i have tried
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading)
return;
if (newValue != oldValue)
{
g_form.setValue('assigned_to','');
// g_form.clearValue('assigned_to');
g_form.setValue('state', 1);
}
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 05:31 AM
Do you have any other onChange scripts written on Assignment group field on Incident table, that might be conflicting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 05:32 AM
what I found when state is new on changing asignment group it is working properly....but for Inprogress state onchanging assignment group it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 05:38 AM
In the screenshot that you have posted, you are using
g_form.setValue('state', 8);
I thought in your original post, you mentioned you want to reset the State to New, i.e. state value should be 1.
Do you want to update the statement 9 in your code to
g_form.setValue('state', 1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 05:39 AM
One more thing I observed is that assignment group is filled and whenever I erase assignment group this onChange function is not working but when assignment group is empty and I add any assignment group then it is perfectly working....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2017 05:40 AM
That's because of hte first IF statement...
if (isLoading || newValue === '') {
return;
}
It exits the script if it sees that newValue is exactly null.