none
Update and assign multiple values in a multi select lookup table in PWA programmatically RRS feed

  • Question

  • Hi,

    I am working on custom application where I need to set/update the PWA project multi select lookup custom field value pro-grammatically.

     Using below code I am able to set/update one value in custom field.                                   

    cfRow.CODE_VALUE = new Guid("cdac15e9-f79e-4b31-8911-e19db7ed82b5");

    but how can insert more than one values that still is a question for me.

    Any suggestion ?

    Thursday, March 15, 2012 9:20 AM

All replies

  • Hi There,

    Please see if the below helps.

    http://www.projectserver2010blog.com/2010/02/project-server-entity-mapping-lookup.html

    Mapping Multiple Value Lookup Fields

    The mapping of fields which allow multiple values to be selected from the lookup table can be produced in the following manner:

    [PSLookupField("{eda98e8a-6e2c-49f4-bdf0-97e8d3941e3e}""{9d02dfc9-cde1-4087-b278-7745086c0830}",   
    1.         FieldName = "Sample Primary Objectives", LookupTableName = "Sample Primary Objective")]   
    2.     public IList<STRING> SamplePrimaryObjectives { getset; }  
    [PSLookupField("{eda98e8a-6e2c-49f4-bdf0-97e8d3941e3e}", "{9d02dfc9-cde1-4087-b278-7745086c0830}",
            FieldName = "Sample Primary Objectives", LookupTableName = "Sample Primary Objective")]
        public IList SamplePrimaryObjectives { get; set; }

    The inheritor classes or interfaces of IEnumerable<> type (IList<>, List<> etc.) can be used to map a multiple value lookup field. The instance of List<> will be created during filling propertied of your entity, and all selected lookup values will be added as an elements to this list. For instance, if the lookup table has three items (“value 1”, “value 2” and “value 3”), and two of them are chosen in your object, you’ll have “value 1” and “value 2” items in the list.

    To add, remove or change the selection of values for the mapped object, you should manipulate with list items.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82

    Thursday, March 15, 2012 11:00 AM
  • Thanks Amit,

    For your quick response.

    But here I am facing trouble to map your suggestion with my requirement as well as code.

    Currently I am integrating my PWA with some third party application and from that application I am getting multiple values for a particular PWA project multi select custom field.

    As above mentioned I am successfully able to update project custom field having one value by using below method.

    cfRow.CODE_VALUE = new Guid("cdac15e9-f79e-4b31-8911-e19db7ed82b5");

    But how can I use the same to update project custom field with multiple values.

    Please correct me if I am saying something wrong here?

    Thanks !!!

    Thursday, March 15, 2012 4:24 PM