- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 08:19 PM
Hi all,
I have the below client script that we created by our implementer, which sets the next steps that you can select in that field. it also makes the state field read-only when it meets the conditions.
We are in the middle of a rework of the change form, to bring it back closer to how it is OoB. it was highly customised when implemented (before my time).
Since we will be scrapping the next step feature, we need this client script to not be running, however, the problem is that this script is sitting on the task table. Incident still uses this and we will be getting to incident later in the year.
Is there a way to exclude the change_request table inside the client script?
Thanks in advance!
function onLoad() {
// decode the JSON encoded status flow and set the next steps on the form, if needed
if (g_scratchpad.nextSteps != undefined) {
var nextSteps = g_scratchpad.nextSteps.evalJSON();
if (nextSteps.valid) {
// there was a defined status flow for this record, so make state readonly
g_form.setReadOnly('state', true);
// note that restrictNextStepChoices lives in a global UI Script: KS Status Flow Utilities
restrictNextStepChoices(nextSteps);
} else {
// there was no defined status flow for this record, so make state writable
g_form.setReadOnly('state', false);
}
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2018 09:34 PM
Hi,
Use below script:
function onLoad() {
// decode the JSON encoded status flow and set the next steps on the form, if needed
if(g_form.getTableName() != 'change_request')
{
if (g_scratchpad.nextSteps != undefined) {
var nextSteps = g_scratchpad.nextSteps.evalJSON();
if (nextSteps.valid) {
// there was a defined status flow for this record, so make state readonly
g_form.setReadOnly('state', true);
// note that restrictNextStepChoices lives in a global UI Script: KS Status Flow Utilities
restrictNextStepChoices(nextSteps);
} else {
// there was no defined status flow for this record, so make state writable
g_form.setReadOnly('state', false);
}
}
}
}
Thanks,
Ashutosh Munot
Please Hit Correct, Helpful or like,if you are satisfied with this response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2018 07:42 PM
I am wondering if anyone can help with something in my javascript.
I want exclude the sc_task table from this script as well, so i have tried to change:
if(g_form.getTableName() != 'change_request')
to
if(g_form.getTableName() != 'change_request' || g_form.getTableName() !='sc_task')
however, this causes the script to stop ignoring the change request table as well, so I think the if statement is wrong?
Cheers,
Brendan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2018 08:08 PM
if(g_form.getTableName() != 'change_request' || g_form.getTableName() !='sc_task')
to
if(g_form.getTableName() != 'change_request' && g_form.getTableName() !='sc_task')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2018 08:48 PM
Thanks, mate, that worked!