Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

How to make attachments mandatory on variable condition IN Employee Center Pro

dwilborn
Tera Contributor

Hi All,

I have a requirement to make attachment mandatory if certain conditions are met on a catalog item.  We're using ESC Pro and this catalog item would be on the ITSM tables.  I've read lots of the articles on making this happen in Service Portal... but none of those methods appear to work in ESC?  Perhaps I'm missing something, but thought I'd ask the ESC community if anyone else has experience and found a solution.

 

Thanks!
Daniel

6 REPLIES 6

Hi Susan,

 

I am arrived on the same request and i just used ur approach but sadly its not working for me...

Hey Bishal,

 

I had the same issue trying to use Susan's Catalog Client Script, but I was able to rework it and get it functional in my instance. One of the issues that I was running into was that I'm using the Service Portal instead of Employee Center.  In Service Portal, the get-attachment DOM check is imperative.

Sorry this is a year late. Hope it helps!

function onSubmit() {
	var <variable> = g_form.getValue('<field name>');
	if (<variable> == '<value>') {
		var attachments = this.document.getElementsByClassName('get-attachment');
		if (attachments.length == 0) {
			g_form.addErrorMessage('<error message text');
			return false;
		}
	}
	return true;
}