Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
I have a questions regarding setting documents attributes based on variables in a workflow. I have been able to pull the attributes of a document and set them as variables in a workflow, but was wondering if there is a way to do it in the opposite way? I am trying to alleviate some steps that my users would have to do by incorporating updates in a User's Task, as opposed to them having to go in and editing the documents attributes and then completing the task as a placeholder/reminder. I was wondering if I would be able to use a similar code as to what I used to set variables from attributes to accomplish this, but I don't know any of the code classes to accomplish this. Below is a copy of the code I used to pull information into the Workflow, I am hoping it's just a simple variation on this, since I understand what's going on in this code. Any help you guys can provide would be very beneficial.
wt.fc.QueryResult qr = null;
wt.doc.WTDocument RCIDFDoc=((wt.doc.WTDocument)primaryBusinessObject);
ext.generic.util.IBAUtil objHelper = new
ext.generic.util.IBAUtil(RCIDFDoc);
ApplicationNum=objHelper.getIBAValue("ApplicationNum");
BusinessCategory=objHelper.getIBAValue("BusinessCategory");
EstimatedNetSales=objHelper.getIBAValue("EstimatedNetSales");
FGNum=objHelper.getIBAValue("FGNum");
We recently did this for a customer, where we set the document and Change Notice attributes from workflow variables. So I know it is definitely possible. Unfortunately, I don't directly have access to this code.
One item to consider is that, every time you set the object attributes, Windchill creates an iteration to track the change. So you may not want to do this often if you are worried about creating lot of iterations.
Create a class UpdateDocument .
In workflow Expression Robot call the class .
It will work
The oly thing is the Document will get updated by user wcadmin .
I don't know if your ibautil handles checkout/checkin/save/etc, so I'll give you an example of setting a modeled WTDocument attribute.
In the "Complete" transition of your activity, add a call like:
try {
//you're not currently using self but it's a good idea to pass it. You'll never know when you're going to need it.
primaryBusinessObject = mypackage.UpdaterThingamajig.update(primaryBusinessObject,self,description);
} catch(Exception e) {
//up to you
}
//method for UpdaterThingamajig - public static WTObject update(WTObject primaryBusinessObject, ObjectReference self, String description) throws Exception {
}
Something like this should work