ATF

SnigdhP77706229
Tera Contributor

What is the need for Record Update after the server-side script in ATF and why do we use open existing records after Server Side Script test step?

5 REPLIES 5

SN_Learn
Kilo Patron
Kilo Patron

Hi @SnigdhP77706229 ,

 

Record update is use to update the record generally post 'Record query' step. This is a server side step.

In order to open the step on the client test runner, we have to use client side supported step which is 'open existing record', this will open the form in client test runner window and screenshots could be captured of it.

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

image.pngHere need to understand what the use of Record update after Server-side script 

Hi @SnigdhP77706229 ,

 

(function(outputs, steps, stepResult, assertEqual) {
    var change_sys_id = steps("873891bd53412300e321ddeeff7b12e8").record_id;
    var changeGr = new GlideRecord("change_request");
    changeGr.get(change_sys_id);
    if (!changeGr.chg_model.nil()) {
        changeGr.setValue("chg_model", "");
        changeGr.update();

    }
    outputs.record_id = change_sys_id;

})(outputs, steps, stepResult, assertEqual);

 

In the above code, it is getting the step2 sysID which is 

'873891bd53412300e321ddeeff7b12e8', then finding the same record on the 'change_request' table and setting the change model to empty, and as output it is returning the sysId of record inserted in step2.
 
In the step4, record update.. it is fetching the record inserted in step 2 and then just updating the fields.
In step 5, opening the same record in cloud runner.
 
----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Hi @SnigdhP77706229 

 

The usage of the step depends on many factors, like, As you said, the server-side script is already executed and now if you want to change something in the record, you can use the update Record step in ATF. I can see, you created a change request but in Update Record, you want to update the type, practically not a good way, the selection of the type of change should be done in creation time only and then in update, you can change it to other. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************