- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2024 02:13 PM
How can we solve this.. I am getting so much confusion on this.
When a record is created from another record, update the description of the new record with existing description + this record has been created with the Incident number.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 06:57 PM
update as this
(function executeRule(current, previous /*null when async*/) {
var newRecord = new GlideRecord('incident');
newRecord.initialize();
newRecord.description = current.description;
newRecord.short_description = 'this record has been created with the ' + current.number;
newRecord.insert();
}
)(current, previous);
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 05:20 AM
what's your confusion?
what script did you start with and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 05:27 AM
When to run : After, Insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 06:57 PM
update as this
(function executeRule(current, previous /*null when async*/) {
var newRecord = new GlideRecord('incident');
newRecord.initialize();
newRecord.description = current.description;
newRecord.short_description = 'this record has been created with the ' + current.number;
newRecord.insert();
}
)(current, previous);
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2024 10:01 PM
Create a New Business Rule:
Name: "Update Description with Incident Number"
Table: Choose the relevant table where the record is being created
When: After Insert
Condition: Check if the record was created from an Incident (you can check if there’s a Parent or Incident field on the table).
(function executeRule(current, previous /*null when async*/) {
if (current.incident) {
var incidentNumber = current.incident.number;
var descriptionText = current.description || '';
current.description = descriptionText + "\nThis record has been created with the Incident number: " + incidentNumber;
current.update();
}
})(current, previous);