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

Make the 'Milestone' field to be required in the Test Run/Test Plan?

Hi Guys! Can someone help me on this please…How do we make the ‘Milestone’ from the Test Run/Test Plan be tagged as a required field?
Appreciate response on this. TIA! :slight_smile:

Hi Maria,

Thanks for the post! You would likely be able to implement a UI Script for this, and many other teams utilize UI scripts for various customizations such as this. We don’t have an example script for this specific request, however you can likely find a similar script on our forums and use one as a starting point. Here is one example of a similar script:

Hope this helps,
Jon

Hi @jon.reynolds …thanks for this! I was able to add that UI Script in testrail as below:

name: Require Milestone Field in Test Runs
author: Gurock Software
version: 1.0
includes: ^plans/(add|edit)
excludes:

js:
(document).ready( function() { (’#milestone_id’).prev().append(’ *’)
(‘form’).submit( function() { App.Validation.hideErrors(); if (.trim((’#milestone_id’).val()) == ‘’) { (’#content-inner’).prepend(‘

Field Milestone is a required field.
’);
(’#milestone_id’).addClass(‘form-control-error’); setTimeout( function() { (’#accept’).show();
$(’#acceptDisabled’).hide();
},
0
);
return false;
}
}
);
}
);

but after saving it gave me a message under the Statuses Section (inside the Customizations) telling me to ‘Please edit an existing, inactive status to add a new status to your installation.’ (I do not have any inactive status so I don’t know what to do next for the changes to take effect. Pls. let me know. Thanks again!

Hi Maria,

This error message may indicate a different UI script is affecting your Customizations page. Can you review your existing UI scripts and ensure these UI scripts do not modify the administration area? This can be done with the following line:

excludes: ^admin

You may also be able to find additional details inside your browser’s console log.

If this doesn’t resolve the issue, can you send us an email to contact@gurock.com with a screenshot of the error message and the details from your browser’s console log?

Thanks,
Jon

The below script worked for me…in making the ‘Milestone’ filed required under the Test Plan/Test Run

name: Require Milestone Field in Test Plans
author: Gurock Software
version: 1.0
includes: ^plans/(add|edit)
excludes:

js:
$(document).ready( function()
{
document.getElementById(“milestone_id”).required = true;
document.getElementById(“milestone_id”).previousElementSibling.innerHTML += ‘<span style=“color:red”> *’;
}
);

Thanks for your help @jon.reynolds!

1 Like