SetAbortAction is not Working on Record Producer in Scoped Application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 11:18 AM
I am trying to use current.setAbortAction(true) in a Record Producer in a scoped application but is throwing the below error.
Tried adding Application Cross Scope Access but not working, any reference to fix is this?
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 01:21 PM
I know this response is somewhat late but I've read loads of posts on this and suddenly came up with a workaround that got me what I wanted - but it's a bit out there. I want to update a sys_user record from a scoped app record producer and not create a new record.
I suddenly got to thinking - I don't want the record producer to create a record but it creates a new record because I can't use setAbortAction on that global table - so, don't use that table. (stick with me)
So I set the table on the record producer to a table in my scoped application (doesn't matter which as we'll never create a record) and then use current.setAbortAction(true); at the end of the script - so it NEVER creates a record.
Then use an if statement to determine if we should create a new record or not - and do it in code... solved!
This snippet creates a new user if the new_record variable is true, but if it's not it doesn't create a record anywhere - it updates the existing user specified in the existing_user variable.
if (producer.new_record=true){
var grUser = new GlideRecord('sys_user');
grUser.initialize();
grUser.name=producer.name;
grUser.update();
}else{
var grUser = new GlideRecord('sys_user');
if (grUser.get(producer.existing_user){
grUser.name=producer.name;
grUser.update();
}
}
current.setAbortAction(true);
Am I going mad or is this an easy way around this issue?