 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 03:58 AM
Hi,
When I create a new incident , A problem record is also being created onafter business rule which is working fine.
Under info message , Problem number is not being displayed .
PS code below
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 04:04 AM - edited 01-15-2025 04:05 AM
Hi @Community Alums ,
You are missing, x.initialize(); and Info message should be after x.insert();
(function executeRule(current,        
 _previous) {
    var x = new GlideRecord('problem');
    x.initialize();
    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);
})(current, previous);
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 04:04 AM - edited 01-15-2025 04:05 AM
Hi @Community Alums ,
You are missing, x.initialize(); and Info message should be after x.insert();
(function executeRule(current,        
 _previous) {
    var x = new GlideRecord('problem');
    x.initialize();
    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);
})(current, previous);
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 04:11 AM
Its working fine .
Thanks.
gs.info wont work with async BR?
When I used same with async , gs.info is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 04:12 AM
hi @Community Alums ,
initialize();- missing in code. Please add it will
(function executeRule(current,        
 _previous) {
    var x = new GlideRecord('problem');
    x.initialize();
    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);
})(current, previous);
 
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 04:18 AM
@Community Alums
how did it work without initialize()?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
