Skip to content

Instantly share code, notes, and snippets.

@manvillej
Last active April 18, 2021 13:22
Show Gist options
  • Save manvillej/443ab95988b1fc8769b54cdbf38074b4 to your computer and use it in GitHub Desktop.
Save manvillej/443ab95988b1fc8769b54cdbf38074b4 to your computer and use it in GitHub Desktop.
(function process(/*ResolverEnvironment*/ env) {
gs.info("getSource: " + JSON.stringify(env.getSource())); // sys_id
gs.info("getArguments: " + JSON.stringify(env.getArguments())); // limit
var limit = parseInt(env.getArguments().limit);
var test_id = env.getSource();
var test_result = new GlideRecord("sys_atf_test_result");
if(limit || limit>0) {
test_result.setLimit(limit);
}
test_result.addQuery("test", test_id);
test_result.orderByDesc("start_time");
test_result.query();
var test_result_list = [];
while(test_result.next()) {
test_result_list.push(ATFGraphQLAPI.atfTestResultToJson(test_result));
}
return { "history":test_result_list };
})(env);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment