Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Field mapping string field to reference field

Sathiskumar_D
Giga Sage

Hello,

 

I have JSON data in the Staging table field.find_real_file.png

I have to map with reference field in table.find_real_file.png

But transformation is not working as anticipated. Could someone help me ? 

I've also referred other community questions. 

https://community.servicenow.com/community?id=community_question&sys_id=b8f93179db0c67c01cd8a345ca9619eb

 

https://community.servicenow.com/community?id=community_question&sys_id=83ed1ac4db2c90104819fb2439961950

1 ACCEPTED SOLUTION

please return the value which you wish to be searched in the field u_gen_prod_info of the table being referred by Type of Account field

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi Sathish,

The function should return the value to enter into the field.

answer = (function transformEntry(source) {
  var accnttype = JSON.parse(source.u_gen_prod_info);
  if (accntType.product == 'Mortgage') {
    return lprod;
  }
})(source);

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

in the field map script you need to parse the JSON

also while returning you need to return value which is stored in u_gen_prod_info

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

 

But TYpe of Account (mapping field) has to refer "Loan product" but not u_gen_product_info. 

please return the value which you wish to be searched in the field u_gen_prod_info of the table being referred by Type of Account field

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader