- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 02:34 AM
Hi, i have a variable "license_number" on the catalog item to get the license number from the users.
in case if the user tries to create a second request using the same license number an error message should be shown
there is no license number field on the RITM form, however it is present on the variables section, i have to access variable values from the RITM record.
also, if there is a pre existing RITM record with the same license number then the user should be provided with the RITM number in the error message, on clicking the RITM number the user should be navigated to the RITM record in portal, so i have to provide a link of the record on the error message.
Kindly provide solutions if known, help in this matter would be much appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 03:20 AM - edited 02-29-2024 03:26 AM
Hi @Kumaran ava , You can try the below logic:
1.Configure an onChange catalog client script on the field "License number" and pass the newValue as parameter to the script include
2.In script include query the RITM table, build an encoded query as like in the image:
Modify your catalog item name and variable name and pass the parameter value(i.e your "License number" value)
3.Execute the query and return your Glide object
4.In client script , receive the response and use href and target method within addInfoMessage for RITM record navigation
If the above logic helps with your question, mark my answer as accepted solution and mark as helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 02:49 AM - edited 02-29-2024 02:50 AM
hi @Kumaran ava ,
You can use this script in Before Insert BR
var gr = new GlideRecord('sc_req_item');
gr.addQuery('cat_item', 'ADD SYS ID of CATALOG ITEM');
gr.addActiveQuery();
gr.query();
while (gr.next()) {
if (current.variables.license_number == gr.variables.license_number) {
gs.addErrorMessage('Already available RITM for license ' + gr.number);
current.setAbortAction(true);
}
}
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 04:28 AM
Thanks for the reply, i also have the requirement of providing link to the existing RITM in the client side so this cannot be done in the business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 03:20 AM - edited 02-29-2024 03:26 AM
Hi @Kumaran ava , You can try the below logic:
1.Configure an onChange catalog client script on the field "License number" and pass the newValue as parameter to the script include
2.In script include query the RITM table, build an encoded query as like in the image:
Modify your catalog item name and variable name and pass the parameter value(i.e your "License number" value)
3.Execute the query and return your Glide object
4.In client script , receive the response and use href and target method within addInfoMessage for RITM record navigation
If the above logic helps with your question, mark my answer as accepted solution and mark as helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 04:32 AM - edited 03-01-2024 05:50 AM
Thank you @Vengadesh for the solution.