I need to make a new update for the Promotion request process.
After users submit WTParts to SAP, they draw their drawings, which causes confusion.
For this situation,
I defined an attribute called "DRWPART" in WTPart. When DRWPART value is selected as YES, we indicate that there is or will be found a DRW data belonging to WTPart.
I want to check codes with DRWPART value of YES.
When the DRW data is not added in the promotion of these codes, I want the user to be assigned a task and the process to proceed without adding the DRW data.
How can I control this?
Maybe through a validator? I haven't done this myself... but this could be helpful...
Hello @jbailey
thank you for your answer but that's not what I'm looking for.
I would like to make an edit for codes whose DRW data is not in windchill but will be drawn later.
Are you looking to have these tasks assigned via the Promotion Process? If so, just an conditional expression would work. You would examine the IBAs of the Parts on the request and if there is a part that has this DRWPART attribute set to YES, you can fire a task tot the designer. If not, no task is fired. You can have it as a branch task allowing the promotion process to continue if you like or keep it inline.
I would say that you are setting up a bit of a sync issue. Say for example, there is an error and they need a drawing regardless of what the WTPart says. Or someone creates a drawing and wants it linked to the WTPart. The flag on the WTPart is not a true indicator and overtime, the better indicated is the link between the drawing and the WTPart. I get that it shows intent in the workflow but its temporary in nature. I can see many ways that this will become a maintenance issue.
try {
wt.maturity.PromotionNotice pn = (wt.maturity.PromotionNotice) primaryBusinessObject;
wt.fc.QueryResult qr = wt.maturity.MaturityHelper.service.getBaselineItems(pn);
boolean drwExist = false;
while (qr.hasMoreElements()){
java.lang.Object object=(java.lang.Object)qr.nextElement();
if(object.getClass().isAssignableFrom(wt.part.WTPart.class)){
wt.part.WTPart doc=(wt.part.WTPart)object;
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(doc,null,java.util.Locale.getDefault(),new com.ptc.core.meta.common.UpdateOperationIdentifier());
obj.load("DRWPART");
String DRWPART = (java.lang.String) obj.get("DRWPART");
System.out.println("DRWPART String=-=-=" + DRWPART);
if (DRWPART.equals("YES")){
wt.epm.EPMDocument dc = (wt.epm.EPMDocument) object;
java.util.List<String> list = new java.util.ArrayList<>();
list.add(dc.getNumber());
if (dc.getDocType().toString().equals("CADDRAWING")) {
System.out.println("Belirtilen numarada bir çizim dosyası bulundu.");
for (int i = 0; i < list.size(); i++) {
System.out.println(i + ".part: " + list.get(i));
drwExist = true;
System.out.println("drwExist " + drwExist);}}
String sonc = String.valueOf(drwExist);
if (sonc.equals("true")) {
System.out.println("Islem Sonucu: " + sonc);
result = "Go";
} else {
System.out.println("Belirtilen numarada bir çizim dosyası bulunamadı.");
result = "Revize";
}}
else {
result = "Go";
}
}
}
} catch( Exception wte ){
wte.printStackTrace();
}
Hi @avillanueva ,
I created a code block like above, but when I add it to the stream, the process fails to start.
I don't know if I have an error in the code, I couldn't control it because it couldn't start the process.
What do you think might be the reason for the process not starting?