Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Hide field in SP widget if dependent field is empty

JJG_SNOW
Mega Guru

I have two fields on a SP widget, "Project" and "Service".

I would like the service field to only be visible if the project field is not empty.

 

Two fields:

JohnGilmore_0-1699887047195.png

 

HTML that I am using:

<br><label for="project">Project</label><br>
<sn-record-picker field="project" table="'pm_project'"   display-field="'short_description'" display-fields="'status,project_manager'" value-field="'sys_id'" search-fields="'short_description'" page-size="100" ></sn-record-picker>


<br><label for="service">Service</label><br>
<sn-record-picker field="service" table="'cmdb_ci_service'" display-field="'name'" display-fields="'owned_by,service_classification'" value-field="'sys_id'" search-fields="'name'" page-size="100"></sn-record-picker>

  

I do not have any client or server scripts for this widget yet.

2 REPLIES 2

Edxavier Robert
Mega Sage

Hi @JJG_SNOW , 

 

You would need to create a catalog ui policy on the project variable. 

 

EdxavierRobert_0-1699889972419.png

The create a catalog policy UI action

EdxavierRobert_1-1699890066662.png

 

This is a Service Portal widget, not a catalog item / record producer.