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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to get a variable dropdown list in wf task page?

kchaithanya
8-Gravel

How to get a variable dropdown list in wf task page?

How to get a variable dropdown list(Attributes like Plant location, some attributes) inside workflow task page? further to it, based on selected attribute value it should route to respective users.

Does it requires to customize the Work flow JSP template?, if yes kindly provide the code and source code location(path).

8 REPLIES 8
BhushanNehe
14-Alexandrite
(To:kchaithanya)

Hi Krishna,

A preferred way would be to create a custom enumerated class and defining your values in an RBinfo file. And when you create a variable in workflow, select type as “Other Class…”, and input the customized class.

e.g:

  • Class file:

package ext;

import com.ptc.windchill.annotations.metadata.GenAsEnumeratedType;

@GenAsEnumeratedType

public class MyEnumeration extends _MyEnumeration {

  /**

  * Enumerated class file for code enumeration.

  * Refer corresponding RBInfo file for the changes

  */

  private static final long serialVersionUID = 1L;

}

  • RbInfo file

ResourceInfo.class=wt.tools.resource.EnumResourceInfo

FirstChoice.value=FirstChoice

FirstChoice.order=10

SecondChoice.value=SecondChoice

SecondChoice.order=20

Example is for Windchill 10.x. This may require Info* Modeler. Let me know if this information was helpful


Regards,

Bhushan

Hi Bhushan,

Thanks for your reply,

Can we achieve the same in Windchill 9.1M070?.

How to Fetch these Enumarated values to WT Document.

Kindly suggest.

Thanks

Krishna

BhushanNehe
14-Alexandrite
(To:kchaithanya)

Hi Krishna,

9.1 has a separate procedure of creating enumerated class, customization guide talks about it. If you want to update these values to WTDocument attributes, in 9.1 Info* Engine task can be used.

Regards,

Bhushan

Hi Bhushan,

I tried compiling the class. it is showing error: require information Modeler to compile..

Is there any other way to create enumeration list in wf task page.?

is there any option to use global enumeration list in the wf task??

Regards,

Logeshwar.J

ITC Infotech India Ltd

logeshwar.jeyachandran@itcinfotech.com

Bhushan Nehe

Hi Bhushan,

As mentioned i created a custom enumerated type java (_MyEnumeration). i could compile the file.

class files are also getting created but when i try the Resourcebuild.sh command. output mesage: Build successful. but it is not creating RB.ser file in codebase directory.

RejectReason.java

package ext.pricol.workflow.dropdown;

public class RejectReason extends _RejectReason{

    /**

  *

  */

  private static final long serialVersionUID = 1L;

  public static final RejectReason Price_Competency = RejectReason.toRejectReason("PriceCompetency");

  public static final RejectReason Project_dropped_by_Customer = RejectReason.toRejectReason("ProjectdroppedbyCustomer");

  public static final RejectReason Delay_in_Quote_submission = RejectReason.toRejectReason("DelayinQuotesubmission");

  public static final RejectReason Project_Commercially_unviable = RejectReason.toRejectReason("ProjectCommerciallyunviable");

  public static final RejectReason Project_Technically_unviable = RejectReason.toRejectReason("ProjectTechnicallyunviable");

  public static final RejectReason Customer_Project_postponement = RejectReason.toRejectReason("CustomerProjectpostponement");

    protected RejectReason() {

    }

    

}

_RejectReason.java

package ext.pricol.workflow.dropdown;

import java.lang.reflect.Method;

import java.util.Hashtable;

import java.util.Locale;

import wt.fc.EnumeratedType;

import ext.pricol.workflow.dropdown.RejectReason;

import wt.util.WTInvalidParameterException;

public abstract class _RejectReason

extends EnumeratedType {

    static final long serialVersionUID = 1;

    static final String RESOURCE = "wt.part.partResource";

    static final String CLASSNAME = new RejectReason().getClass().getName();

    static final String CLASS_RESOURCE = "ext.pricol.workflow.dropdown.RejectReasonRB";

    static Hashtable localeSets;

    private static volatile EnumeratedType[] valueSet;

    /*

     * WARNING - Removed try catching itself - possible behaviour change.

     * Enabled force condition propagation

     * Lifted jumps to return sites

     */

    static EnumeratedType[] _valueSet() {

        if (valueSet != null) return valueSet;

        Class<_RejectReason> class_ = _RejectReason.class;

        synchronized (_RejectReason.class) {

            try {

                if (valueSet != null) return valueSet;

                {

                    valueSet = _RejectReason.initializeLocaleSet(null);

                }

            }

            catch (Throwable var1_1) {

                throw new ExceptionInInitializerError(var1_1);

            }

            return valueSet;

        }

    }

    public static RejectReason newRejectReason(int n) throws IllegalAccessException {

        _RejectReason.validateFriendship((int)n);

        return new RejectReason();

    }

    public static RejectReason toRejectReason(String string) throws WTInvalidParameterException {

        return (RejectReason)_RejectReason.toEnumeratedType((String)string, (EnumeratedType[])_RejectReason._valueSet());

    }

    public static RejectReason getRejectReasonDefault() {

        return (RejectReason)_RejectReason.defaultEnumeratedType((EnumeratedType[])_RejectReason._valueSet());

    }

    public static RejectReason[] getRejectReasonSet() {

    RejectReason[] arrpartType = new RejectReason[_RejectReason._valueSet().length];

        System.arraycopy(valueSet, 0, arrpartType, 0, valueSet.length);

        return arrpartType;

    }

    public EnumeratedType[] getValueSet() {

        return _RejectReason.getRejectReasonSet();

    }

    protected EnumeratedType[] valueSet() {

        return _RejectReason._valueSet();

    }

    protected EnumeratedType[] getLocaleSet(Locale locale) {

        EnumeratedType[] arrenumeratedType = null;

        if (localeSets == null) {

            localeSets = new Hashtable();

        } else {

            arrenumeratedType = (EnumeratedType[])localeSets.get(locale);

        }

        if (arrenumeratedType == null) {

            try {

                arrenumeratedType = _RejectReason.initializeLocaleSet(locale);

            }

            catch (Throwable var3_3) {

                // empty catch block

            }

            localeSets.put(locale, arrenumeratedType);

        }

        return arrenumeratedType;

    }

    static EnumeratedType[] initializeLocaleSet(Locale locale) throws Throwable {

        return _RejectReason.instantiateSet((Method)RejectReason.class.getMethod("newRejectReason", Integer.TYPE), (String)"ext.pricol.workflow.dropdown.RejectReasonRB", (Locale)locale);

    }

}

RejectReasonRB.rbInfo

ResourceInfo.class=wt.tools.resource.EnumResourceInfo

ResourceInfo.customizable=true

ResourceInfo.deprecated=false

# Entry Format (values equal to default value are not included)

# <key>.value=

# <key>.category=

# <key>.comment=

# <key>.argComment<n>=

# <key>.constant=

# <key>.customizable=

# <key>.deprecated=

# <key>.abbreviatedDisplay=

# <key>.fullDisplay=

# <key>.shortDescription=

# <key>.longDescription=

# <key>.order=

# <key>.defaultValue=

# <key>.selectable=

# Entry Contents

PriceCompetency.value = Price Competency

PriceCompetency.order = 10

ProjectdroppedbyCustomer.value = Project dropped by Customer

ProjectdroppedbyCustomer.order = 20

DelayinQuotesubmission.value = Delay in Quote submission

DelayinQuotesubmission.order = 30

ProjectTechnicallyunviable.value = Project Technically unviable

ProjectTechnicallyunviable.order = 40

ProjectCommerciallyunviable.value = Project Commercially unviable

ProjectCommerciallyunviable.order = 50

CustomerProjectpostponement.value = Customer Project postponement

CustomerProjectpostponement.order = 60

Hi,

I could come up with the correct solution without the requirement of Windchill information modeler. I had similar requirement for this. As my customer doesnt have windchill information modeler. i was working on it. it is working for me.

Requirement:

I have bring drop down in the document for giving the reason for rejection.

Steps:

1. Compile RejectReason.java and RejectReasonRB.java (tis will have entry in the RB file)

2. resourceBuild the RB file to get RB.ser file. (if u wanted to add some entries using ENUMCUSTOMIZE in future)

Let me know if this works

Hi ,

I am looking for similar solution but the values should be multi select, can you please help me with any idea you have.

Thanks in advance

dmcalister-2
13-Aquamarine
(To:sahmed-5)

This is old but I had a similar requirement for multi-select and thought I would share what I did. Create boolean variables for each entry in the list. They display on the task page as a list with a checkbox, so you can select or not select any multiple of them. It works well if you have a manageable number of variables. No custom class required since using the OOTB Boolean type.

Top Tags