We just upgraded my environment from WC 12 to WC 13 and Thingworx Navigate from 9.3 to 9.7. We had some custom apps developed which do some number assignment. I am getting an error in some services and I think its because its not grabbing the instance based attribute we added to the Product Container. In my Windchill system, we have added an attribute called PID:
In Thingworx, there is a service that calls to get all the product container by PID which calls another service to get all the containers:
// result: JSON
var product = me.getProductContainers({
$filter: "PID eq '"+pid+"'" /* STRING */,
$select: undefined /* STRING */,
count: undefined /* BOOLEAN */
});
var result;
if (product.value[0]) {
result = product.value[0].ID;
}
Logs of another service show this:
Execution error in service script [GenerateNewDocumentNumbers] :: Your route exchange has failed. Service operation failed with status [ - The property 'PID', used in a query expression, is not defined in type 'PTC.DataAdmin.ProductContainer'.]
The resulting JSON elements show this (redacted)
"value": [
{
"LastModified": "2023-11-17T07:32:48-05:00",
"CreatedBy": "Antonio Villanueva",
"Description": "Program description",
"@odata.type": "#PTC.DataAdmin.ProductContainer",
"PrivateAccess": false,
"CreatedOn": "2004-06-30T09:35:30-04:00",
"ID": "OR:wt.pdmlink.PDMLinkProduct:922685",
"OrganizationID": {
"UniqueIdentifier": "XXXXX",
"CodingSystem": "CAGE Code"
},
"Name": "Program Name"
},
Noting there is no call out for the attributes which I assume why its complaining about PID not being found right?
Solved! Go to Solution.
I was able to get the answer from my sister company. We had work done by a VAR and this appears to be an undocumented customization that was missed in my source control. The codebase/rest/ptc/domain/DataAdmin/v5/entity/ProductContainers.json was modified to add two attributes. Chalk this up to the Ron Popeil error.
{
"name":"ProductContainer",
"collectionName":"ProductContainers",
"wcType":"wt.pdmlink.PDMLinkProduct",
"description":"This product extends Container entity",
"attributes":[
{
"name": "PID",
"internalName": "PID",
"type": "String"
},
{
"name": "PrimarySite",
"internalName": "Site",
"type": "String"
},
],
"parent":{
"name":"Containers"
},
"inherits":[
{
"name":"optionPoolable"
},
{
"name":"optionSetAssignable"
}
],
"navigations":[]
}
I'm sorry for asking, but are you sure you defined it on the Product directly, and not on one of subtypes?
Its defined on wt.pdmlink.PDMLinkProduct directly. I did come across this but it worked in our previous version so I am confused.
https://www.ptc.com/en/support/article/CS438785?source=search
Ah ok, seems like one of those cases when you need to contact Support...
Another naive idea -- maybe try to downgrade the API level? I see that you don't specify the version in your route, which means it takes the latest (I'm getting v7 on my 13.0.2). Try to specify v6 or older explicitly and see if that helps.
/ Constantine
Thanks, noting that on 12.0.2 it was v5 at that time.
I was able to turn on my test instance and confirm it was pulling IBA attributes:
"value": [
{
"LastModified": "2019-10-01T09:40:35-04:00",
"CreatedBy": "Antonio Villanueva",
"Description": "Program Description",
"@odata.type": "#PTC.DataAdmin.ProductContainer",
"PrivateAccess": false,
"PID": "X55",
"PrimarySite": "Town",
"CreatedOn": "2008-12-18T11:01:37-05:00",
"ID": "OR:wt.pdmlink.PDMLinkProduct:772214832",
"OrganizationID": {
"UniqueIdentifier": "XXXXX",
"CodingSystem": "CAGE Code"
},
"Name": "Program Name"
},
I will try to downgrade the version but is there any place I can see changes in this services from v5 to v7?
This will be a very junior question. I see this definition and the drop down of possible services:
I am unsure how to specify the v5 version.
Is it in the Configuration table?
This is what I have now. My assumption is that you would not be able to mix both right? I cannot call parts that are latest (v7) and others that specify v5 right? Can you provide an example?
Simple, Made change but alas, IBA values did not appear. Is it possible they while v5 might be the same, some underlying code was also changed to remove IBA retrieval? I might have to replace with my own service now.
I was able to get the answer from my sister company. We had work done by a VAR and this appears to be an undocumented customization that was missed in my source control. The codebase/rest/ptc/domain/DataAdmin/v5/entity/ProductContainers.json was modified to add two attributes. Chalk this up to the Ron Popeil error.
{
"name":"ProductContainer",
"collectionName":"ProductContainers",
"wcType":"wt.pdmlink.PDMLinkProduct",
"description":"This product extends Container entity",
"attributes":[
{
"name": "PID",
"internalName": "PID",
"type": "String"
},
{
"name": "PrimarySite",
"internalName": "Site",
"type": "String"
},
],
"parent":{
"name":"Containers"
},
"inherits":[
{
"name":"optionPoolable"
},
{
"name":"optionSetAssignable"
}
],
"navigations":[]
}