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.

Unable to populate variable on scheduled job

Joshua Comeau
Kilo Sage

How to get the current form short description to populate the carts description variable?

JoshuaComeau_0-1699536083736.png

 

1 ACCEPTED SOLUTION

@Joshua Comeau Try this

 

cart.setVariable(item, 'what_can_we_help_you_with', current.u_ppm_short_description);

Thanks,
Anvesh

View solution in original post

6 REPLIES 6

AnveshKumar M
Tera Sage
Tera Sage

Hi @Joshua Comeau 

 

Yo can use current.<Field_Name> to get the value of it. For testing purpose I have created a string field called Short Description (u_ppm_short_description) and just wrote a simple log statement, I could see the field value in the logs.

 

In your case you can access like current.u_ppm_short_description

 

AnveshKumarM_0-1699537659350.png

 

AnveshKumarM_1-1699537706392.png

 

Please mark my answer helpful and accept as solution if it helped 👍✔️

 

Thanks,
Anvesh

@AnveshKumar M 

how do I get the gs.info into the cart variable?

script I used:

JoshuaComeau_1-1699538118869.png

I am getting the following error (undefined):

JoshuaComeau_0-1699538066120.png

 

also tried this same issue:

var shortdesc = gs.info(current.u_ppm_short_description)
cart.setVariable(item, 'what_can_we_help_you_with', shortdesc);

@Joshua Comeau Try this

 

cart.setVariable(item, 'what_can_we_help_you_with', current.u_ppm_short_description);

Thanks,
Anvesh

same through an error undefined on the task it created