The CreatorCon Call for Content is officially open! Get started here.

Make an attachment mandatory using select box choice.

Roly
Kilo Contributor

Hi

I'm building a form to do with budgets, so there is a requirement that when an option is selected from a select box it is then mandatory to attached a exemption word docx form to the form before it can be submitted.

So if the user chooses "over £1000" I need a text box to appear underneath and then the attachment option which is on all forms needs to be then mandatory.

I can't seem to work out how to do this?  Would a UI policy do it?

Cheers

Roly

11 REPLIES 11

Richard45
Tera Contributor

You could try a before Business Rule that checks the attachment table (by table name and sys_id, as well as any name or date validation) for a file if the field is checked.

You can abort "the current database transaction. For example, if certain conditions are met, prevent the user from saving the record in the database." [1]

 

[1] Business Rules

AbhishekGardade
Giga Sage

Hello Roly,

Orlando or Before Orlando releases:

You can make use of onChange client scrpt with code mentioned in this blog:

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

Paris Release:

There is new variable type added for service catalog, so you can use that.

Thanks,

Abhishek Gardade

Thank you,
Abhishek Gardade

Prateek kumar
Mega Sage

Please take a look at below thread:

https://community.servicenow.com/community?id=community_question&sys_id=591ecd1edbfbbb8c23f4a345ca96...


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

AbhishekGardade
Giga Sage

Hello Roly,

Do you want to make attachment mandatory on Sevicen Catalog Form ? If yes, you can use one of scripts available on this article and confiure it accordingly.

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

For Record form,

You can create a before update business rule with ,current.hasAttachments() to check if attachment is avaiable or not.

if (!current.hasAttachments())  {  
current.setAbortAction(true);  
}

Thanks,
Abhishek Gardade

Thank you,
Abhishek Gardade