- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2020 01:13 AM
Hello Developers!
My requirement is when assignment group is not empty then state should be change to in progress.
I wrote a client script code it is working fine. Here is the code
function onLoad() {
var assign = g_form.getValue('assignment_group');
var assignedto = g_form.getValue('assigned_to');
var state = g_form.getValue('state');
if(assign != '' || assignedto != '')
{
g_form.setValue('state','2');
}
But, the issue is when i change state to another state like on-hold, it is not updating to on-hold, it is still showing inprogress only.
So, please help me out on this issue.
Thank you!
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2020 01:27 AM
Hi Mallika,
Create a business rule for this like below to do this. That way no scripting is needed:
This will set the State to 'In progress' when the Assigned to or Assignment group is not empty and the State is in New. For all other states ('closed'/'cancelled' etc) I assume you would not want to change the state. But of course you can change the conditions to your liking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2020 12:13 AM
If you want that happening on the screen and not just after save, can you create a new question for that? Next to this business rule you need some Client scripts. I know there is a lot of people who can help with that.
Kind regards,
Willem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2020 12:18 AM
Hi Malika,
If you want it happening on the screen when you change Assignment group or Assigned to, you need 2 client scripts:
The script in them is this:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.setValue('state', 2);//in progress
}