cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Pass variables and role lists between change request and change notice

Dobrisa
13-Aquamarine

Pass variables and role lists between change request and change notice

I've been going thru the various posts here to try to find a solution to a question I have that seems like it should be simple to do (or at least obviously possible in the workflows). But I've been unsuccessful so far. 

We have a Change Request flow that classifies the type of change, defines the impact of the change (low, medium, high) and based on that impact selects an approver list. Those three pieces of data need to get passed to the Change Notice flow where they are used for notifications and other activities. 

 

I created a new attribute in the Change Request that is my classification attribute and I can pull that into the Change Request workflow to be used/consumed there using this bit code here. That works fine. What doesn't work is trying to pass that to the Change Notice flow. 

I came across this and tried creating an Alias attribute in the Change Notice. The mapping (theChangeOrder2@wt.change2.AddressedBy2~theChangeRequest2^wt.change2.WTChangeRequest2~myAttributeNameHere) doesn't actually map to my parameter. 

 

For passing my impact level string to the Change Notice would it be easiest to create another attribute in change notice and map it to the Change Request parameter? It seems like yes, but since that hasn't worked I'm interested in any other options. 

 

As far as passing a list of participants from Change Request to Change Notice, I've been playing around with this. The first issue I'm running into is that wt.org.WTPrincipalReference doesn't show up under Windchill classes for the variable. If i use other classes, I get a runtime error. What's the best way to approach this step? 

 

We're on 10.2 M030 for now with plans to move to Windchill 11 early next year. 

2 REPLIES 2
BenPerry
13-Aquamarine
(To:Dobrisa)

I am interested in the same.  It seems like a good case for alias attributes.  But I was getting an error when trying the alias attribute.

 

2017-12-12 06:16:17,150 ERROR [ajp-bio-8010-exec-2] com.ptc.core.lwc.client.forms.EditTypeDefinitionFormProcessor ben.perry - performUpdate failed.
com.ptc.core.meta.common.CorrectableException: Invalid value "theChangeOrder2@wt.change2.AddressedBy2~theChangeRequest2^wt.change2.WTChangeRequest2~myChangeRequestIBA" defined for property "mapping" of attribute "test1" of type "WCTYPE|wt.change2.WTChangeOrder2|softtypelevel2|softtypelevel3".

 

Note that:

  • The Change Request IBA is myChangeRequestIBA
  • The Change Request IBA is defined on the soft type - not on the OOTB type
  • The Change Notice alias attribute is test1
  • The Change Notice alias attribute is defined on the soft type
  • It works when I'm trying to map the number IBA from CR to CN

 

I would like to know why this is throwing error.

Dobrisa
13-Aquamarine
(To:BenPerry)

After some experimentation, I did get the alias attributes to work out ok. It's not ideal (since the data doesn't update until after the submission of the change notice) but I convinced myself that it's workable in current form. 

So basically what I've done is created 2 new attributes in the Change Request using the AddColumns utility (both string types). I set one of these (theClassification) when I create the CR and then pull the data from it into the workflow using this:

 

com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject(primaryBusinessObject,null,null,null);
obj.load("theClassification");
obj.load("ImpactLevel");
Object classVal = obj.get("theClassification");
Object impactVal = obj.get("ImpactLevel");

ChangeType = (String) classVal;
Impact = (String) impactVal;

 

The impact value is something that gets selected thru routing in the CR workflow. There are 3 levels. This is where the alias attributes came in handy. I set the value for the impact in a workflow activity and then again use the LWCNormalizedObject code to set the attribute value. 

 

com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject(primaryBusinessObject,null,null,null);
obj.load("ImpactLevel");
obj.set("ImpactLevel","L1");
obj.apply();
wt.fc.PersistenceHelper.manager.modify(primaryBusinessObject);

 

At the end of this step, I now have both the classification and the impact set in the CR workflow and then move into the Change Notice workflow. 

In the CN, I created 2 alias attributes. One points to the classification attribute and the other to the impact. 

Those look like this (and were both again set as String types):

 

theChangeOrder2@wt.change2.AddressedBy2~theChangeRequest2^wt.change2.WTChangeRequest2~theClassification

 

theChangeOrder2@wt.change2.AddressedBy2~theChangeRequest2^wt.change2.WTChangeRequest2~ImpactLevel

 

When I kick off the CN workflow, the attributes are unassigned (as they are supposed to be). Once the CN is created, the attributes populate correctly based on what was set in the CR. 

 

The thing that's a bit of a mistery now is that when I use the same code to pull in the soft attributes from the CN into the workflows... somehow, they don't come in. At least that's the case in the email robots. They do seem to work elsewhere since I'm using those attributes to drive some of the conditional items in the flows. 

 

Ben, are the data types the same between the attribute you're aliasing and the alias itself? And my appologies as I'm still brand new to Windchill administration so some of the lingo is foreign but when you say that your change request IBA is defined on the soft type and not the OOTB type do you mean that the CR IBA is defined in the Type and Attribute Management section? And OOTB definition would imply an attribute within the CR workflow level (either globally or within an activity)? 

Top Tags