Skip to main content
1-Visitor
June 17, 2015
Question

Workflow Activity Routing based on Attribute

  • June 17, 2015
  • 7 replies
  • 2487 views

Hi, I have to decide my workflow path depending on an attribute type, which is having a list of values, Each value will take a separate workflow after choosing it.

I am tried to execute the below code but some how not succesful.

For Routing Two options succesfully executed, while i am using the values in place of String_value its not working.

Soft Attribute Name = CustomerGroup, Dropdown values are HERO/FORD.

if (primaryBusinessObject != null)

{

try

{

com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null, java.util.Locale.US, new com.ptc.core.meta.common.DisplayOperationIdentifier());

obj.load("CustomerGroup");

java.lang.String string_value = (java.lang.String) obj.get("CustomerGroup");

System.out.println("Soft attibute value : " + string_value);

if ( string_value == "HERO" )

{

result = "Route1";

}

else

if( string_value == "FORD" )

{

result="Route3";

}

else

result="Route2";

}

catch ( Exception e )

{

e.printStackTrace();

}

},

Below code executed succesfully,

Soft Attribute Name = CustomerGroup, Dropdown values are HERO/FORD.

if (primaryBusinessObject != null)

{

try

{

com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null, java.util.Locale.US, new com.ptc.core.meta.common.DisplayOperationIdentifier());

obj.load("CustomerGroup");

java.lang.String string_value = (java.lang.String) obj.get("CustomerGroup");

System.out.println("Soft attibute value : " + string_value);

if ( string_value !=null)

{

result = "Route1";

}

else

result="Route2";

}

catch ( Exception e )

{

e.printStackTrace();

}

}

Thanks in advance.

7 replies

1-Visitor
June 17, 2015

Try .equals() or equalsIgnoreCase()  to compare the values to String values and check if it helps.

string_value.equals("FORD"); string_value.equalsIgnoreCase("FORD");

Thanks

Shreyas

1-Visitor
June 17, 2015

Hi Sheyas,

Thanks for your reply, Its giving syntax error.

Thanks.

1-Visitor
June 17, 2015

Can you share what syntax error your getting ??

Thanks,

Shreyas