- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 12:40 AM
I want to use a mapping kind of thing
and store this in system property and use it in my script include to make tablename,parentfield and column name dynamic how can i achieve this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 01:28 AM
Just create a property with below values
{ "task" :{"refField": "parent", "qField" : "number" }, "incident" :{"refField": "parent_incident", "qField" : "number" }, "sys_user" :{"refField": "manager", "qField" : "name" }, "problem" :{"refField": "duplicate_of", "qField" : "number" }}
call that property
var tableName = gs.getProperty('property name'); //another property which stores tablename
var propV = gs.getProperty('property_name');
var propObj = JSON.parse(propV);
Now you can use it :
propObj[tableName ].refField and propObj[tableName ].qField
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 01:28 AM
Just create a property with below values
{ "task" :{"refField": "parent", "qField" : "number" }, "incident" :{"refField": "parent_incident", "qField" : "number" }, "sys_user" :{"refField": "manager", "qField" : "name" }, "problem" :{"refField": "duplicate_of", "qField" : "number" }}
call that property
var tableName = gs.getProperty('property name'); //another property which stores tablename
var propV = gs.getProperty('property_name');
var propObj = JSON.parse(propV);
Now you can use it :
propObj[tableName ].refField and propObj[tableName ].qField
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 01:47 AM
var tableName = gs.getProperty('property name'); //another property which stores tablename
var propV = gs.getProperty('property_name');
var propObj = JSON.parse(propV);
in every function of script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 02:32 AM
Define the variables in the initialize function of the script include like below then it will be available for all functions of the script include. You will not have to define those in every function
this.tableName =
this.propV =
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2022 03:34 AM
initialize: function() {
this.tableName = gs.getProperty('x_cyso_org_hierarc.dropdown_value');
this.propV = gs.getProperty('x_cyso_org_hierarc.parentref _fields');
var propObj = JSON.parse(propV);
},
is this the way it would be initialiaze in one function