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.

what code to replace gs.setProperty()

IceIronDragon
Tera Guru

Hi All,

I am working on a code which does not fit well with our best practices (gs.setProperty())  and I was hoping if someone can guide me what code to write in place of the exiting code :

 

this.debug(JSON.stringify(statusList));
        gs.setProperty('sn_vul.synack.vulnerability_statuses', JSON.stringify(statusList));

1 ACCEPTED SOLUTION

thank you ,

I am not that good with JS,  just to understand I already have a property which store the status value, would not that do it for eg 😕

 

this.debug(JSON.stringify(gs.getProperty('sn_vul.synack.vulnerability_statuses')));

or do I create another property to store JSON value ?

View solution in original post

9 REPLIES 9

Mohith Devatte
Tera Sage
Tera Sage

Hello , If status list is your JSON then you can create a property with value as this JSON and the use

gs.getProperty('your property name ');

Mark my answer correct if it helps you

you mean : 

this.debug(JSON.stringify(statusList));
        gs.getProperty('sn_vul.synack.vulnerability_statuses');

No I meant this.debug(JSON.stringify(gs.getProperty('your property name')));

But before that you should have your JSON stored in the property value

thank you ,

I am not that good with JS,  just to understand I already have a property which store the status value, would not that do it for eg 😕

 

this.debug(JSON.stringify(gs.getProperty('sn_vul.synack.vulnerability_statuses')));

or do I create another property to store JSON value ?