
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 12:29 PM
Ok, I must have a case of the stupids and am missing something obvious. I have a custom table and on Workspace I need to create a button to open a dialog box and simply show the new record form for the custom table. I have tried using GlideDialogWindow, GlideModalForm and g_modal.showFrame. Each time in the browser console I see "Action succeeded" and there is no error, but the dialog does not open. I have to be missing something.
Code I have tried.
//First try
var dialog = new GlideDialogWindow("x_mahe2_cgna_member");
dialog.setTitle("New Member");
dialog.setPreference("sysparm_sys_id", "-1");
dialog.render();
//Second Try
var dialog = new GlideModalForm("New Member", "x_mahe2_cgna_member", populateMember);
dialog.setTitle("New Member");
dialog.setSysID(-1);
dialog.addParm("sysparm_view", "default");
dialog.addParm("sysparm_form_only", "true");
dialog.render();
//Third Try
var url = "/x_mahe2_cgna_member.do?sysparm_view=workspace&sys_id=-1&sysparm_form_only=true&sysparm_workspace=true";
g_modal.showFrame({
title: "New Member",
url: url,
size: 'lg'
});
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 07:18 AM
So the only way I found to do this was using g_modal.showFrame but it has its own issues. I have not had a chance to test it in Paris because we have not upgraded yet. My code is below to show a specific form and it has to be a workspace script. Right now the "lg" size is not very large in my opinion and you can only see about two rows of fields which sucks but since there was no documentation that I could find at the time of writing.
function onClick(g_form) {
var url = "/TABLE_NAME.do?sysparm_view=workspace&sys_id=-1&sysparm_form_only=true&sysparm_titleless=true&sysparm_link_less=true&sysparm_workspace=true";
var x = g_modal.showFrame({
title: "New Member",
url: url,
size: 'lg'
});
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 07:18 AM
So the only way I found to do this was using g_modal.showFrame but it has its own issues. I have not had a chance to test it in Paris because we have not upgraded yet. My code is below to show a specific form and it has to be a workspace script. Right now the "lg" size is not very large in my opinion and you can only see about two rows of fields which sucks but since there was no documentation that I could find at the time of writing.
function onClick(g_form) {
var url = "/TABLE_NAME.do?sysparm_view=workspace&sys_id=-1&sysparm_form_only=true&sysparm_titleless=true&sysparm_link_less=true&sysparm_workspace=true";
var x = g_modal.showFrame({
title: "New Member",
url: url,
size: 'lg'
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2021 02:04 AM
Hello,
Just want to add that adding "height" to modal object shows a few more lines in height, but far from a normal form size. Below will show about 6 or 8 fields high (which for us means agents need to scroll to find Submit).
var x = g_modal.showFrame({
title: "New Member",
url: url,
size: "lg",
height: "34rem" // height: 500 also works
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2023 12:12 PM
Thanks for the info. This helped me. I am using size: 'fw'; instead of xl which opens the modal in full windows (?). I think height is another way to play with the size of the modal.
- title: the title of the modal dialog window
- size: sm, lg, xl, and fw seems to work, but sm, lg, xl doesn't seems to be a lot of differences
- height: a height (in pixels) for the modal (?)
Do you know if params (parameters to pass in to the inner component) works with g_modal.showFrame?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2021 03:05 PM
So for anyone who has the issue that g_modal doesn't open, you have to set the client flag to true on the ui action for it to work. That took me a while to figure that out ^^

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2022 08:20 AM
@martin. You saved me with this comment. You should post a comment on my thread to get credit for your effort. https://community.servicenow.com/community?id=community_question&sys_id=57908ec0db650110a538826305961952