
- 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 12:33 PM
Hi,
GlideDialog window should be either a UI page or a view name defined on the table. It will not take table name as a parameter. Kindly change and check.
Mark the comment as a correct answer and helpful if this answered your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 01:03 PM
It works in the platform UI using table name. But you did prompt me to test it in the platform UI and in the platform ui I got several scoping errors.
Scopping errors
com.glide.script.fencing.MethodNotAllowedException: Function getNavMessage is not allowed in scope x_mahe2_cgna
So it looks like I cannot use GlideDialogWindow or I have to find were to fix the cross scope issue.
Just an FYI both of these pices of code get the same result.
function clientClick_new_member(){
var dialog = new GlideDialogWindow("x_mahe2_cgna_member");
dialog.setTitle("New Member");
dialog.setPreference("sys_id", "-1");
dialog.render();
}
function clientClick_new_member(){
var dialog = new GlideDialogWindow("workspace");
dialog.setTitle("New Member");
dialog.setPreference("table", "x_mahe2_cgna_member");
dialog.setPreference("sys_id", "-1");
dialog.render();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 03:09 PM
In checking your code for the GlideModalForm portion, is 'populateMember' your callback? I didn't see it in the snippet.
Here's an example snippet I found here, perhaps your callback is the issue: https://pathwayscg.com/quick-dialog-boxes-with-showquickform-and-glidemodalform/
//Render glide modal passing in form values for new update set.
var d = new GlideModalForm('New Customer Update Set', 'u_customer_update_sets', createUpdateSet);
d.addParm('sysparm_query', 'u_release=' + release + '^u_company=' + company);
d.setSysID(-1);
d.render();
} function createUpdateSet(action, sys_id, table, displayValue) {
//set value on form to new sysid of update set
g_form.setValue('u_customer_update_set', sys_id);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2020 03:17 PM
It is the callback but I did not post the code for it. Probably should have. The full code for that is
function onClick(g_form) {
var dialog = new GlideModalForm("New Member", "x_mahe2_cgna_member", populateMember);
dialog.setTitle("New Member");
dialog.setSysID(-1);
dialog.addParm("sysparm_view", "workspace");
dialog.addParm("sysparm_form_only", "true");
dialog.render();
}
function populateMember(action, sys_id, table, displayValue) {
console.log(action);
}
In your example is "u_customer_update_sets" a table? I'm assuming it is but you know what they say about assuming.