sow ui builder overview page show only in incident table

Dolev Peretz
Tera Contributor

hii,

 

Hi, I'm working on the service operation workspace, and I want the overview page to be displayed with the incident section only . How can I hide it from the rest of the tables? Automatically, it appears in all of them. Adding an image showing that the conditions are not working. Conditions for page settings. Thanks to everyone.

 

Screenshot 2024-02-22 105523.png

2 REPLIES 2

AJ-TechTrek
Giga Sage
Giga Sage

Hi @Dolev Peretz ,

 

It is possible. There are couple of things you need to do.

1. Duplicate the overview variant as it is stated in documentation.

2. Now, you need the incident sysId first to query the state. This is mapped in page properties. You can use this to query the incident state via data sources.

AjayKumar011_0-1708954550326.png

 

3. Create a state parameter to specify the fields to query. Here we want to query state.

AjayKumar011_1-1708954552694.png

 

 

4. Click on data sources icon and Add a data source of type- "Look Up Record". Map the properties as below.

AjayKumar011_2-1708954552515.png

 

 

5. As the data source  is triggered immediately. The output would be available to you on page load in below format.

{
  "_row_data": {
    "displayValue": "INC0010007",
    "uniqueValue": "b2c7e2f52faca1101dc093acf699b682"
  },
  "number": {
    "value": "INC0010007",
    "displayValue": "INC0010007"
  },
  "state": {
    "value": "1",
    "displayValue": "New"
  }
}

You can access this output via: api.data.look_up_record_1.result.state.value in scripts.

This can be used in your component's hidden property like below.

 

6. Click on the component you want to hide. Add below script to the property.

/**
  * @Param {params} params
  * @Param {api} params.api
  * @Param {TransformApiHelpers} params.helpers
  */
function evaluateProperty({api, helpers}) {
  if(api.data.look_up_record_1.result.state.value == 1) //If state=1
	return true; //Hide the component
  else
  return false; //Do not hide the component
}

 

Also, if you want to execute this only for incident table then add another condition in IF statement to check the table also.

 

/**
  * @Param {params} params
  * @Param {api} params.api
  * @Param {TransformApiHelpers} params.helpers
  */
function evaluateProperty({api, helpers}) {
  if(api.data.look_up_record_1.result.state.value == 1 && api.context.props.table == "incident")
	return true; //Hide the component
  else
  return false; //Do not hide the component
}

 

 

Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.

 

Thanks

AJ

Linkedin Profile:- https://www.linkedin.com/in/ajay-kumar-66a91385/

ServiceNow Community Rising Star 2024

Hi ,

Thank you,

in steps 6 where i need to add the script for hide?
On the roof that it doesn't work in this 

Screenshot 2024-02-29 095422.png