Attachment mandatory in now mobile app for catalog item

venkatesh tadip
Tera Contributor

Hi Team,

I have one catalog item when it submit it will check user is attached a attachment or not 

If attachment is not attached there is a alert message and stop the submission.

It was working fine for the both native ui and service portal but not in the now mobile, I want supported script for the now mobile app.

Thank you.

2 REPLIES 2

Vishwa Pandya19
Mega Sage

Hello,

 

Make the UI Type as All. This will ensure that the client script runs on all the UI's where the catalog is available.

VishwaPandya19_0-1714367263791.png



If my answer has helped you in any way please mark it as correct or helpful.

I'm facing the same issue. UI Type is not the problem as it is already set to all. The code below is what I have used for use the first part is trying it in native ui and if that fails the catch does it in Service Portal.

function onSubmit() {
    //Type appropriate comment here, and begin script below
    try { //non Service Portal
        var attachments = document.getElementById('header_attachment_list_label');
        if (attachments.style.visibility == 'hidden' || attachments.style.display == 'none') {
            alert('Please attach');
            return false;
        }
    }
    //For Service Portal
    catch (e) {
        var count = getSCAttachmentCount();
        if (count <= 0) {
            alert('Please attach');
            return false;
        }
    }
}