- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 07:09 PM
Hi.
I want to empty the values of the "client_id" and "client_secret" fields in the oauth_entry table after saving.
I want to execute the process only for a specific record, so I wrote the process in the Background Script and executed it, but it didn't work.
I will write the script below, but if there is something missing, could you please tell me?
BackgroundScript:
var test = new GlideRecord("oauth_entity");
test.addQuery("sys_id", "f7529bae87c0511006738517cebb3514");
test.query();
if(test.next()){
test.setValue("client_id", "");
test.setValue("client_secret", "");
}
Thank you!
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 07:28 PM
Try the below script, Your not updating the record in the script
var test = new GlideRecord("oauth_entity");
test.addQuery("sys_id", "f7529bae87c0511006738517cebb3514");
test.query();
if(test.next()){
test.setValue("client_id", "");
test.setValue("client_secret", "");
test.setWorkflow(false); //Do not run business rules
test.autoSysFields(false); //Do not update system field
test.update();
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 07:28 PM
Try the below script, Your not updating the record in the script
var test = new GlideRecord("oauth_entity");
test.addQuery("sys_id", "f7529bae87c0511006738517cebb3514");
test.query();
if(test.next()){
test.setValue("client_id", "");
test.setValue("client_secret", "");
test.setWorkflow(false); //Do not run business rules
test.autoSysFields(false); //Do not update system field
test.update();
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 09:12 PM