getting system property value to Client script

servicenow14710
Tera Expert

Hello, in a client script ,im using the below line, where the sys_id is stored in sys_properties table

g_form.hideRelatedList('REL:sys_id');

How can i bring that value and append in the line instead of using sys_id.

 

Any suggestions.Thank you

2 ACCEPTED SOLUTIONS

Sai Shravan
Mega Sage

Hi @servicenow14710 ,

 


To bring the value stored in the sys_properties table and append it to the line instead of using the string "sys_id," you need to retrieve the value from the database and substitute it into the script. Here's an example

 

// Assuming you have a variable 'propertyName' that contains the name of the property storing the sys_id value
var sysId = gs.getProperty(propertyName);
if (sysId) {
  // Use the retrieved sys_id value in your script
  g_form.hideRelatedList('REL:' + sysId);
} else {
  // Handle the case when the property is not found or doesn't have a value
  gs.info("Property not found or value is empty");
}

 

Regards,

Shravan

Please mark this as helpful and correct answer, if this helps you

View solution in original post

Hello @Sai Shravan Thanks for the reply, so since this line is used in Client script.

g_form.hideRelatedList('REL:sys_id');

i can use scratchpad from display business rule and use that value 

 

var myProperty = g_scratchpad.my_property

 

so as per you the line should be 

g_form.hideRelatedList('REL:'+myProperty); 

or

g_form.hideRelatedList('REL:myProperty');

im confused as how to append this.

View solution in original post

12 REPLIES 12

Hello @Sai Shravan Thanks for the reply, so since this line is used in Client script.

g_form.hideRelatedList('REL:sys_id');

i can use scratchpad from display business rule and use that value 

 

var myProperty = g_scratchpad.my_property

 

so as per you the line should be 

g_form.hideRelatedList('REL:'+myProperty); 

or

g_form.hideRelatedList('REL:myProperty');

im confused as how to append this.

Sagar Pagar
Tera Patron

Hi @servicenow14710,

Take a look ta one of my related article. It will help you.

System Properties & it's Usage 

 

Thanks,

Sagar Pagar

servicenow14710
Tera Expert

For client script on change,on submit , Can i use the display business rule without table name to get sysproperties value instead of using sys id .Any suggestions. @Sagar Pagar @Manmohan K @Sai Shravan . Thanks.

Hi @servicenow14710,

With out table name it is not possible in display business rule.

 

Thanks,

Sagar Pagar

Manmohan K
Tera Sage

@servicenow14710 

 

You can use Display Business rule in any type of client script to fetch any value from server side