- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 09:24 PM - edited 06-05-2023 09:24 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 10:14 PM
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
Shravan
Please mark this as helpful and correct answer, if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 10:19 PM - edited 06-05-2023 10:20 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 09:35 PM
You can use a Display Business Rule and put the property into a g_scratchpad variable. You can then use it in your client script.
BR:
g_scratchpad.my_property = gs.getProperty('property name where sys_id is stored');
CS:
var myProperty = g_scratchpad.my_property
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 10:15 PM
@Manmohan K : Thanks for the solution.Yes, im using display business rule .So in Clinet script how can i use that property or the variable cretaed for storing.
var myProperty = g_scratchpad.my_property
g_form.hideRelatedList('REL:myProperty');
so i sthis the way it has to be used?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 10:21 PM
You can use below line assuming variable in which property is stored is myProperty
g_form.hideRelatedList('REL:'+myProperty);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 10:14 PM
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
Shravan
Please mark this as helpful and correct answer, if this helps you