- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 04:56 PM
Here is a business rule script on the incident table which creates a service portal announcement. I am having trouble trying to set a value on the "Display Style" field which is a reference field to announcement_style. What do I need to input in order to set my desired value for this type of field?
(function executeRule(current, previous /*null when async*/) {
// Add your code here
createAnnouncement();
function createAnnouncement(){
var gr = new GlideRecord('announcement');
gr.initialize();
gr.name = current.short_description;
gr.title = current.short_description;
gr.type = 'Banner';
gr.display_style =
var success = gr.insert();
if(success){
createPortalEntry(gr.sys_id);
}
}
function createPortalEntry(announceID){
var gr1 = new GlideRecord('m2m_announcement_portal');
gr1.initialize();
gr1.announcement = announceID;
gr1.sp_portal = '123';
gr1.insert();
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 05:12 PM
Hi, taking a quick look at an 'announcement' table record in a PDI, your assessment is correct and the field is a reference to 'announcement_style' table, so I would expect that you would need to populate the sys_id of your preferred 'announcement_style' record (as a string) eg
gr.display_style = '7f8fe758c31023002ff2554d81d3ae99'; // OOB record for 'La Jolla Urgent'
/nav_to.do?uri=announcement_style.do?sys_id=7f8fe758c31023002ff2554d81d3ae99
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2023 05:12 PM
Hi, taking a quick look at an 'announcement' table record in a PDI, your assessment is correct and the field is a reference to 'announcement_style' table, so I would expect that you would need to populate the sys_id of your preferred 'announcement_style' record (as a string) eg
gr.display_style = '7f8fe758c31023002ff2554d81d3ae99'; // OOB record for 'La Jolla Urgent'
/nav_to.do?uri=announcement_style.do?sys_id=7f8fe758c31023002ff2554d81d3ae99