Accessing multiple catalog task in ATF

Supritha3
Tera Contributor

Hi,

In a catalog item that i am testing in ATF the workflow is as such, that it generates multiple catalog tasks(around 15) for a single RITM, i am able to query the sc_task table for all these records, but now i need to access each record and close task for each of them. I tried using the "run server side script",

var grTask = new GlideRecord('sc_task');
grTask.addEncodedQuery('request_item=grTask.number^state=Open');
grTask.query();
while (grTask.next()) {
gs.log('CATNum:'+grTask.number);
grTask.state="Closed Complete";
}

but i do not see the state to be "Closed Complete" for all records. Please help me get a solution.

Regards,

Supritha 

15 REPLIES 15

Hi,

So step 18 is for closing the tasks; what is the next step?

Can you try to open the tasks using "Tasks" module from left navigation and check by applying the filter with RITM is from step 9

Or else you can have one more run server side script step after step 18 which would check whether all tasks got closed or not

Any before update BR which blocks closure of SC TASK

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Supritha 

Hope you are doing good.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

Thanks!
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Supritha 

Hope you are doing good.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

Thanks!
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

         I tried giving field value validation but it failed could you please tell how to give run server script for checking closed or not

 

Thanks in advance,

Divya

@Divya Rajasekar 

I have responded to your question for ATF.

Please check that.

How to test catalog in service portal

It would be nice if you close your earlier questions as answered by marking best matching response as correct and helpful.

Members have taken their time, efforts for sharing/discussing the issue and providing workaround/solution.

It would encourage them and also provide credit and recognition to them.

Marking correct answers is helpful to your peers who may have the same question.  It also provides credit and recognition to the member(s) who provide answers.

What are the steps to validate notifications in ATF?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader