- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 03:00 AM
Hi Team,
While submitting any role request for particular user I want to check whether that user exits in SalesForce or not and if not then it should abort submit action.
anyone knows how to achieve this using integration?
Thank You,
Best Regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 09:26 PM
for this you need to contact Salesforce team and check the endpoint and what they expect i.e. user id or email so that they can search in their system
Correct
1) configure REST message with correct authentication details etc, endpoint etc
2) pass what salesforce expects i.e. user name and email
3) invoke it via GlideAjax script include use REST Message v2 and onchange will send user id or email and you can use that in your REST Message
4) The endpoint will return success or failure
5) based on that show error message in onChange client script
I hope I have provided enough guidance on the approach.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 03:40 AM
We can use corrent endPoint and verify the response body and corrent code in the BR:
var userEmail = current.requested_for.email;
https://<instance>.salesforce.com/services/data/v52.0/query?q=SELECT+Id,Name+FROM+User+WHERE+Email=\'' + userEmail + '\''
// Call Salesforce API to verify user is whether available or not.
..
..
var responseBody = res.getBody();
var responseJSON = JSON.parse(responseBody);
if (responseJSON.totalSize == 0) {
gs.addErrorMessage("User not exist in Salesforce.");
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 04:33 AM - edited 02-07-2025 04:35 AM
Hi @Community Alums ,
Do I need to create rest message for this with get method?
how can directly access it?
and I may need to use onSubmit client script and script include here cause I am doing form submission on catalog item from portal,
it should reject the form if user doesn't exists in salesforce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2025 04:45 AM
I already informed above.
you need to configure REST Message with the correct endpoint and credentials and then use GlideAjax to invoke the REST Message
Did you check that link?
Can we trigger outbound REST using catalog client script ?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 09:20 PM - edited 02-11-2025 09:21 PM
Hi @Ankur Bawiskar ,
I know get method but then all the records will get fetch from that table I want only particular user?
Do I need to process like this,
1) create rest message with end point account table (Where all users saved) from salesforce
2) create Get method, test and preview script copy
3) paste in script include and call it from client script
My doubt in which step we are fetching/checking particular record,
is it like in script include in URL I should add that particular user and then as you said, if it return something then continue
else empty the field?
@Community Alums
Is it the correct approach?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2025 09:26 PM
for this you need to contact Salesforce team and check the endpoint and what they expect i.e. user id or email so that they can search in their system
Correct
1) configure REST message with correct authentication details etc, endpoint etc
2) pass what salesforce expects i.e. user name and email
3) invoke it via GlideAjax script include use REST Message v2 and onchange will send user id or email and you can use that in your REST Message
4) The endpoint will return success or failure
5) based on that show error message in onChange client script
I hope I have provided enough guidance on the approach.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader