Updating the Common Attributes of Department Data
You can update the common attributes Category, SupplyChain, and Location of single or multiple Department Data objects by providing the OIDs of the existing objects in the body of the request. You can specify the OID of any iteration/revision/view of the Department Data object or its subtype in the body of the request. You can choose to update either all or any of the three common attributes of a Department Data object. To update its common attributes, you must have Modify permissions to the Department Data object or its subtype.
To update a common attribute, you must specify the value with its valid internal name. If a constraint is applied to the attribute, you must specify the internal name of the value specified in the constraint.
If you want to clear the value of a common attribute, you can specify its value as null in the request.
If you do not specify a common attribute in the request body, then the attribute retains its existing value.
|
• You cannot update the common attributes of a Department Data object, if the specified object is checked out.
• If two or more Department Data objects belong to the same Plant Data and are of the same type, then their common attribute values must be different.
• If you specify an invalid object or an object other than a Department Data object or its subtype (for example, a Part object), then the request fails and returns an error.
• You cannot update the common attributes Name and Number.
|
Example: Updating All Common Attributes of a Department Data Object
This example shows you how to update all common attributes of a Department Data object specified in the request. In this example, the request updates the Category, SupplyChain, and Location attributes for a Department Data object specified in the request. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/UpdateCommonPropertiesForDepartmentDatas
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"DepartmentData": [
{
"ID": "OR:com.ptc.windchill.enterprise.data.PlantFunctionalData:218219",
"Category": "process",
"SupplyChain": "002",
"Location": "002"
}
]
}
Example: Updating All Common Attributes of Multiple Department Data Objects
This example shows you how to update all common attributes for each Department Data object specified in the request. In this example, the request updates the Category, SupplyChain, and Location attributes for each of the two Department Data objects specified in the request. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/UpdateCommonPropertiesForDepartmentDatas
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"DepartmentData": [
{
"ID": "OR:com.ptc.windchill.enterprise.data.PlantFunctionalData:218219",
"Category": "process",
"SupplyChain": "001",
"Location": "001"
},
{
"ID": "OR:com.ptc.windchill.enterprise.data.PlantFunctionalData:218220",
"Category": "procurement",
"SupplyChain": "003",
"Location": "003"
}
]
}
Example: Clearing the Values of Common Attributes
This example shows you how to clear the values of the desired common attributes for the Department Data objects specified in the request. In this example, the request clears the value of the Location attribute for the first Department Data object while it clears the value of the SupplyChain attribute for the second Department Data object specified in the request. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/UpdateCommonPropertiesForDepartmentDatas
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"DepartmentData": [
{
"ID": "OR:com.ptc.windchill.enterprise.data.PlantFunctionalData:218219",
"Category": "process",
"SupplyChain": "001",
"Location": null
},
{
"ID": "OR:com.ptc.windchill.enterprise.data.PlantFunctionalData:218220",
"Category": "procurement",
"SupplyChain": null,
"Location": "003"
}
]
}
Example: Retaining the Values of Common Attributes
This example shows you how to retain the existing values of the desired common attributes for the Department Data objects specified in the request. In this example, the request retains the values of the SupplyChain attribute, as it is not specified for both the Department Data objects in the request body. Use the following POST URI with the request body.
URI
POST /Windchill/servlet/odata/BomTransformation/UpdateCommonPropertiesForDepartmentDatas
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Request Body
{
"DepartmentData": [
{
"ID": "OR:com.ptc.windchill.enterprise.data.PlantFunctionalData:218219",
"Category": "process",
"Location": null
},
{
"ID": "OR:com.ptc.windchill.enterprise.data.PlantFunctionalData:218220",
"Category": "procurement",
"Location": "002"
}
]
}