- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2021 09:56 PM
Hi,
When a request is approved or rejected mail is sent to requested for.
ATF step, i have written a record query for sys_email table.
I am getting below error.
I am getting sys id of the ritm that is why it is failing may be.
How to get the exact record.
Solved! Go to Solution.
- Labels:
-
Automated Test Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 09:28 PM
Hi,
the issue here is target field on sys_email is document_id so possibly it is not able to query
Use Run Server Side Script Step instead of Step 22 which is Record Query
(function(outputs, steps, stepResult, assertEqual) {
// add test script here
var STEP_10_SYS_ID= 'd9f8dd67db805410bea7550a48961930'; // step sys_id of Step 10
var val = steps(STEP_10_SYS_ID).first_record;
var emailRec = new GlideRecord('sys_email');
emailRec.addQuery('target_table', 'sc_req_item');
emailRec.addQuery('instance', val);
emailRec.query();
if(emailRec.next()){
outputs.table = 'sys_email';
outputs.record_id = emailRec.sys_id;
message = 'Found Email';
stepResult.setOutputMessage(message);
stepResult.setSuccess();
return true;
}
else{
message = 'Not Found Email';
stepResult.setOutputMessage(message);
stepResult.setFailed();
return false;
}
})(outputs, steps, stepResult, assertEqual);
Then For Step 23 do this select the output of the previous Run Server side script step
"Open the 'Email' form with id '{{Step 22: Record Query.Record id}}'
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2021 10:56 PM
Did you add any delay before checking for email record? as it takes sometime to create email record and also send that email, you need to add delay before this step, preferably more than 2 mins.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 04:12 AM
Hi, Yes i did add time out 60 seconds still i am not able to fetch the record

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2021 11:23 PM
Hi
What Ahmmed suggests is a very good idea.
Additionally to that, maybe your condition does not match:
a) did you manually check, if the EMail was created
b) did you manually check, if the conditions you entered are correct (e.g. by the SysID of the "Target" field.
As I cannot see which table your condition runs on and I cannot see, what your "First record" in your condition is, I just can suggest to cross-check the condition manually and check if the Records with the given IDs are created as expected.
If you can supply a bit more details with screenshots, this would help with further investigation, if needed.
Let me know if that answers your question and mark my answer as correct and helpful.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2021 04:13 AM
hi
in manual testing i am able to see the email.
But through atf in target i am getting sys id of the RITM where as i want the number