Remove Custom Property Value
This topic provides instructions on how to clear value for a custom string property on a component.
You will use the following query in this topic:
Type | Operation | Description |
---|---|---|
mutation | setProperties | Sets or Clears property value(s). |
query | component | Retrieves an object representing a component. |
Step 1 - Clear Property values for a Component
The setProperties mutation returns SetPropertiesPayload which is used to remove property value(s) from a component or its version.
- Enter the following query in the Query Pane of the Manufacturing Data Model Explorer.
Query
mutation ClearProperties($input: SetPropertiesInput!) { setProperties(input: $input) { targetId properties { value displayValue definition { name propertyBehavior } } } }
Show More - In the Query Variables Pane, enter the
targetId
,propertyDefinitionId
and also set the"shouldClear"
condition to"true"
.Note:
- The
targetId
can be the ID of any object on which you can attach properties, such as Components, Component versions, Drawing, and Drawing versions. For this tutorial, you will be attaching a property to a component, so you will need therootComponent ID
of the component as a value for extendable ID from Retrieve Items. - List of different object types work with different propertyBehaviors:
- The TIMELESS property behavior works with
Component
andDrawing
objects. - The DYNAMIC and DYNAMIC_AT_VERSION property behaviors work with ComponentVersion and DrawingVersion objects.
- The STANDARD property behavior works with tipComponentVersion and tipDrawingVersion objects.
- The TIMELESS property behavior works with
- If you set
shouldClear
totrue
, this condition will clear the property values.
Query Variables
{"input": { "targetId": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35OWXU4a2duSVdtNGNnUVd3MmljMFl0X2FnYQ", "propertyInputs": [ { "propertyDefinitionId": "cHJvcGRlZn5DZlhvYUM0SzUzU1R3YjZUbklyWFhaVEFJRWRkRzlBcn5DZlhvYUM0SzUzU1R3YjZUbklyWFhaVEFJRWRkRzlBcn5URVNUX0NQX0RPQ35wYXJhbWV0ZXJzLkNmWG9hQzRLNTNTVHdiNlRuSXJYWFpUQUlFZGRHOUFyOmY4Mzg3MjNiOGQ1MjRjMmFhMzZkNjg3MzU5OWI0YjVhLTEuMC4w", "shouldClear": true } ] } }
Show More - The
- Click Play. The response will remove the details of the properties that are deleted from the component version.
Response
{ "data": { "setProperties": { "targetId": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35OWXU4a2duSVdtNGNnUVd3MmljMFl0X2FnYQ", "properties": [ { "value": null, "displayValue": null, "definition": { "name": "ERP ID", "propertyBehavior": "TIMELESS" } } ] } } }
Show More
Step 2 - Validate if the Custom Property Value is Removed
You can use the component query to obtain a Component object that includes property details linked to the component or component version. This step will help you validate the list of properties that have been added.
- Enter the following query in the Query Pane of the Manufacturing Data Model Explorer.
Query
query GetComponentProperties($componentId: ID!) { component(componentId: $componentId) { id name customProperties { results { value displayValue name } } } }
Show More - In the Query Variables Pane, enter the
componentId
mentioned against thetipRootComponentVersion
field in Retrieve Items topic.Query Variables
{ "componentId": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35OWXU4a2duSVdtNGNnUVd3MmljMFl0X2FnYQ" }
- Click Play. The response will show the details of the properties removed to the component.
Response
{ "data": { "component": { "id": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35OWXU4a2duSVdtNGNnUVd3MmljMFl0X2FnYQ", "name": "Hydraulic_Bottle_Jack", "customProperties": { "results": [] } } } }
Show More