How to retrive the submiited form in Automated test Framework?

pavi12
Tera Contributor

As I am new to the ATF,

First step  - Impersonate the user

Second Step - Create new incident form

Third Step- Set the all mandatory fields

Fourth Step - Submit the form

In the next steps I need to map the submitted incident form information ?

 

Can anyone please help me ?

 

 

7 REPLIES 7

No, I am not attempting to send an email. I am just validating the email to confirm if it was received from the incident caller.

My question is how to get the caller name from the submitted form?

Hi,

 

Sorry, I could not find a low-code way of doing this and so, I had to write a server script as part of the test. Please check the screenshots below.

 

ArpanBaishya_0-1718467562951.png

 

I have added the Run Server Side Script step right after the Submit a form step.

 

ArpanBaishya_0-1718468397114.png

 

Code to compare the email values. Added a comment to provide greater clarity.

 

ArpanBaishya_2-1718467812263.png

 

Test result showing success.

 

 

 

(function(outputs, steps, params, stepResult, assertEqual) {
    // add test script here
    var incident_gr = new GlideRecord('incident');
    if (incident_gr.get(steps('put_your_submit_form_step_sys_id').record_id))
        var email = incident_gr.caller_id.email;

    //gs.info(email);

    var email_gr = new GlideRecord('sys_email');
    email_gr.addQuery('instance', steps('put_your_submit_form_step_sys_id').record_id); // instance is the name for the 'Target' field and the sys_id here is for the Submit form step.
    email_gr.addQuery('recipients', 'CONTAINS', email);
    email_gr.query();

    if (email_gr.next())
        stepResult.setOutputMessage('success');
    else
        stepResult.setOutputMessage('failure');

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

 

 



Let me know if this helped you.

Thanks, In next steps I need to send the email reply to the instance from that caller ID using 

pavi12_0-1718515538973.png

In this from field, I need to set the caller mail id 

Thanks