Need help to pass parameters to eventqueue from Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 06:44 AM - edited 05-13-2024 06:49 AM
Hi All,
I am trying to insert relationship in 3 different tables as shown below from a Custom Portal widget:///
if(graddextuser2.active == true)
{
var grextuserid = graddextuser2.sys_id.toString();
var table_1 = [
{'tblname':'cmdb_rel_person', 'col1':'user', 'col2':'ci','dev_key':'newauthcaller','prod_key':'newauthcaller1'},
{'tblname':'u_m2m_sys_user_cmdb_ci_service', 'col1':'sys_user', 'col2':'u_cmdb_ci_service','dev_key':'newauthappr','prod_key':'newauthappr1'},
{'tblname':'u_m2m_from_cmdb_ci_service_watchlist', 'col1':'u_user','col2':'u_cmdb_ci_service','dev_key':'newwatchlist','prod_key':'newwatchlist1'}
]
table_1.forEach(function(element) {
var k =0;
var test = usedfor.split(",");
test.forEach(function(value){
var grCheckExistence3 = new GlideRecord(element.tblname);
grCheckExistence3.addQuery(element.col1,grextuserid);
grCheckExistence3.addQuery(element.col2, res[k]); //res[k] contains the CI sys_id
grCheckExistence3.query();
if (!grCheckExistence3.next()) {
if(input.exUser[element.dev_key] == true && value == "Development")
{
var graddRole = new GlideRecord(element.tblname);
graddRole.initialize();
graddRole[element.col1] = grextuserid;
graddRole[element.col2] = res[k];
graddRole.insert();
flagmsg = 'true';
}
if(input.exUser[element.prod_key] == true && value == "Production")
{
//gs.addInfoMessage("User has been added successfully into Prod Key");
var graddRole1 = new GlideRecord(element.tblname);
graddRole1.initialize();
graddRole1[element.col1] = grextuserid;
graddRole1[element.col2] = res[k];
graddRole1.insert();
flagmsg = 'true';
}
}
else
{
flagmsg = 'newtrue';
}
k++;
});
});
}
I need to pass table name and new user id just got created/inserted in to an event from Portal itself.
If possible, can someone help on how to achieve the same?
Like can I add gs.eventQueue(tablename, new user sysid)?
@James Chun @Dr Atul G- LNG @Abhishek_Thakur @Sandeep Rajput
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2024 10:04 AM
@Ahmmed Ali @CezaryBasta @Mark Manders Can you please help with the above requirement.
TIA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 12:51 AM
If it doesn't work from the server script on the widget, you could try running it from the script include. What did you try?
See more of my content here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 05:31 AM
I did not try yet. How do I add or pass parameters? That is where I need help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 05:37 AM
Should it be like this?
gs.eventQueue('notify.authApprover.caller',graddRole,devroleid);