Skip to main content
16-Pearl
February 13, 2026
Solved

Promotion Request by object type

  • February 13, 2026
  • 1 reply
  • 94 views

I have a Promotion request that uses a conditional Router to route depending on object type. 

I have used the one from the KB that works well, 

shown below. 

 

try

{

    wt.fc.QueryResult qr = wt.maturity.MaturityHelper.service.getPromotionTargets((wt.maturity.PromotionNotice)primaryBusinessObject);

    while(qr.hasMoreElements())

    {

        wt.fc.Persistable pers = (wt.fc.Persistable) qr.nextElement();

        if (pers.getClass().getName().equalsIgnoreCase("wt.doc.WTDocument"))

        {

            System.out.println(" ******** It is a WTDocument  ******** ");

            result = "route1";

        }

        else if (pers.getClass().getName().equalsIgnoreCase("wt.part.WTPart"))

        {

            System.out.println(" ******** It is a WTPart ******** ");

            result = "route2";

        } 

        else

        {

            System.out.println(" ******** It is neither WTDocument nor WTPart ******** ");

            System.out.println(" ******** Routing to default Document path  ******** ");

            result = "route1";

        }

    }

}

catch (Exception e) {

}

 

 

The problem that i have is that i want to route for a specific document subtype.
Lets say its com.ptc.General
replacing wt.doc.WTDocument with com.ptc.General or wt.doc.WTDocument|com.ptc.General doesent seem to work.
Are there any java gurus out there that can help?

Best answer by TDT

Hi @BryanK,

After verifying that the object instance is of type WTDocument, you should implement your logic by checking the specific subtype of the WTDocument.

 

if (pers.getClass().getName().equalsIgnoreCase("wt.doc.WTDocument"))
					{
						System.out.println(" ******** It is a WTDocument ******** ");
						if (TypedUtilityServiceHelper.service.getTypeIdentifier(pers).toString()
								.equals("WCTYPE|wt.doc.WTDocument|com.ptc.General")) {
							System.out.println(" ******** It is a General Document ******** ");
							result = "route1";
						} else {
							result = "route3";
						}
					}

 

1 reply

TDT16-PearlAnswer
16-Pearl
February 13, 2026

Hi @BryanK,

After verifying that the object instance is of type WTDocument, you should implement your logic by checking the specific subtype of the WTDocument.

 

if (pers.getClass().getName().equalsIgnoreCase("wt.doc.WTDocument"))
					{
						System.out.println(" ******** It is a WTDocument ******** ");
						if (TypedUtilityServiceHelper.service.getTypeIdentifier(pers).toString()
								.equals("WCTYPE|wt.doc.WTDocument|com.ptc.General")) {
							System.out.println(" ******** It is a General Document ******** ");
							result = "route1";
						} else {
							result = "route3";
						}
					}

 

avillanueva
23-Emerald I
23-Emerald I
February 13, 2026

@TDT , nice work. @BryanK , best practice for code in workflows is to externalize this in a custom class. You can have some code like passing in the PromotionNotice. This is important since if you find a bug or it throws can exception, the running workflows cannot be updated. They would have to be terminated and restarted. You might also think about creating a lookup file to map types to routes so that code does not need to change if you decide to change routes or support new types. 

BryanK16-PearlAuthor
16-Pearl
February 15, 2026

Hi,

This is valuable input, at the moment I'm doing a proof of concept to check that the logic will work, still need to work with the team to see if this will work for them, if it does we will look to create it more "robust and configurable"

Cheers,

B