Functions Available in the PTC Common Domain
The following functions are available in the PTC Common domain:
GetEnumTypeConstraint()
The function GetEnumTypeConstraint() is used to query the valid values for a property, which are represented as EnumType. These values are used for implementing validations on client side.
GetCSRFToken()
The function GetCSRFToken() is used to get the value of the nonce token that is used while creating, updating, or deleting entities in the system.
GetJWTFormRendererUrl()
The unbound function GetJWTFormRendererUrl() returns the URL to the e-signature page for tasks that require re-authentication.
For more information on requiring electronic signatures on workflow activities in Windchill, refer to the
Windchill Help Center.
GetAllStates()
The function GetAllStates() returns a list of life cycle states, which are available and can be selected in Windchill. The life cycle states that cannot be selected in Windchill are not returned. The life cycle states are retrieved from the StateRb.rbinfo file.
GetAllStates() is an unbound function, which is available in all the domains which import the PTC Common domain.
If the URL used to execute the function is not formed correctly, the function throws the URL malformed exception.
GetWindchillMetaInfo()
The GetWindchillMetaInfo() function returns the localized display names of service metadata for OData entities, structural, navigation and complex type properties that are available in the domain from which the function is called. The function is available to all domains that import the PTC Common domain.
There are a few variations of this function. They return a single complex type PTC.EntityMetaInfo, or an array of PTC.EntityMetaInfo. The function returns structural, navigation, and complex type properties.
A boolean property named IsEntityTypeComplex in the EntityMetaInfo is set to a value of true for complex type result items.
Note the following points when using the GetWindchillMetaInfo() functions:
• For entity types that are backed by a Windchill type, the function returns the display and internal names of the entity.
• For entity types that are not backed by a Windchill type, the function returns the display and internal names of the entity as null.
• For properties that are available on the OData entity, but are not available in Windchill, the function returns the value of display name as null.
For example, consider the VersionID property which is available on many OData entities. For this property, there is no equivalent property in Windchill. In this case, the function returns the display name as null.
• Depending on the language that you set in the request header, the function returns internal names and localized display names for Windchill types and properties.
For example, if you call the function from the PTC Principal Management domain, the response is as follows:
URI
GET /Windchill/servlet/odata/PrincipalMgmt/GetWindchillMetaInfo() HTTP/1.1
Request Header:
Accept-Language: en-US
The response is:
{
"@odata.context": "https://windchill.ptc.com/Windchill/servlet/odata/v3/PTC/$metadata#Collection(PTC.EntityMetaInfo)",
"value": [
...
{
"EntityType": "PTC.PrincipalMgmt.Group",
"BaseType": "PTC.PrincipalMgmt.Principal",
"HasWindchillType": true,
"DisplayName": "Group",
"InternalName": "wt.org.WTGroup",
"PropertyInfo": [
{
"PropertyName": "Description",
"DisplayName": "Description",
"InternalName": "description"
},
{
"PropertyName": "DomainName",
"DisplayName": "Name",
"InternalName": "administrativeDomainName"
}
],
"NavigationPropertyInfo": [
{
"PropertyName": "Users",
"DisplayName": "Members"
}
]
}
...
]
}
GetWindchillMetaInfo is overloaded by parameter as follows:
• To get the metadata display names for all the entities in the domain from which the function is called, specify the following URL:
GET <Domain_Name>/GetWindchillMetaInfo()
For example to get display names for the PTC Product Management domain entities, use the following URL:
GET ProdMgmt/GetWindchillMetaInfo()
• To get the metadata display names for a specific entity in the domain from which the function is called, specify the following URL:
GET <Domain_Name>/GetWindchillMetaInfo(EntityName='<name_of_the_entity>')
For example, to get display names for the Part entity, use the following URL:
GET ProdMgmt/GetWindchillMetaInfo(EntityName='PTC.ProdMgmt.Part')
• To get the metadata display names for an entity and its inherited properties from the parent entity, specify the following URL:
GET <Domain_Name>/GetWindchillMetaInfo(EntityName='<name_of_the_entity>', IncludeAncestorProperty=true)
For example, to get display names for the ElectricalPart entity and its inherited properties, use the following URL:
GET ProdMgmt/GetWindchillMetaInfo(EntityName='PTC.ProdMgmt.ElectricalPart', IncludeAncestorProperty=true)
The response shows the structural and navigation properties for the entity PTC.ProdMgmt.ElectricalPart as well as properties that are inherited from the parent entity PTC.ProdMgmt.Part.
If the value of IncludeAncestorProperty is set to false, GetWindchillMetaInfo does not return structural and navigation properties inherited from the parent entity PTC.ProdMgmt.Part.
Request URL is as follows:
GET /Windchill/servlet/odata/ProdMgmt/GetWindchillMetaInfo(EntityName='PTC.ProdMgmt.ElectricalPart',IncludeAncestorProperty=false)