- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2020 11:06 PM
Hello ,
I have created a template and have applied an 'on load' client script, which when a new change form is loaded the template is applied ,
My 2 additional requirements are
1. CRs created from any related list (ex: parent RITM), template is not getting applied
2. Copy change functionality not working
Currently using this Client Script-
function onLoad() {
if(g_form.getValue('type') == 'normal' || g_form.getValue('type') == 'emergency'){
if(g_form.getValue('number') == ''){
var template = g_scratchpad.Mytemplate;
//Apply the selected template
applyTemplate(template);
}}}
Solved! Go to Solution.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 04:39 PM
Please try below.
function onLoad() {
var sysId = getParmVal('sys_id');
var tiny = getParmVal('sysparm_tiny');
gs.addInfoMessage(tiny);
if(g_form.getValue('type') == 'normal' || g_form.getValue('type') == 'emergency'){
if(g_form.isNewRecord() && (sysId == '-1' || tiny != '')){ // check whether the record is new and not creating from copy chang
var template = g_scratchpad.Mytemplate;
//Apply the selected template
applyTemplate(template);
}
}
}
// get and parse URL paramters
function getParmVal(name) {
alert(name);
var url = document.URL.parseQuery();
alert(url);
if (url[name]) {
alert(url[name]);
return decodeURI(url[name]);
} else {
return '';
}
}
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 04:39 PM
Please try below.
function onLoad() {
var sysId = getParmVal('sys_id');
var tiny = getParmVal('sysparm_tiny');
gs.addInfoMessage(tiny);
if(g_form.getValue('type') == 'normal' || g_form.getValue('type') == 'emergency'){
if(g_form.isNewRecord() && (sysId == '-1' || tiny != '')){ // check whether the record is new and not creating from copy chang
var template = g_scratchpad.Mytemplate;
//Apply the selected template
applyTemplate(template);
}
}
}
// get and parse URL paramters
function getParmVal(name) {
alert(name);
var url = document.URL.parseQuery();
alert(url);
if (url[name]) {
alert(url[name]);
return decodeURI(url[name]);
} else {
return '';
}
}
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2020 07:18 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2020 07:21 AM
Happy to be of help 🙂 Have a great weekend & stay safe!
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2020 11:40 PM
Hey,
Would you be able to help me with this question as well ?