Scripted REST API to fetch all the records with same sys_id and make there isActive flag false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2022 12:37 AM
I have created a custom attachment table. For a particular record, I am inserting 6 images. I want a scripted rest API to make isActive flag false of all the 6 images of respective record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2022 01:11 AM
Hi
unfortunately it is not really clear what your issue is.
Please provide more details and especially screenshots, so we can better understand your situation and help you accordingly.
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2022 01:20 AM
Hi
I have created a table A in which I am storing a record, for that record I am inserting 6 images in a custom attachment table which has a field record number represents for which record number we have stored the images. The attachment table has one field called isActive whose value is true for all the records while inserting. Now I want to make the isActive value as false for attachments with the respective sys id. It can be any sys_id present there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2022 01:21 AM
In addition I have given that record number as a reference field in custom attachment table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2022 01:15 AM
Hi Pooja,
Need information on column names of custom attachment table. Is there a column for each image? How is record specified? Is there a sys_id field to determine a record.
Sample code:
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var tableName = '<custom table name';
var queryParams = request.queryParams;
var sysId = queryParams.sysid.toString();
var gr = new GlideRecord(tableName);
if (gr.get(sysId)) {
gr.isActive = false;
gr.update();
}
})(request, response);