query through name value pairs in system property and populate the fields on form accordingly

Indira8
Kilo Sage

Hi All,

 

We have a requirement to populate a group field based on the name value pairs in the system property. 

for example: 
The value of the system property is A-groupA;B-GroupB; 

Could you help me with how to query the value, fetch the exact match and populate in the related field. 

The following script is not working , could you please help 

 

var gmatch = gs.getProperty('abc_sysprop');
var gr_ar = gmatch(";");
var sender = email.recipients;
for (var i = 0; i < gr_ar.length; i++) {
for (var j = 0; j < gr_ar.length; j++){
var gr_sysid = gr_ar[i].split(":");
if (gr_sysid[0] == sender) {

current.field_to_be_populated = gr_sysid[1];
current.update();

} else{
current.field_to_be_populated = gs.getProperty('xyz_sysprop');
current.update();

9 REPLIES 9

-O-
Kilo Patron
Kilo Patron

This is so much better and easier with the help of a Decision Table.

The code would be something like:

var input = { 'u_sender': '' + email.recipients, };

current.field_to_be_populated = new sn_dt.DecisionTableAPI()
	.getDecision('<Decition Table record sys_id>', input)
	.groupResult.result_elements.u_group;

The solution also becomes more easily configurable and more robust.

Properties should be used for data/stuff that changes once in a decade.

hi @-O- 

Could you please help me how to give the inputs for the decision table. Also, will this be out of box implementation. 

 

Thank you 

Hi @-O- ,

 

Also, the requirement is a bit tricky as we need to check the recipients field as the email is always routed from a mailbox and there will be multiple recipients. 

From the list of email recipients we have to match the combination and then assign the appropriate workgroup. 

Thank you 

Can you give an example of the logic of matching combination and then assigning?

Whatever change you make to an instance, that change is not OOB. So strictly speaking no. But this is a functionality that enables configuration vs. modification/development. So it is "kosher".