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.

Drop down menu or Radio Buttons for Workflow Activity

MichaelWright
1-Newbie

Drop down menu or Radio Buttons for Workflow Activity

All,

I have a need/want for setting up a drop down menu or radio buttons (either one would work) for an activity. I have 6 workflow variables that a user is going to update. Each of them have 3 options to choose from, they are the same three options for each variable. I want to have those options pre-defined so that the user doesn't have to type them in (save on the confusion for the users). For a little better understanding of what I'm looking for, here is a quick example of what I'm looking for:

Variable 1: *Options* 0, 1, or 2

Variable 2: *Options* 0, 1, or 2

Variable 3: *Options* 0, 1, or 2

Variable 4: *Options* 0, 1, or 2

Variable 5: *Options* 0, 1, or 2

Variable 6: *Options* 0, 1, or 2

Is there a way to set up a configuration to allow for this or is this something that would require a customization. This is something different than what I've done before. I know that I have seen the drop down appear for the Define Team task or for WT.Team.Team variables. If anyone knows how to tap into something like that to accomplish this, I would greatly appreciate it.

Thanks,

Mike

9 REPLIES 9

Try putting your values in a resource bundle, then use that as your variable type

I think you can just extend EnumeratedType. I have the same requirement today so I'm going to see if that works.

I don't have any experience working with a resource bundle or enumerated type. Can you elaborate a little bit more on them as to how I would go about creating them?

public class EnhancementType extends EnumeratedType {
private static final long serialVersionUID = -864855612543696562L;
public static final EnhancementType ENHANCEMENT;
public static final EnhancementType BUG;
private static final EnumeratedType[] valueSet;
private static Hashtable<Locale, EnumeratedType[]> localeSets;
public static EnhancementType toEnhancementType(String key) {
try {
return (EnhancementType)toEnumeratedType( key, valueSet );
} catch (Exception e) {
return null;
}
}
public static EnhancementType newEnhancementType(int i) throws IllegalAccessException {
EnhancementType.validateFriendship(i);
return new EnhancementType();
}
public static EnhancementType getEnhancementTypeDefault() {
return (EnhancementType)EnhancementType.defaultEnumeratedType(valueSet);
}
public static EnhancementType[] getEnhancementTypeSet() {
EnhancementType apriority[] = new EnhancementType[valueSet.length];
System.arraycopy(valueSet, 0, apriority, 0, valueSet.length);
return apriority;
}
@Override
public EnumeratedType[] getValueSet() {
return ((EnumeratedType []) (EnhancementType.getEnhancementTypeSet()));
}
@Override
protected EnumeratedType[] valueSet() {
return valueSet;
}
@Override
protected EnumeratedType[] getLocaleSet(Locale locale) {
EnumeratedType aenumeratedtype[] = null;
if(localeSets == null) {
localeSets = new Hashtable<Locale, EnumeratedType[]>();
} else {
aenumeratedtype = (EnumeratedType[])(EnumeratedType[])localeSets.get(locale);
}
if(aenumeratedtype == null) {
try {
aenumeratedtype = EnhancementType.initializeLocaleSet(locale);
} catch(Throwable throwable) {
}
localeSets.put(locale, aenumeratedtype);
}
return aenumeratedtype;
}
private static EnumeratedType[] initializeLocaleSet(Locale locale) throws Throwable {
Class<?> aclass[] = {Integer.TYPE};
return EnhancementType.instantiateSet((EnhancementType.class).getMethod("newEnhancementType", aclass), EnhancementType.class.getName() + "RB", locale);
}
static {
try {
valueSet = EnhancementType.initializeLocaleSet(null);
ENHANCEMENT = EnhancementType.toEnhancementType("Enhancement");
BUG = EnhancementType.toEnhancementType("Bug");
} catch(Throwable t) {
throw new ExceptionInInitializerError(t);
}
}
}

Create your .rbInfo in the same src package.

ResourceInfo.class=wt.tools.resource.EnumResourceInfo
ResourceInfo.customizable=true
ResourceInfo.deprecated=false
Enhancement.value=Enhancement
Bug.value=Bug

wc shell: ResourceBuild com.mypackage.*

If you run into any problems with ResourceBuild, make sure your .rbinfo is in the wc src folder.

My class is named EnhancementType, so my rbinfo is named EnhancementTypeRB.rbInfo. I'm not concerned with localization now.

Hello Matthew,

I tried doing similar thing in Windchill10M020.

As I am newbie to customization don't know how to define and call the enumeration in rbinfo file as workflow variable.

Kindly request you to send me the steps.

Thanks & Regards,

Birendra

MatthewKnight
4-Participant
(To:brawat)

rbinfo files get compiled into class files. For instance, wt/project/RoleRB.rbInfo gets compiled into wt.project.Role. In the class dropdown of the Create Variable interface for your workflow template/activity, you should be able to select "wt.project.Role" from the list or type it in yourself as an "other class."

Hi Mike,

I have similar requirement, Will like to know whether you were successfull in achieving drop down for tha workflow variable ?

Regards,

Birendra

Top Tags