query through name value pairs in system property and populate the fields on form accordingly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 05:40 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 05:44 AM
Hi @Indira8
Can you tell where are you writing this script? Business rule or Background script?
Also what value you are populating from property?
Also 'A-groupA;B-GroupB; ' is correct format?
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 05:51 AM
Hi @AnubhavRitolia ,
We are writing this script in the inbound email.
We are populating the workgroup from the property.
Sorry the correct format is
email1:group1;email2:group2;
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 05:55 AM
Thanks for info.
Also can you tell what will happen to email1 and group1 in this case?
where is this 'workgroup' field present?
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 06:09 AM
When workgroup field is present on the incident form.
When mail is received form email 1 then the group 1 should be populated, similar to the other pairs.
thank you