Page 1 of 1

Invalid custom field "custom_field" on valid custom field

Posted: 07 Mar 2024, 20:46
by acoder2020
I'm getting this error suddenly:

Code: Select all

Bad request (HTTP Code 400). Check your JSON data:
Response:

{"message":"Invalid custom field 'affects_security' value.","code":1303,"localized":"Invalid value for field \"affects_security\"."}
Here's the JSON snippet:

Code: Select all

	$custom_affects_security = '1';
	$custom_trac_ticket_id = '1234';

...

	    'custom_fields' => [
	        [
	            'field' => ['id' => 1],  // ID of the custom field for trac_ticket_id
	            'value' => $custom_trac_ticket_id
	        ],
	        [
	            'field' => ['id' => 2],  // ID of the custom field for affects_security
	            'value' => $custom_affects_security
	        ]
	    ],
What could be causing this?

Re: Invalid custom field "custom_field" on valid custom field

Posted: 07 Mar 2024, 22:13
by atrol
Hard to tell something without knowing the definition of "affects_security".
Does it work if you don't set "affects_security"?

Re: Invalid custom field "custom_field" on valid custom field

Posted: 12 Mar 2024, 14:40
by acoder2020
Got it sorted, I had a bug where my dates were being converted twice :oops:

Custom fields are being added perfectly now.