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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How i can send Attributes values of Problem report sent through Workflow email

vuchekar
10-Marble

How i can send Attributes values of Problem report sent through Workflow email

Hi All,

My requirement is, to send the list of attribute values related to that Problem report to users through Workflow message.

we are using OOTB problem report Workflow.

1. created variables  like name, category

2. add below code to expression robot in workflow,

wt.change2.WTChangeIssue thisPR = (wt.change2.WTChangeIssue) primaryBusinessObject;

java.util.Locale locale = wt.session.SessionHelper.getLocale();
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(thisPR,null,locale,null);
obj.load("name","number","description","Category");
Object nameValue = obj.get("name");
Object numberValue = obj.get("number");
Object descriptionValue = obj.get("description");
Object CategoryValue = obj.get("Category");

name = nameValue.toString();
number = numberValue.toString();
description = descriptionValue.toString();
category = CategoryValue.toString();

=======================

when i try to compile it, facing issue, as shown in image,

2015-12-24 2-12-24 PM.jpg

the mentioned class is not present at that location, but i think this is stranded class which comes with OOTB windchill installation.


here is my workflow, please check it let me help.

any kind of help will be grate.



6 REPLIES 6

try LWCNormalizedObject in same package (com.ptc.core.lwc.server).  PersistableAdapter replaced LWCNormalizedObject at some point (I think it may have been 10.2), and as far as I know they work the same way.

Hi All,

yes it is because windchill version. in Windchill 10.1 LWCNormalizedObject is used instead of PersistableAdapter.

i have corrected this,

but i am getting strange error,

when i added new variables to workflow, and checked in back to windchill.

when i want to checked out it again, its shows me one NOTICE pop up, after that it showing below errors, how i can tackle this.

=====

Malformed URL: "PROCESS TEMPLATE:

name = Custom Test Problem Report Workflow

description = Problem Report creation, analysis, and disposition.

category = CHANGE MANAGEMENT

context signature = [self, wt.fc.ObjectReference, false, false, false, false, LOCAL, null]

[primaryBusinessObject, wt.fc.WTObject, false, true, true, true, INOUT, null]

[reviewDate, java.sql.Timestamp, false, false, true, true, INOUT, null]

[submitDate, java.sql.Timestamp, false, false, true, true, INOUT, null]

[inInitialPhase, boolean, false, false, false, true, INOUT, true]

[CFURNACE, java.lang.String, false, true, true, true, INOUT, ]

[CCATEGORY, java.lang.String, false, true, true, true, INOUT, ]

[CDATE, java.lang.String, false, true, true, true, INOUT, ]

[CDAYSDOWN, java.lang.String, false, true, true, true, INOUT, ]

[CMITIGATION, java.lang.String, false, true, true, true, INOUT, ]

[name, java.lang.String, false, true, true, true, INOUT, ]

[number, java.lang.String, false, true, true, true, INOUT, ]

[category, java.lang.String, false, true, true, true, INOUT, ]

event configuration = 100010000000000000011111010101010

router type = NONE

duration = 0

process duration = 0

start delay = 0

start process delay = 0

responsible role = null

overdue notification list = [null]

user event list = [[]]". Format must be: "classname:idValue"

Nested exception is: java.lang.NumberFormatException: For input string: "

name = Custom Test Problem Report Workflow

description = Problem Report creation, analysis, and disposition.

category = CHANGE MANAGEMENT

context signature = [self, wt.fc.ObjectReference, false, false, false, false, LOCAL, null]

[primaryBusinessObject, wt.fc.WTObject, false, true, true, true, INOUT, null]

[reviewDate, java.sql.Timestamp, false, false, true, true, INOUT, null]

[submitDate, java.sql.Timestamp, false, false, true, true, INOUT, null]

[inInitialPhase, boolean, false, false, false, true, INOUT, true]

[CFURNACE, java.lang.String, false, true, true, true, INOUT, ]

[CCATEGORY, java.lang.String, false, true, true, true, INOUT, ]

[CDATE, java.lang.String, false, true, true, true, INOUT, ]

[CDAYSDOWN, java.lang.String, false, true, true, true, INOUT, ]

[CMITIGATION, java.lang.String, false, true, true, true, INOUT, ]

[name, java.lang.String, false, true, true, true, INOUT, ]

[number, java.lang.String, false, true, true, true, INOUT, ]

[category, java.lang.String, false, true, true, true, INOUT, ]

event configuration = 100010000000000000011111010101010

router type = NONE

duration = 0

process duration = 0

start delay = 0

start process delay = 0

responsible role = null

overdue notification list = [null]

user event list = [[]]"

====

====

(wt.vc.wip.wipResource/4) wt.vc.wip.WorkInProgressException: Test 2812 Problem Report Workflow has no working copy. It must be checked out for a working copy to exist.

    at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:795)

    at wt.services.ServiceFactory$ClientInvocationHandler.invoke(ServiceFactory.java:349)

    at com.sun.proxy.$Proxy14.workingCopyOf(Unknown Source)

    at wt.clients.workflow.definer.WfTemplateEditorApplet$UpdateThread.run(WfTemplateEditorApplet.java:295)

===

BineshKumar1
13-Aquamarine
(To:vuchekar)

the last time I faced a similar error, I had to export the workflow, edit the xml to checked in state and import it back to fix this error. It is worth a try

Thank you

Binesh Kumar

doehr
12-Amethyst
(To:vuchekar)

Hi there,

I actually overhauled all of our change processes to do this for key attributes on every workflow task, at the request of the users . Follow this process for each workflow task you want to do this to:

  1. In the user task, go to the Variables tab and create a variable for each and every attribute you want to add to the message.
  2. In the Transitions tab go to Start, and in there add code that will set values to those attributes you made in step 1 the very instant the task is started, so they will be ready for the system email.

Note that these are local variables that will only exist within that task.

Some of the OOTB attributes for change objects, such as Name and Description, already have simpler pre-built functions for getting their values. For example, if you want to get the Name of a Change Notice you would put in the line

yourvariable = ((wt.change2.WtChangeOrder2)primaryBusinessObject).getName()

The Description field is very similar, just replace getName() with getDescription() above.

getName() and getDescription() work for quite a number of objects in the system, just switch wt.change2.WtChangeOrder2 for the object type in question.

For custom (a.k.a. Global) attributes or others that you don't really know if they have a custom function or not, there is a code segment that should let you get any attribute on it.

com.ptc.core.lwc.server.LWCNormalizedObject obj = new

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

obj.load("theAttribute");

Object softAttribValue = obj.get("theAttribute");

if (softAttribValue instanceof String) {

yourvariable = (String) softAttribValue;

}

yourvariable is the variable you defined in step 1 to hold the value, and theAttribute is the internal system name (NOT the Display Name) of the attribute itself.

And, finally,

     3. The Instructions section in the Activity tab is the actual body of your message. You use {yourvariable} to set the value of one of your variables in the message.

Hope that helps.

Swapnil4
7-Bedrock
(To:doehr)

Not Really Works this is

LoriSood
22-Sapphire III
(To:vuchekar)

Vivek, Were the suggestions provided here helpful in moving you along with this issue? Do you have any follow-up questions?

Announcements


Top Tags