JSON Parse not working

Community Alums
Not applicable

HI Team,

 

We have written a script include which is Global scope and also Before BR also in same scope

We are calling the script include as below

 

var parseValue = JSON.parse(new CustomerAccountUtil().getRootParent(current.sys_id));

 

But on doing gs.addInfoMessage(parseValue );

 

Its giving undefined message/error. However at script include side when we do gs.log()  we are getting the proper output.

Kindly help

 

8 REPLIES 8

Shubham Singh
Mega Guru

Hi @Community Alums 

 

 It will be helpful if you can share the code you have written in BR and Script Include.

 

Thanks!

Danish Bhairag2
Tera Sage

Hi @Community Alums ,

 

Can u try removing the JSON.parse and try calling the script include normally like below

 

var parseValue = new CustomerAccountUtil().getRootParent(current.sys_id);

 

Thanks,

Danish

 

Community Alums
Not applicable

I am getting message as Undefined  if we try calling the script include normally

Community Alums
Not applicable

var value=new CustomerAccountUtil().getRootParent(current.sys_id);

 

gs.addInfoMessage(value);

Above is giving Undefined message