Ui action popup is dissapeared and server side code is not exceuting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 11:19 PM
I have created a UI action that has both client and server-side code but the server script is not executing and ui page is disappearing in a second.
Here is code for ui action
function importQC() {
// var answer = confirm('Please attach excel sheet to create bulk task');
// if (answer == true) {
var gdw = new GlideDialogWindow('attachment_custom');
gdw.setSize(750, 300);
gdw.setPreference('target_sys_id', g_form.getUniqueValue());
gdw.setPreference('target_table', g_form.getTableName());
gdw.setPreference('attachment_disabled', false);
gdw.render();
gsftSubmit(null, g_form.getFormElement(), "fj_import_qc");
}
if (typeof window == 'undefined')
serverReopen();
function serverReopen() {
gs.log('kissh');
var gr2 = new GlideRecord("sys_attachment");
gr2.addQuery("table_sys_id", current.sys_id);
gr2.addQuery("table_name", "sc_req_item");
gr2.query();
if (gr2.next()) {
gs.log('ajj');
// gs.addErrorMessage("You must attach a file to submit. Your import submission has been aborted.");
// current.setAbortAction(true);
GlideSysAttachment.copy(current.getTableName(), current.sys_id, 'sys_data_source', 'b5aad514473002101a5c7f52d16d43eb');
var ms = 5000; // 5 seconds
var endSleep = new GlideDuration().getNumericValue() + ms;
while (new GlideDuration().getNumericValue() < endSleep) {
//wait
}
var exportGr = new GlideRecord("scheduled_import_set");
exportGr.addQuery("sys_id", "38f402f447fc02101a5c7f52d16d4318"); // sys_id of the record which you will be creating for scheduled import in step
exportGr.query();
if (exportGr.next()) {
//gs.executeNow(exportGr); // this is for scoped app
SncTriggerSynchronizer.executeNow(exportGr); // this is for non scoped app
}
}
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 02:26 AM
When I Go through your script there are some changes that has to be made to run the script but still on click of that button there 's nothing happend.
here is my script might be work on your instance though please check it.
button is appearing but on click of that button its not working for my instance check your instance if its work or not
here is the script for that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 04:39 AM
@GopalBarde Can you tell what changes you have made for the above script? It looks same