g_model workspace popup doing same function if i click on cancel or close the popup using cross???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 11:59 PM
Actually for my requirement i have to show popup having "create new' and 'add from existing' button but as i am unable to find it ...i have used g_model.confirm() and i have written create new functionality on click on ok and add from existing functionality on click of cancel.
but even if i close popup using cross cancel functionality is working . how to avoid it? or else is there any other possibility except g_model to show popup in workspace.
let me have your ideas here.
Thank you
@Prince Arora @Ankur Bawiskar @Rahul Kumar17 @K Akhila @AndersBGS @Anurag Tripathi @AnveshKumar M @Bharath Kumar A @Sandeep Rajput

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 02:55 AM
Same thing will happen if you click on close button.
try this -
function onSubmit() {
var isnew = g_form.isNewRecord();
if (isnew) {
if(!g_form.getValue('constituent_pofile')){
if (g_scratchpad.isFormValid)
return true;
var first_name = g_form.getValue('x_guid2_child_welf_first_name');
var last_name = g_form.getValue('x_guid2_child_welf_last_name');
var dob = g_form.getValue('date_of_birth');
//var result = '';
var script_include = new GlideAjax('ChildInformationUtils');
script_include.addParam('sysparm_name', 'getrecord');
script_include.addParam('sysparm_first_name', first_name);
script_include.addParam('sysparm_last_name', last_name);
script_include.addParam('sysparm_dob', dob);
script_include.getXMLAnswer(setAnswer);
return false;
function setAnswer(answer) {
//alert(answer);
var checkExist = setInterval(function() {
if (top.document.getElementsByClassName('close pull-right')[0]) {
clearInterval(checkExist);
var x = top.document.getElementsByClassName('close pull-right')[0];
x.style.display = "none";
}
}, 100); // check every 100ms
if (answer != null) {
var url = '' + top.location.href;
if ((url.indexOf('agent') > -1)) {
var msg = "User is already exists in the system, Please select required action form below";
g_modal.confirm(getMessage("Confirm"), msg, function(confirmed)
{
if (confirmed == true) {
g_form.setValue('constituent_pofile', answer);
var actionName1 = g_form.getActionName();
g_scratchpad.isFormValid = true;
g_form.submit(actionName1);
return false;
}
else if(confirmed == false) {
var actionName2 = g_form.getActionName();
g_scratchpad.isFormValid = true;
g_form.submit(actionName2);
return false;
}
});
} else {
// alert('its native ui right?');
// alert(answer);
var gm = new GlideModal('x_guid2_child_welf_child_window_dialog_box', true, 600);
gm.setTitle('Confirm');
gm.setPreference("sysparm_fname", first_name);
gm.setPreference("sysparm_lname", last_name);
gm.setPreference("sysparm_dob", dob);
gm.setPreference('sysparm_search', answer);
gm.render();
}
} else {
var actionName = g_form.getActionName();
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
}
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 03:07 AM - edited 05-19-2023 03:10 AM
thats where i am ..if i click on cancel i have written some functionality its going to work but when i click on cross simply it has to close window nd nothing should happen.
anyhow this is also not working bro.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 04:09 AM
BTW cross and cancel works as same behavior.
In your scenarios what is happening when click on cancel and cross.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2023 04:19 AM - edited 05-21-2023 10:05 AM
as you said...cross and cancel working as same.
but I want to make cross should close just the window where as cancel button has to work as I written functionality for it.
do you have anything suggestion to show pop up like with our own options instead of this g_model.