How can I customize an odata service to start workflow in windchill?
Hi,
I need to trigger a windchill workflow from Thingworx. I think it's right way to expose this function through OData rest service in windchill.
The logic of WRS function is implemented by Javascript, which I don't understand and don't know where to find the document of API, I have no idea of how to implement my logic. Please help.
Below is sample code from Windchill Rest Service User Guide.
function function_GetCostlyParts(data, params) {
var ArrayList = Java.type('java.util.ArrayList');
var EntityCollection = Java.type('org.apache.olingo.commons.api.data.EntityCollection');
var parts = data.getProcessor().readEntitySetData(data);
var partEntityMap = data.getProcessor().toEntities(parts, data);
var partEntities = new ArrayList(partEntityMap.values());
var entityCollection = new EntityCollection();
for(var i = 0; i < partEntities.size(); i++) {
var partEntity = partEntities.get(i);
var partCostProperty = partEntity.getProperty('DevelopmentCost');
if(partCostProperty) {
var partCost = partCostProperty.getValue();
if(partCost && partCost > 0.10) {
entityCollection.getEntities().add(partEntity);
}
}
}
Thanks & Best Regards
Tom

