
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 05:25 AM
Email notification has been configured for creation of enhancement record. I am creating an enhancement record from below steps.
I want to validate whether the notification has been triggered or not for enhancement record created from step 3. Also I want to validate notification is triggered to assigned to of enhancement record. Could any one suggest me how I can achieve this through ATF?
Also please inform me how I can query enhancement number from ATF?
Solved! Go to Solution.
- Labels:
-
Automated Test Framework

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 10:11 AM
This would be your code:
(function(outputs, steps, stepResult, assertEqual) {
var gr = new GlideRecord("rm_enhancement");
var num = steps('60f29ef0dbf527006d3c72fc0f961959').record_id; //Sys Id is mentioned here is previous step sys_id.
gr.addQuery('sys_id',num);
gr.query();
if(gr.next())
{
outputs.record_id = gr.number; //(replace with field name of number)
}
// add test script here
})(outputs, steps, stepResult, assertEqual);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 11:02 AM
Yes, It worked as expected! Thank You So Much Nitesh.
Is there any separate scripting document for this ATF, If Yes! please share the link. Once again Thank You!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 11:05 AM
You're welcome! Can you please mark my answer as correct? you marked yourself as correct on this!
I don't think there is any separate document on this, its may be what servicenow provides in their website which is usually not all we want.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 11:26 AM
Sorry for that. I marked your answer as correct now!
One more question just for curiosity, In below script outputs.record_id is holding the number of enhancement.
How I can get another value like assignment group of enhancement with enhancement number in two different variable in the same script? or do we need to write similar server script step for assignment group of enhancement?
(function(outputs, steps, stepResult, assertEqual) {
var gr = new GlideRecord("rm_enhancement");
var num = steps('60f29ef0dbf527006d3c72fc0f961959').record_id; //Sys Id is mentioned here is previous step sys_id.
gr.addQuery('sys_id',num);
gr.query();
if(gr.next())
{
outputs.record_id = gr.number; //(replace with field name of number)
}
// add test script here
})(outputs, steps, stepResult, assertEqual);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 11:34 AM
If you need to store multiple variables you either have to write multiple scripts, or go to the step config of server side script and add more output variables with different name. This is a better option because you can use them whenever you want to in any test case.
Like right now you have outputs.record_id;
you can add more with your own names such as string_field; assignment_group; etc etc. you can even select the type of field you want, like string, reference, true/false etc.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2018 11:55 AM
Could you please provide me any small example. Because I did not get how to add output variables in step config server side script.