Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Need Background script for changing a field value

AnandKumar1
Tera Expert

Hi Team,

Good Day!!

I need a background script for changing a field (Task type) value (from Test to Post-Work).

We dont have field value in numbers as like in Incident.Attached the screenshots.find_real_file.png

 

find_real_file.png

Please check . the script is not working as it takes any value given other than Test,Work,Pre-Work,Post-Works too.

1 ACCEPTED SOLUTION

AbhishekGardade
Tera Sage

Hello Anand,

We are using IN operator if we want to find numbers from comma separated values provided in query.

For example.

ctask.addQuery('number','CTASK0753800,CTASK0753801,CTASK0753802');

As you need to find it for single ctask, then either you can use addQuery without IN,

var ctask = new GlideRecord('change_task');

ctask.addQuery('number','CTASK0753800');

ctask._query();

if(ctask._next()) {

ctask.u_type="Post-Work";

ctask.setWorkflow(false);

ctask.update();

}

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade

View solution in original post

5 REPLIES 5

AbhishekGardade
Tera Sage

Hello Anand,

We are using IN operator if we want to find numbers from comma separated values provided in query.

For example.

ctask.addQuery('number','CTASK0753800,CTASK0753801,CTASK0753802');

As you need to find it for single ctask, then either you can use addQuery without IN,

var ctask = new GlideRecord('change_task');

ctask.addQuery('number','CTASK0753800');

ctask._query();

if(ctask._next()) {

ctask.u_type="Post-Work";

ctask.setWorkflow(false);

ctask.update();

}

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade