Subscribe Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security. Subscribe

UI Script: stringifying object is omitting properties

Hello,

I am trying to hook into the results_dialog.validate event when logging a test result, to send the test_id, defect (if present) and milestone to an internal rest endpoint.

UI Script Code:

name: some name
description: some description
author: Ryan Perneel
version: 1.0
includes: ^runs/view
excludes: 

js:
$(document).ready(function () {
  $.subscribe('result_dialog.validate','',
    function (o) {
		console.log(o.values);
		console.log(o.values.valueOf('test_id'));
		if (o.values.defects !== "" && o.values.custom_tested_on !== "") {
			var data = {
				milestone: uiscripts.context.milestone.id,
				details: o.values
			}
			console.log(data);
			console.log(JSON.stringify(data));
			$.ajax({
				type: 'POST',
				url: 'REDACTED',
				data: data
			})
		}

    })
})

the console.log(o) is showing me all the properties (most important is test_id), but when I stringify the object to send to my rest endpoint, the content stops after one of our custom fields:

is there a way that I can get the test_id?

Thanks!