- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2018 11:56 AM
Mandatory attachment check is not working on order guides in service portal, keep asking for the attachments over and over and not letting to proceed further.Any help on here is greatly appreciated.
Here is the code that i'm using, which is working fine for stand alone catalog items on both iframe and service-portal but not on order guides in service-portal.
UI Script: GlobalCatalogItemFunctions
function getSCAttachmentCount() {
var length;
try {
length = angular.element("#sc_cat_item").scope().attachments.length;
} catch(e) {
length = -1;
}
return length;
}
This is an onSubmit script I am using for a catalog item:
function onSubmit() {
try { //Works in non-portal ui
var attachments = document.getElementById('header_attachment_list_label');
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {
alert('You must attach the completed form before submitting this request.');
return false;
}
} catch(e) { //For Service Portal
var count = getSCAttachmentCount();
if(count <= 0) {
alert('You must attach the completed form before submitting this request.');
return false;
}
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 10:43 AM
i got it worked with this code, might be useful for somebody who's looking for it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2018 10:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2020 02:23 PM
Thanks for providing the accurate solution, perfectly worked.
Almost spent 6hrs but no result.
Applied yours and its fixed!!!
Appreciate your efforts!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2019 04:18 AM
I have used same code but it is not working for my catalog item. and below code
if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none' ) {
alert('You must attach the completed form before submitting this request.');
return false; ----->not giving any alert and
catch(e) { //For Service Portal
var count = getSCAttachmentCount();
if(count <= 0) {
alert('You must attach the completed form before submitting this request.');
return false;
}
is giving alert continuously even after adding attachment please give me a solution.
Thanks,
Suresh Ch.