- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 01:37 AM
I have the below script where i am trying to update the state of record from open > duplicate request before insert in BR. I have below script but its not working.
1) should I make it After insert ?
2) Is the script wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 03:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 01:44 AM
Hi,
Are you just wanting to check if a record exists, and if so, modify the current state to '8'?
(function executeRule(current, previous /*null when async*/) {
var relatedTasksGR = new GlideRecord('x_inffr_task');
relatedTasksGR.addQuery('case' , current.getValue('case'));
relatedTasksGR.addQuery('type_of_service' , current.getValue('type_of_service'));
relatedTasksGR.addQuery('amount' , current.getValue('amount'));
relatedTasksGR.addQuery('sys_created_on' , '>', gs.daysAgo(30));
relatedTasksGR.setLimit(1);
relatedTasksGR.query();
if(relatedTasksGR.hasNext())
current.setValue('state' , '8')
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 02:01 AM
Hi, I am checking for some condition, that would consider the newly opened one as duplicate, So basically the first record will be excluded, rest all newly created record that matches with case, amount and type of existing will b considered as duplicated and all the rest(could be more than 1) will be set to state duplicate on insert

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 02:15 AM
So, to understand this correctly this BR:
- Runs on insert of the record (lets call it a Case)
- If a similar case is identified where it has the same amount, and type of service, you want to mark the record being inserted as duplicate (which I assume is 8 in your state model)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 03:48 AM
- Runs on insert of the record (lets call it a Case) >> > yes
- If a similar case is identified where it has the same amount, and type of service, you want to mark the record being inserted as duplicate (which I assume is 8 in your state model)? >> could be more than1puplicate, all should be marked to stat 8