Create system property for mapping and use it for dynamic value

Priyanka Chaud1
Tera Contributor

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 @suvro 

 

1 ACCEPTED SOLUTION

suvro
Mega Sage
Mega Sage

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

View solution in original post

15 REPLIES 15

@suvro if we don't use 2 properties and we are having tablename in 2nd property also in that object how can we fetch that tablename as we are fetching reffield and qfield?so we will use only one property than what will be the change in syntax of these propObj[tableName ].refField and propObj[tableName ].qField and also for tablename what we would use?