Checking record is New
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 11:17 PM
Got a new requirement. To check whether record is New, if New then push to another form. Here what i am trying ... can anyone help me here.
function executeRule(current, previous /*null when async*/)
{
if (current.isNewRecord()){
var inc = new GlideRecord('u_incident_temp');
gs.info('This is a new incident: ' + current.number);
inc.initialize();
inc.u_inc_number = current.number;
inc.u_short_description = current.short_description;
inc.insert();
}
})(current, previous);
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2024 08:01 AM
Hello @Harshal_Patil ,
Can you give a try with the below script
function executeRule(current, previous /*null when async*/) {
if (current.isNewRecord()) {
var inc = new GlideRecord('u_incident_temp');
gs.info('This is a new incident: ' + current.number);
inc.initialize();
inc.u_inc_number = current.number;
inc.u_short_description = current.short_description;
var newIncidentTemp = inc.insert();
if (newIncidentTemp) {
gs.info('New incident record inserted into u_incident_temp with Sys ID: ' + newIncidentTemp);
} else {
gs.error('Failed to insert new incident record into u_incident_temp');
}
}
}
Please mark this as correct and helpful, if it works for you.