
- 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
08-04-2020 03:23 PM
Also this is running on Workspace. It works find on the Platform UI which is really frustrating me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 03:36 PM
Oh Workspace is a whole other beast. I'm unsure if GlideModal is supported there, unfortunately there's a lack of documentation at this time.
I did come across GlideAgentWorkspace:
https://developer.servicenow.com/dev.do#!/reference/api/orlando/client/GlideAgentWorkspaceAPI maybe it can accomplish what you need, but I haven't used it. Hopefully someone knows, as I'd like to find out myself.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 03:41 PM
Well when I use it I do not get an error about it not existing. Also the g_modal.showFrame I got from another UI action that does work on Workspace but it does not seam to work either.
The workspace API opens things in a tab and they/we/me want it in a dialog window so that we do not have other issues.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 01:01 PM
NOTE: An error was found (thanks Marc Mouries and Brian Alson) in that 'maint' role is needed to create a new component via modal.
It appears you have to have 'maint' role to create a new one :). This has been reported internally.
I'd suggest the following:
1. Elevating to 'security_admin'
2. Navigate to the ACL for that table (please don't click this link, it won't work. Edit then go): https://YOURINSTANCE.service-now.com/nav_to.do?uri=%2Fsys_security_acl.do%3Fsys_id%3De5269a850f13330...
3. Update then try.
Best!
Jeremy Duncan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2020 01:41 PM
And to add something that