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-depending-on/ta-p/2300151

 

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-variable-selection-on-a/td-p/1392119

 

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

*************************************************************************************************************
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/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