Vancouver - catalog item ootb attachment mandatory in certain cases

Afnan Alkhamis
Tera Guru

Hello guys!

I'm having a bit of an issue with making the ootb attachment of the catalog item on the portal mandatory depending on the answer to another question.

I tried these methods but didn't work: document.getElementById('') ,  getSCAttchmentCount() 

 

any help would be appreciated

1 ACCEPTED SOLUTION

Afnan Alkhamis
Tera Guru

I managed to get it to work by writing on submit client script with this code:

 
    if (this.document.getElementsByClassName('get-attachment').length == 0)
    {
        alert('You must add an attachment before submitting this request.');
        return false;
    }

View solution in original post

6 REPLIES 6

Sohail Khilji
Kilo Patron
Kilo Patron

@Afnan Alkhamis,

 

if you want condition less then :

Open the catalog item go to > Portal setting Tab > Enable the check box Mandatroy Attachement... and save..

 

if you want with condition :

Use this > https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743672

 

your done....


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

document.getElementById('')  doesn't work on the portal as it states that on the link you sent

Tai Vu
Kilo Patron
Kilo Patron

Hi @Afnan Alkhamis 

To be able to use the getSCAttachmentCount, you need to define the UI Script. Then add it to the JS Include of the Portal Theme.

Check the OTTB KB below from Now Support for steps by steps.

KB0743672How to make attachment mandatory with Service Catalog Item on the Service Portal

 

Let's also have a look to the below thread. It's a nice post about different ways to make Attachment mandatory in Service Portal.

Possible Ways for Making an Attachment Mandatory : Service Portal/Native UI

 

 

Cheers,

Tai Vu

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Afnan Alkhamis 

 

Not sure, but did you try the catalog UI policies for this?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************