We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to make attachment non mandatory

Not applicable

Hi how to make attachment non mandatory based on variable choices can anyone help me out in this. Thanks in advance

7 REPLIES 7

Aman Kumar S
Kilo Patron

Hi @Community Alums 

You can follow this article to achieve the same:

https://www.servicenow.com/community/itsm-articles/making-attachment-mandatory-for-a-catalog-item-de...

 

Best Regards
Aman Kumar

Dr Atul G- LNG
Tera Patron

 Hi @Community Alums 

 

https://www.servicenow.com/community/developer-forum/make-an-attachment-mandatory-based-on-a-variabl...

 

https://www.servicenow.com/community/developer-forum/make-attachment-mandatory-on-catalog-item-based...

*************************************************************************************************************
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/dratulgrover [ Connect for 1-1 Session]

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

Not applicable

Its not exactly fits to my requirement 

chetanb
Tera Guru

@Community Alums 

You can write catalog client script onchange

function onChange(control, oldValue, newValue, isLoading) {

 

    var variableValue = g_form.getValue('ur_variable_name'); 

    if (isLoading || variableValue === '') {

        return;

    }

    var attachmentField = g_form.getControl('attachment_field');

    if (variableValue === 'specific_choice') { 

        attachmentField.setAttribute('mandatory', 'false');

    } else {

        attachmentField.setAttribute('mandatory',

'true');

    }

}

 

Note:- Please replace your variable name 

 

Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

 

Regards,

CB