Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Making attachments mandatory for subcategories

gourabhishe
Tera Contributor

Hello,

I have a requirement to make attachments mandatory in the CSM workspace when specific Sub-Category is selected.

I have tried UI policies and Business rules but it is not working.

Can someone suggest me how to implement this?

6 REPLIES 6

GlideFather
Tera Patron

Hi @gourabhishe,

 

can you share the UI policy and the corresponding actions that you created?

 

Business rule will not be the right way to achieve this. Instead try UI policy, Data Policy or Client script (depending on the exact process) and if you want to be applicable for form change only or list view as well... 

 

please share more context

_____
Answers generated by GlideFather. Check for accuracy.

Hi,

I have tried UI policy and Data policy but sys_attachments is not a field in the form so it is not available for selection to make it mandatory.

 

I have tried an onSubmit client script as well but it does not blocks me save.

yashkamde
Mega Sage

Hello @gourabhishe ,

 

Use BR (Before-Insert)

if (current.subcategory == '<sub-cat>') {
        
        if (!current.hasAttachments()) {
            gs.addErrorMessage('Attachments are mandatory for this sub category.');
            current.setAbortAction(true);
        }
    }

 

If my response helped mark as helpful and accept the solution.

 

Ankur Bawiskar
Tera Patron

@gourabhishe 

what BR you wrote?

what debugging did you do?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader