Is there a way to make the Requested For field type not mandatory?

c5ho
Tera Contributor

Hey all,

 

I'm fairly new to SN development and I'm building a Catalog Item form that uses the Requested For variable type. 

 

In a delegated request scenario, a user may be submitting a request for a user that is no longer part of the firm and therefore not available in the sys_user table, which the Requested For variable type references.  In this case, I have a field to allow the requester to manually enter a name to submit the request for.

 

However, when I submit the request, the form still expects a value for "Requested For" and I get the error: "Item should have a value for Requested For".

 

Is there a way to make the Requested For field not mandatory? 

 

I'm able to specify a blank default value in the variable specifications using : javascript;gs.getUserID = ''; and it's possible to submit the form this way, the workflow would not be this way.

 

What would normally happen is that the user would first try to find the user in the Requested For field and when a user isn't found, toggle a "User not found" checkbox that then allows the user to see the manually entered field.  Once this is done, the default field value from the Requested For field would be removed.  

 

I've tried using a Catalog Client Script to see the Requested For field to blank but this has not worked.  

 

Any help would be greatly appreciated!

1 REPLY 1

Sai_Charan_K
Kilo Sage

Hi @c5ho,

 

Instead of using the field type "Requested for" you can create a new field with same name and not mark it as mandatory. Doing so your requirement would be fulfilled.

 

Please mark this answer as "helpful" and mark it as "correct" if this helped you in anyway.

 

Thanks and Regards,

K. Sai Charan 

Sr. ServiceNow Developer 

Deloitte India