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

Custom fields not updating using API

I am trying to update a custom field of one test case using the below code:

TestCaseParamBuilder.Builder testCaseParamBuilder = new TestCaseParamBuilder.Builder(testCase.getTitle());
testCaseParamBuilder.setCustomFields(testCase.getCustomFields());
testCaseParamBuilder.updateCustomField("validity", "3");
TestCaseParamBuilder testCaseParamBuilderobj = testCaseParamBuilder.build();
Case testCase = this.getTestRailClient().updateTestCase(testCase.getId(), testCaseParamBuilderobj);

But the test case is not updated.

Test case data : Case [id=1434, title=Verify the Existing customer “sign in” link from the Landing page with existing account credentials, section_id=102, suite_id=6, type_id=2, priority_id=1, refs=null, estimate=null, customFields={automated=1, epicusrelated=None, preconds=null, runninginpipeline=2, qaapproved=1, description=null, steps_separated=[{“content”:“Navigate to https://freight-preprod-iad.iad.proxy.amazon.com/shippers",“expected”:"User should be taken to the R4S public Landing page”},{“content”:“Click on the Existing customer “Sign in” link from the landing page”,“expected”:“User should be taken to sign in page”},{“content”:“Sign in with existing account credentials”,“expected”:“1. User should be signed in successfully \n2. Quotes page should be displayed”}], manual_excecution_time=null, validity=1, approvedbyqa=null, automationreason=null}]

In this data, you can clearly see that the test case has “validity” custom field

Hi @zmnoj I’m not familiar with TestCaseParamBuilder but could you check what the updateCustomField does? Maybe the field name is supposed to be changed to custom_validity ? You should know for sure by hitting the get_case_fields endpoint and seeing what the system_name value is, or go into TestRail Admin and check customizations there.

Another option would to evaluate the raw json that is returned from get_case/1434 via curl or other rest client like postman or paw.