Get to know about Portal ID or URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2023 07:08 AM - edited 06-22-2023 12:16 PM
Is there any method by which can identify from which Service Portal [IT or HR] , record producer or catalog item form is submitted? @Ankur Bawiskar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 03:39 AM
you can access the hidden variable value inside record producer script and do the redirection
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2023 04:28 AM
Maybe not the prettiest solution, but should work:
Create a (hidden) variable 'portal_id'.
Create a catalog client script: onLoad:
function onLoad() {
g_form.setValue('portal_id', getPortalID());
function getPortalID() {
var regexS = "[/][A-z]*[?]";
var regex = new RegExp(regexS);
var results = regex.exec(top.location);
if (results == null) {
return "";
} else {
var answer = results.toString();
return answer.substring(1,answer.length-1);
}
}
}
You could then do the redirection based on the variable.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.