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

How to create soft attribute with user picker?

tpfueller
1-Newbie

How to create soft attribute with user picker?

Hi,

I want do define a soft attribute "approver" for a certain document and the approver should be a PDMLink user.

When user creates the document, he should be able to select the approver from a list of PDMLink users.

As far as I understand, I need to write some code for a so called user picker and compile it.

There is an example for compiling a picker for organizations here.

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS80307

However, I am not very familiar with customization and searching for someone who can explain, what to do.

I would like to know the following:

* Sample code with simplest callback function
(I attach a sample code from PTC Technical Support, but I guess this is too generic and does not work)

* How to compile

* How to register in Windchill if this is different as described in the article above

Sorry, but I am a beginner in this.

I would appreciate any help.

Tom

4 REPLIES 4

Hee hee...there is no attribute type for picking a user. I've tried, extensively, to find one and PTC has said no it doesn't exist. So you'll have to go to the Workflows instead.

Quick option would be in your Document workflow, immediately after the Start send a Submit task to the Creator but add Set Up Participants to it, and they can pick the reviewers and approvers on it. You may also want to put code in the Complete transition that will spit out a popup error if they set themselves as the Reviewers or the Approver, since self-approval is a conflict of interest.

Hope that helps,

Daryl

satre-2
1-Newbie
(To:doehr)


You can create attribute of string type and create data utility to replace textbox with User picker. Below are the steps


  1. Write data utility by extending the com.ptc.core.components.factory.dataUtilities.DefaultPickerDataUtilityand override the setModelData method to specify the pickerConfig, following is an example

    

public void buildUserPickerConfig(final String component_id, final ModelContext mc) throws WTException {

           HashMap<String, Object> defaultProps = new HashMap<String, Object>();

           defaultProps.put("objectType", "wt.org.WTPrincipal");

           defaultProps.put("pickedAttributes", "name");

           defaultProps.put("readOnlyPickerTextBox", "false");

           defaultProps.put("showSuggestion", "true");

           defaultProps.put("suggestServiceKey", "OrgPicker");

           HashMap<String, Object> customProps = new HashMap<String, Object>();

           if ("Esclation".equals(component_id) ||"OrgAttribute".equals(component_id)) {

                 customProps.put("pickerId", component_id);

                 customProps.put("pickerCallback", "CustomPickerInputComponentCallback");

           }

           defaultProps.putAll(customProps);

           mc.getDescriptor().setProperties(defaultProps);

     }


          2. Use attribute internal ID from the Type manager for the new IBA created and register the data utility in the service.properties file refer customizer guide for registering data utility


docattr.png



hope it helps !!


Thanks

Shryeas

doehr
1-Newbie
(To:satre-2)

...Ugh...why didn't PTC tell me that?

Lokeshwaran_S
5-Regular Member
(To:satre-2)

Hi,

 

Can you help me out where to register the callBack function jsp page name and location of it ?

Announcements