how can i know if the user upload a new attachment on mi record?

EvilRojo
Tera Expert

Hi!, I want my ui action to check if the user uploaded a new attachment, if he did, he can update, if not, he must cancel the record update

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@EvilRojo 

you can use server side script in the UI action and check that

If it's validated then add your code which you want to run

if(!current.hasAttachments()){
	gs.addErrorMessage("Please upload file");
	current.setAbortAction(true);
}
else{
	// add your code here which you want to execute when UI action is clicked
}

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

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

View solution in original post

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@EvilRojo 

you can use server side script in the UI action and check that

If it's validated then add your code which you want to run

if(!current.hasAttachments()){
	gs.addErrorMessage("Please upload file");
	current.setAbortAction(true);
}
else{
	// add your code here which you want to execute when UI action is clicked
}

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

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