Request

Response

    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 operations in this topic:

    TypeOperationDescription
    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.

    1. 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
            }
         }
      }
      
      Show More
    2. 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 Component and Drawing object. In this tutorial, you will be attaching a property to a component, so you will need the component ID. To know how to obtain the component ID, refer to Retrieve Items.
      • Note that different object types work with different propertyBehaviors.

        • The TIMELESS property behavior works with Component and Drawing objects.
        • The STANDARD property behavior works with Component and Drawing objects.

      Query Variables

      {
         "input": {
            "targetId" : "cHJvZHVjdH53TTBJUmZ2ZzNPVUtMdmxiMnh0Mkx0X0wyQ35aaFFydzlvREt1OGtpRUs0b1Q1UENIX2FnYQ",
            "propertyInputs": [
               {
                  "propertyDefinitionId" : "cHJvcGRlZn5BQ040RXZkSExNVFppdzduZmtIVXBQanNBNFZmWmFuVH5BQ040RXZkSExNVFppdzduZmtIVXBQanNBNFZmWmFuVH5wcm9wX2RlZl9jb2xfMTc0NjE4ODM3NDgzMH5wYXJhbWV0ZXJzLkFDTjRFdmRITE1UWml3N25ma0hVcFBqc0E0VmZaYW5UOmM2NDRjZjBjMjJhOTQ5YzRiMTYwYzc1NGJkMmQwYWFmLTEuMC4w"
               }
            ]
         }
      }
      
      Show More

    1. Click Play. The response will remove the details of the properties that are deleted from the component version.

      Response

      {
         "data": {
            "setProperties": {
               "targetId": "cHJvZHVjdH53TTBJUmZ2ZzNPVUtMdmxiMnh0Mkx0X0wyQ35aaFFydzlvREt1OGtpRUs0b1Q1UENIX2FnYQ",
               "properties": [
                  {
                     "value": null
                  }
               ]
            }
         }
      }
      
      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.

    1. 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
    2. In the Query Variables Pane, enter the componentId mentioned against the tipRootComponentVersion field in Retrieve Items topic.

      Query Variables

      {
         "componentId": "Y29tcH5WQVZNUW1sYmxrZDBtaXJwU0NYMHJ0X0wyQ35OWXU4a2duSVdtNGNnUVd3MmljMFl0X2FnYQ"
      }
      

    1. 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