Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 06:13 AM
Hi All,
I have a requirement to create a Flow Designer which will check if the RITM has already been created for the Requested For user. If 'yes' then it should cancel the Record creation else it should do the same.
How can we achieve this? Can someone plz let me know the logic?
Thanks,
Rooma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 08:51 AM
Yes, that lookup action we are doing on Step 1 has a "Status". If it finds a duplicate, it will be a "Success", if not it will be a "Fail".
So we can do our "IF" statement based on that. Please see the screenshot attached.
If this was helpful, please mark it as such. If it solved your problem, please mark it as the solution!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 09:07 AM
@bradleydebono , How can we cancel the RITM that has not been inserted in the Database? Before the insert of record , it is still checking for record in the RITM table? Is there any action in FD to abort the action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 09:09 AM
That would be option 2 I listed on my original reply to your query. You can't do it from a Flow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 06:26 AM - edited 02-12-2024 06:28 AM
Hi @Rooma1 ,
I think using flow designer we cannot cancel the record creation.You may need to create before insert BR in requested item table which should trigger only for your catalog item
var checkDup = new GlideRecord('sc_req_item');
checkDup.addQuery('cat_item',current.cat_item);
checkDup.addQuery('requested_for', current.requested_for);
checkDup.query();
if(checkDup.next()){
gs.addErrorMessage('Already requested item created for the user');
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2024 06:27 AM
You can follow below approach:
Query Records: Add a "Query Records" action to check if an RITM (Requested Item) already exists for the specified "Requested For" user. Configure the query to search for RITM records where the "Requested For" field matches the user for whom the request is being made.
Check Condition: Add a condition after the "Query Records" action to check if any records were found. If records are found, it means that an RITM already exists for the user.
If records are found (Yes path): Add actions to cancel the record creation or take any other necessary actions. You can use the "Cancel Record" action or set a variable to indicate that the record creation should be canceled.
If no records are found (No path): Continue with the record creation process.
Please mark this helpful, if it helps you in anyway.