- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2023 10:25 AM
Hello - I have a record Producer Script with a function that does a glide record insert gr.insert() on the Group Member table (sys_user_grmember). I am having an issue inserting a record that has one particular group but not a different group.
I tried implementing the function that does the insert in a script include, then having the script include do the gr.insert(). This also behaves the same way.
For the group that is working, the record created on the group member table is showing the User who executed the Record Producer, as the "Created by". I am now trying to have the record created on the Group Member table created under the Admin account.
In other words I want to have the gr.insert() executed as the admin account.
Any suggestions would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 02:04 PM - edited ‎11-16-2023 12:33 PM
We figured out a way to do this by creating an "Event Registration" and a "Script Action". The event is "created" by a call in the Record Producer. When the event is processed the parameters are passed to the Script Action which writes the Record. The record shows as created by "system", which for our case works as we needed.
The Record Producer contains the following Call to the Event
var itilGrp = "50be8f9edb1af114a46c6f8b13961995";
var userID = gs.getUserID();
gs.eventQueue('add_user_to_case_write_access_group', null, userID, caseGrp);
//The arguments are (Event Name, Glide Record, parm1, parm2)
Here is the Event
and here is the Script Action
I hope this saves someone some time!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2023 12:42 PM
In your script, add another line gr.sys_created_by = gs.getUser().getUserByID('admin'); inplace of admin pass your admin account id. If it doesn't work you can also use gr.setWorkflow(false) and give a try it might execute because if there are any business rules this will stop running them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2023 03:01 PM
Harshav - Thanks for the reply but that didn't work. I also have gr.setWorkflow(false); set.
Thanks...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 06:24 AM
Please note - I have also tried "gs.getSession().impersonate("admin sys_id'). Which did not work.
Thanks....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2023 02:04 PM - edited ‎11-16-2023 12:33 PM
We figured out a way to do this by creating an "Event Registration" and a "Script Action". The event is "created" by a call in the Record Producer. When the event is processed the parameters are passed to the Script Action which writes the Record. The record shows as created by "system", which for our case works as we needed.
The Record Producer contains the following Call to the Event
var itilGrp = "50be8f9edb1af114a46c6f8b13961995";
var userID = gs.getUserID();
gs.eventQueue('add_user_to_case_write_access_group', null, userID, caseGrp);
//The arguments are (Event Name, Glide Record, parm1, parm2)
Here is the Event
and here is the Script Action
I hope this saves someone some time!!!