Script include: build up results as JSON object

call the function:


var cc_estate="ABC" var si= new <script_include>(); var res= si.retrieve_costcenter_info_add(cc_estate); gs.print(JSON.stringify(res));




gs.print(res.business_area);


output:

*** Script: {"business_area":"LAA","procurement_team":"LAA_Purchase_Order_Team"}
*** Script: LAA

script include function:


retrieve_costcenter_info_add: function(cc_estate) { //--for add CC, retrieve the business area and procurement team var sBusinessArea = ""; var sProcurementTeam = ""; switch (cc_estate) { case "ABC": sBusinessArea = "abc123"; sProcurementTeam = "team 1"; break; case "EFG": sBusinessArea = "efg456"; sProcurementTeam = "team 2"; break; //--etc default: break; } var aNewCCData = {"business_area": sBusinessArea , "procurement_team": sProcurementTeam }; return (aNewCCData); },




Comments

Popular posts from this blog

GlideRecord setValue

variable advanced reference qualifier example

Running transform maps asynchronously