How to pass current record sys id from ui action to ui page in workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 03:47 AM - edited 01-04-2024 03:48 AM
Hi Community,
Having an UI Action in workspace & on click of that UI Action ,an UI Page should gets open. There I need to validate the sys id of the current record but I'm struggling with it.
UI Action:-
I'm passing sys id of record in url & trying to retrieve in UI Page html.
UI Page:-
Can someone please help in this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 06:17 AM
check the URL you are forming correct? Can you check this url manually providing sys id in browser? Does it work?
Also, I would suggest define a variable url outside show frame. Something like below
var url = 'define your url here' ( test it manually and make sure it is correct)
g_modal.showFrame({
title : 'yout title here',
url :url,
size: 'fw'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 06:30 AM
${sysparm_sysid} will work only when UI page is called using GlideDialogWindow when you set the preference
In your case you can get the URL value and parse and get the sysId
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 08:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2026 01:15 AM
Hi @Ankita Kolhe
We can pass the sys_id of current record in the URL of UI Page from UI Action Workspace Client Script:
var url = '/' + uiPage + '.do?sysparm_meeting_id=' + meetingId + '&sysparm_workspace=true';
g_modal.showFrame({
url: url,
title: 'Add Visitors',
size: 'xl'
});
In UI Page client script, a function to fetch the sys_id from URL is configured.
function getParameterByName(name) {
var url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
var results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function submitVisitors() {
var meetingId = getParameterByName('sysparm_meeting_id');
}