Updating a value from a non-required Assets object attribute shows "At least one value must be set"
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
When setting up an Assets Schema, if some attributes are configured with a Cardinality of at least 1 while others are set to zero, it may result in a confusing error when attempting to update a non-required attribute.
How to replicate
Have an object created with some attributes. For this test, 3 of them ('one', 'two' 'three') as text type.
Have the 'one' attribute empty, and fill 'two' and 'three' with some value.
Update the object type and set 'one' as required (cardinality minimum value is set to 1).
Try to update the object that was previously created. Remove the values of 'two' and 'three'.
How to identify the required attribute
In this example, we used three attributes. However, objects typically possess numerous attributes, making individual checking challenging.
To easily identify the required attribute(s), you can use the Developer tools on your browser.
Access one of the affected objects.
Opening the Developer tools, go to the Network tab and click on to remove unnecessary logs.
Replicate the issue by trying to remove the value of a non-required attribute.
Click on the error log (like the example below) which will show on the headers the following error:
Request Method: DELETE Status Code: 400 Bad Request
On the Response tab, it will show one or more required attributes that are causing the issue.
Solution
After obtaining the ID from the Response tab, locate it in order to configure its Cardinality or add a value before editing a non-required attribute; this sequence allows for subsequent edits on other non-required attributes.
References
- - JSDCLOUD-12711Getting issue details... STATUS
- Set the cardinality of an attribute