- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 10:40 AM
Hi,
I want to create a business rule for when a incident record is created ,a problem record should also get created.
Its working fine ,but when I am trying to populate a message a new problem ticket is created,it is not showing problem record number.
(function executeRule(current,
_previous) {
var x = new GlideRecord('problem');
x.category = current.category;
x.short_description = current.short_description;
x.cmdb_ci = current.cmdb_ci;
gs.addInfoMessage("A problem ticket is created "+x.number);
x.insert();
})(current, previous)
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 11:02 AM - edited ‎02-12-2024 11:05 AM
Hi @Shubham_verma ,
Modify your script accordingly, Problem number will be assigned after the record is created. You have to fetch the number later on.
var x = new GlideRecord('problem');
x.category = current.category;
x.short_description = current.short_description;
x.cmdb_ci = current.cmdb_ci;
x.insert();
gs.addInfoMessage("A problem ticket is created "+x.number.toString());
Hopefully this will resolve you issue.
Regards,
Ashir Waheed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 11:06 AM
Hi Shubham,
gs.addInfoMessage("A problem ticket is created "+x.number); line should be after insert function. after inserting only problem number will appear in message.
Please mark it as helpful (or) correct if it helps.
Thanks & Regards,
Sumanth Meda

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 11:02 AM - edited ‎02-12-2024 11:05 AM
Hi @Shubham_verma ,
Modify your script accordingly, Problem number will be assigned after the record is created. You have to fetch the number later on.
var x = new GlideRecord('problem');
x.category = current.category;
x.short_description = current.short_description;
x.cmdb_ci = current.cmdb_ci;
x.insert();
gs.addInfoMessage("A problem ticket is created "+x.number.toString());
Hopefully this will resolve you issue.
Regards,
Ashir Waheed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 11:09 AM
it worked.Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 11:06 AM
Hi Shubham,
gs.addInfoMessage("A problem ticket is created "+x.number); line should be after insert function. after inserting only problem number will appear in message.
Please mark it as helpful (or) correct if it helps.
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2024 11:10 AM
it worked.Thanks.