- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 10:28 PM
OOTB Create Normal Change copies field from problem to change for string type fields but does not copy custom list type field values from problem to change custom list type fields.
Script:
(function(current, previous, gs, action) {
// var affectedountries = current.getValue.u_affected_countries;
var changeRequest = ChangeRequest.newNormal();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
changeRequest.u_affected_countries = current.u_affected_countries; // not copying
changeRequest.u_affected_countries = current.u_affected_countries.toString(); // not copying
changeRequest.u_affected_countries = current.getDisplayValue('u_affected_countries'); // not copying
changeRequest.setValue("urgency", current.urgency);
changeRequest.setValue("impact", current.impact);
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("Change {0} created", changeRequest.getValue("number")));
action.setRedirectURL(changeRequest.getGlideRecord());
action.setReturnURL(current);
})(current, previous, gs, action);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 10:34 PM
Hi @raju51 ,
Change those fields as:
changeRequest.setValue("u_affected_countries", current.getValue("u_affected_countries"));
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2023 10:34 PM
Hi @raju51 ,
Change those fields as:
changeRequest.setValue("u_affected_countries", current.getValue("u_affected_countries"));
Aman Kumar