
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-05-2018 10:12 AM
Hello Experts,
We have a requirement to create Standard change from problem by context menu. OOB provides two links to create normal and emergency, but not standard change. We have UI action on incident table to create standard change and we tried to copy it on problem form as well.
It is creating standard change, but it is not linking problem and standard change (Showing related problem in Problems related list on change form) where as it works fine when we create standard change from an incident.
I found that there is a script include "LinkRecordProducerToIncident" which is actually linking incident and standard change.
Is there any way which links problem and standard change ?
Also, by looking at UI action 'Create Standard Change' on incident table, script is written as below.
var url = "com.glideapp.servicecatalog_category_view.do?v=1&sysparm_parent=b0fdfb01932002009ca87a75e57ffbe9&sysparm_cartless=true&sysparm_processing_hint=updateIncFieldWithStdChange:";
url += current.sys_id;
action.setRedirectURL(url);
In the above, "updateIncFieldWithStdChange" is what actually linking standard change. I did not get how this function/property is called. Any suggestions are much appreciated.
Many thanks, Sunil Safare
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-10-2018 02:36 AM
Hello Sunil,
We had a similar requirement and below steps may help in your case..!!! Mark correct and helpful in case helped
In incident table we do have a UI action --> Create standard change UI action
Replicate the same and create in whichever table you require with
------UI Action ------
var url = "com.glideapp.servicecatalog_category_view.do?v=1&sysparm_parent=b0fdfb01932002009ca87a75e57ffbe9&sysparm_cartless=true&sysparm_processing_hint=updateIncFieldWithStdChange:";
url += current.sys_id;
action.setRedirectURL(url);
-------------------------------------------------------------updateIncFieldWithStdChange--------------------------
Left Nav --> Processor
updateIncFieldWithStdChange will call processor [Link Standard Change with Incident] where if you want, you can change logic {i had a requriement to implement the UI action in sc_task table so i wrote the necessary script in else part highlighted without disturbing the existing logic}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-10-2018 02:03 AM
If there's an OOB UI Action 'Create Normal Change' in problem table as well, why not use that as a base?
It works in a different way than the one in incident table, but I think it would work in your case.
Simply change var changeRequest = ChangeRequest.newNormal(); to var changeRequest = ChangeRequest.newStandard();
(function(current, previous, gs, action) {
var changeRequest = ChangeRequest.newStandard();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
if (changeRequest.hasValidChoice('priority', current.priority))
changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.insert();
current.rfc = changeRequest.getGlideRecord().getUniqueValue();
current.update();
gs.addInfoMessage(gs.getMessage("Standard Change {0} created", changeRequest.getValue("number")));
action.setRedirectURL(changeRequest.getGlideRecord());
action.setReturnURL(current);
})(current, previous, gs, action);
Of course you have to figure out how'd you proceed from there, but that's a start for you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-10-2018 02:36 AM
Hello Sunil,
We had a similar requirement and below steps may help in your case..!!! Mark correct and helpful in case helped
In incident table we do have a UI action --> Create standard change UI action
Replicate the same and create in whichever table you require with
------UI Action ------
var url = "com.glideapp.servicecatalog_category_view.do?v=1&sysparm_parent=b0fdfb01932002009ca87a75e57ffbe9&sysparm_cartless=true&sysparm_processing_hint=updateIncFieldWithStdChange:";
url += current.sys_id;
action.setRedirectURL(url);
-------------------------------------------------------------updateIncFieldWithStdChange--------------------------
Left Nav --> Processor
updateIncFieldWithStdChange will call processor [Link Standard Change with Incident] where if you want, you can change logic {i had a requriement to implement the UI action in sc_task table so i wrote the necessary script in else part highlighted without disturbing the existing logic}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-04-2019 02:37 AM
Hello Challan,
I have the similar requirement but I need populate Parent on change request form when creating a Standard change from RITM.
I used the same UI Action code which you mentioned above and added the Processor script as below. But found not working any Ideas.Could you please assist me as I am new to Processor script.
else{
// Update incident's change record field, if not already populated
gs.log("else condition");
var ritm = new GlideRecord("sc_req_item");
if (ritm.get(srcSysID)) {
var stdChgValue = '';
var changeGr = new GlideRecord("change_request");
if (changeGr.get(newSysID)) {
stdChgValue = changeGr.getDisplayValue();
changeGr.parent=srcSysID;
changeGr.update();
}
var incUrl1 = "<a href='" + ritm.getLink(true) + "'>" +ritm.getDisplayValue() + "</a>";
gs.addInfoMessage(gs.getMessage("Standard Change {0} created from Incident {1}", [stdChgValue, incUrl1]));
} else {
gs.addInfoMessage(gs.getMessage("Standard Change could not be created from incident {0}", ritm.getDisplayValue()));
}
}
Thank you,
Ajay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-14-2019 05:21 AM
Hello Sunil,
was your issue solved? I have same requirement.