To make attachment mandatory on Native View of catalog item.

Mishu
Tera Expert

To make attachment mandatory on Native View of catalog item.

Got a related post for the same , It suggest for DOM manipulation . Can somebody please tell if using DOM manipulation will not impact anything later ?

@Ankur Bawiskar  Can you please advise ?

https://community.servicenow.com/community?id=community_blog&sys_id=00edd9751bb090d0ada243f6fe4bcba8&feedbackAction=comment

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

this script in onSubmit would work fine for Native

function onSubmit(){

	var count = getCurrentAttachmentNumber();
	if(count == 0){
		alert('Please add at least 1 file');
		return false;
	}

}

Regards
Ankur

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

View solution in original post

7 REPLIES 7

@Mishu 

I don't think it would impact. It's just that DOM is not good practice.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

@Mishu 

to make it work in Both Native + Portal check this link

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

Making Attachments Mandatory in SP: The Ultimate Guide (Including Paris)

SERVICE PORTAL: Make Attachments Mandatory on Service Portal

Regards
Ankur

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

Roshan Tiwari
Tera Guru

Hi Mishu,

In Catalog Item table you can use Mandatory attachment checkbox field, set that to true for your item which you trying to set mandatory attachment.