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

We are happy to announce the new Windchill Customization board! Learn more.

Email notification when needed

GregOlson
15-Moonstone

Email notification when needed

Our business unit director want to be emailed as part of a workflow but only when necessary.  Currently there is an email node that sends out an email to multiple users each time a document is created and run thru the workflow....is there a way to add a check box to the task page that when checked he would get an email, if not checked he would not get one?  Any other ideas on how to achieve this would be greatly appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Greg,

We actually have this setup in our CN workflow.  There are certain groups that only need to see certain CNs so we control it via attributes in the CN.  However, our users can update these while in the task and they will be pushed back to the CN when the task is done.  Here is the code that we use to gather the variables (we also put some of them in the body of the email), and the code to route it.  Here is a snapshot from our process.

6-17-2015 1-36-13 PM.jpg

Here is the code for the Variable gather for email under the Expression tab:

com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject (primaryBusinessObject,null,null,null);

obj.load("ULREQ","NMDD","TOOLINGREQ","AUXCODE","CNCODE","LITREQ","EFFECTIVEDATE1","MKTLITREQ");
Object cnULREQ=obj.get("ULREQ");
Object cnNMDD=obj.get("NMDD");
Object cnTOOL=obj.get("TOOLINGREQ");
Object cnAUX=obj.get("AUXCODE");
Object cnCNCODE=obj.get("CNCODE");
Object cnLITREQ=obj.get("LITREQ");
Object cnEFFDATE=obj.get("EFFECTIVEDATE1");
Object cnMKTLITREQ=obj.get("MKTLITREQ");

if (cnULREQ instanceof String){
CN_ULREQ = (String) cnULREQ;
}

if (cnMKTLITREQ instanceof String){
CN_MKTLITREQ = (String) cnMKTLITREQ;
}

if (cnNMDD instanceof String){
CN_NMDD = (String) cnNMDD;
}

if (cnTOOL instanceof String){
CN_TOOLINGREQ = (String) cnTOOL;
}

if (cnAUX instanceof String){
CN_AUXCODE = (String) cnAUX;
}

if (cnCNCODE instanceof String){
CN_CNCODE = (String) cnCNCODE;
}

if (cnLITREQ instanceof String){
CN_LITREQ = (String) cnLITREQ;
}

if (cnEFFDATE instanceof String){
CN_EFFECTIVEDATE = (String) cnEFFDATE;
}

Here is one of the OR routings:

if ("YES".equals(CN_ULREQ)){

result = "YES";

} else if ("yes".equals(CN_ULREQ)){

result = "YES";

} else {

result = "NO";

}

I forgot to add how to get the check box:

You need to add a Variable under Properties of the workflow that is Visible.

6-17-2015 1-52-07 PM.jpg

6-17-2015 1-52-47 PM.jpg

View solution in original post

4 REPLIES 4

Hello Greg,

We actually have this setup in our CN workflow.  There are certain groups that only need to see certain CNs so we control it via attributes in the CN.  However, our users can update these while in the task and they will be pushed back to the CN when the task is done.  Here is the code that we use to gather the variables (we also put some of them in the body of the email), and the code to route it.  Here is a snapshot from our process.

6-17-2015 1-36-13 PM.jpg

Here is the code for the Variable gather for email under the Expression tab:

com.ptc.core.lwc.server.LWCNormalizedObject obj = new com.ptc.core.lwc.server.LWCNormalizedObject (primaryBusinessObject,null,null,null);

obj.load("ULREQ","NMDD","TOOLINGREQ","AUXCODE","CNCODE","LITREQ","EFFECTIVEDATE1","MKTLITREQ");
Object cnULREQ=obj.get("ULREQ");
Object cnNMDD=obj.get("NMDD");
Object cnTOOL=obj.get("TOOLINGREQ");
Object cnAUX=obj.get("AUXCODE");
Object cnCNCODE=obj.get("CNCODE");
Object cnLITREQ=obj.get("LITREQ");
Object cnEFFDATE=obj.get("EFFECTIVEDATE1");
Object cnMKTLITREQ=obj.get("MKTLITREQ");

if (cnULREQ instanceof String){
CN_ULREQ = (String) cnULREQ;
}

if (cnMKTLITREQ instanceof String){
CN_MKTLITREQ = (String) cnMKTLITREQ;
}

if (cnNMDD instanceof String){
CN_NMDD = (String) cnNMDD;
}

if (cnTOOL instanceof String){
CN_TOOLINGREQ = (String) cnTOOL;
}

if (cnAUX instanceof String){
CN_AUXCODE = (String) cnAUX;
}

if (cnCNCODE instanceof String){
CN_CNCODE = (String) cnCNCODE;
}

if (cnLITREQ instanceof String){
CN_LITREQ = (String) cnLITREQ;
}

if (cnEFFDATE instanceof String){
CN_EFFECTIVEDATE = (String) cnEFFDATE;
}

Here is one of the OR routings:

if ("YES".equals(CN_ULREQ)){

result = "YES";

} else if ("yes".equals(CN_ULREQ)){

result = "YES";

} else {

result = "NO";

}

I forgot to add how to get the check box:

You need to add a Variable under Properties of the workflow that is Visible.

6-17-2015 1-52-07 PM.jpg

6-17-2015 1-52-47 PM.jpg

That's exactly what I was thinking...I setup a variable (boolean) on the task so there is a checkbox for the user to select...or not.  Now I need to figure out a true false code to enter into the conditional note to route it correctly.  Do you have any examples that I could easily modify to achieve this....not really a code guy and to get something out of PTC is like pulling teeth.

Thanks,

Greg

If I added the boolean variable at the task node...do I need to also add it at the properties level to get it to work at the conditional node?

It has been a while since I set this up and I had help.  It is my understanding that this needs to be in the properties to show on the task page and carry forward.  We have the attributes in the CN workflow.  We have also have the attributes in the Change Task workflow since that is where the users actually do their tasks.  In the Change Task the attributes have different names.  Since we need the attributes in the email or to route the email, we pass the attributes back and forth via the Complete Transitions of the different tasks depending on what the user is responsible for or can change.  That way the CN is always up to date with the task once a task is completed.

The code for Boolean would look like this:

if (BooleanVariable==true) result="True";

else result="False";

The code is different to pass the variable from the task to the notice:

com.ptc.core.lwc.server.LWCNormalizedObject obj=new com.ptc.core.lwc.server.LWCNormalizedObject(parentChangeOrder,null,null, new com.ptc.core.meta.common.UpdateOperationIdentifier());

obj.load("CNCODE");
obj.set("CNCODE", CT_CNCODE);
obj.apply();
wt.fc.PersistenceHelper.manager.modify(parentChangeOrder);

Top Tags