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.

generating request from Schedule job

rahul67
Kilo Expert

i have been trying to generate Request ticket from Schedule Jobs using the following script

var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
//gives sys_id of catalog item
var item = cart.addItem('5104596487ed0910d0d4ca27cebb35fc', 1);
item.setVariable("requested_for", gs.getUserID());
var rc = cart.placeOrder();

 

everything is works fine but not displaying the Requested_for value by default. Please help

 

find_real_file.png

1 ACCEPTED SOLUTION

I have written this in a Scheduled Job as you need, but in case you need to write or use this in an Server side function you can do it as well :

Scheduled Job screenshot for reference as well:

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

23 REPLIES 23

Hi bro, its not working (not displaying the requested for )

but when I use the Run as field it requested for is displaying but no matter who triggers it . it just shows only one name (the same name).

rahul67
Kilo Expert

find_real_file.png

find_real_file.png

 

bro its working thanks