Custom UI Page for attachment & details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 04:48 AM
Hi All,
I am following the article posted by @Deepak Negi in which we can attach the attachment and then override the approval but it is not working and throwing an error in the console:
Link to the article: Attachment Transfer: Moving Files from HTML Input to ServiceNow Records
When the 'override approval is clicked in the popup the error comes up in the console as attached.
Could you please suggest what is going wrong? Thanks.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 10:57 PM
what debugging have you done so far?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 04:43 AM
Hi Ankur, Thanks for the response.
I have tried the 'Override Arroval' button and 'Cancel' button in the pop which throws the below error onClick:
Uncaught TypeError: gdw.getPreference is not a function
Uncaught TypeError: gdw.destroy is not a function
These are defined in the UI page's Client Script and I couldn't find any wrong declarartion in the below:
function invokePromptCallBack(type) {
var file = document.getElementById('attFile');
if (type == 'ok' && (file.files.length == 0 || !gel('work_note').value)) {
alert('Please provide both Attachment and Work Notes');
return;
}
var gdw = new GlideDialogWindow.get();
if (type == 'ok') {
var f = gdw.getPreference('onPromptComplete');
if (typeof(f) == 'function') {
try {
f.call(gdw, file, gel('work_note').value);
} catch (e) {}
}
}
gdw.destroy();
return false;
}
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2023 04:31 PM
Hi @Ankur Bawiskar @Deepak Negi
I have tried to debug by using an alert in the 'UI Action' and 'UI Page' and the typeof of 'f' is coming up as undefined.
var f = gdw.getPreference('onPromptComplete');
var gdw = new GlideDialogWindow.get();
if (type == 'ok') {
var f = gdw.getPreference('onPromptComplete');
if (typeof(f) == 'function') {
try {
f.call(gdw, file, gel('work_note').value);
} catch (e) {}
}
}
I believe in the 'UI Action' the function is not getting returned correctly for attFile abd work_notes.
dialog.setPreference("onPromptComplete", function(attFile, work_note)
Could you please assist in resolving the issue? Thanks
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 03:59 AM
Try deleting the UI page and create again