none
Set ProjectCustomFields value with multiple Lookup Table value selections RRS feed

  • Question

  • I have the following code segment that is trying to set multiple Lookup Values into a Custom Field.  I can only seem to find the syntax to set a single value.

    foreach (Proxy.Lookup.LookupTableDataSet.LookupTableTreesRow lookupRow in lookupResult.LookupTableTrees)
    {
        if(listItem["field.MD_PROP_NAME"].ToString().Contains(lookupRow.LT_VALUE_TEXT))
        {
            projectField.CODE_VALUE = lookupRow.LT_STRUCT_UID;
            //Need syntax to 'add' this value rather than replace
        }
    }
    Does anyone have insight on how to set multiple values into the projectField?



    Friday, June 22, 2012 7:38 PM

Answers

  • Hi Brad,

    Following is the code to enter multiple value lookup. For every selected value from Lookup we create new customfield and assign the Lookup's LT_STUCT_UID to the newly created CF.

    SvcProject.ProjectDataSet.ProjectCustomFieldsRow cfRow = currentProjDs.ProjectCustomFields.NewProjectCustomFieldsRow();
    cfRow.CUSTOM_FIELD_UID = Guid.NewGuid(); cfRow.PROJ_UID = new Guide("e6ddce9e-0867-406f-bdcb-f0b4a94ffd8f");//Project Guid

    //Following information can be obtained from [MSP_CUSTOM_FIELDS_PUBLISHED_VIEW] view cfRow.MD_PROP_UID = new Guide("DD0A5445-D2FB-4E42-B4EE-D05D8B5704A4");// Prop UID cfRow.MD_PROP_ID = 190873618; cfRow.FIELD_TYPE_ENUM = 21; //21 for Text value //For Lookup table cfRow.CODE_VALUE =new Guide("67f8adf8-a441-4231-bfb3-b21c4d943705");//LT_STRUCT_UID;

    Hope this helps you. In case you still face issues let me know.



    Thanks, Kashif

    Monday, June 25, 2012 8:32 AM

All replies

  • Hi Brad,

    Following is the code to enter multiple value lookup. For every selected value from Lookup we create new customfield and assign the Lookup's LT_STUCT_UID to the newly created CF.

    SvcProject.ProjectDataSet.ProjectCustomFieldsRow cfRow = currentProjDs.ProjectCustomFields.NewProjectCustomFieldsRow();
    cfRow.CUSTOM_FIELD_UID = Guid.NewGuid(); cfRow.PROJ_UID = new Guide("e6ddce9e-0867-406f-bdcb-f0b4a94ffd8f");//Project Guid

    //Following information can be obtained from [MSP_CUSTOM_FIELDS_PUBLISHED_VIEW] view cfRow.MD_PROP_UID = new Guide("DD0A5445-D2FB-4E42-B4EE-D05D8B5704A4");// Prop UID cfRow.MD_PROP_ID = 190873618; cfRow.FIELD_TYPE_ENUM = 21; //21 for Text value //For Lookup table cfRow.CODE_VALUE =new Guide("67f8adf8-a441-4231-bfb3-b21c4d943705");//LT_STRUCT_UID;

    Hope this helps you. In case you still face issues let me know.



    Thanks, Kashif

    Monday, June 25, 2012 8:32 AM
  • I understand Kashif.  I have to create a NewProjectCustomFieldsRow for each selected value, and add each one to the project Data Set.  It makes sense now.  Thank you!
    Monday, June 25, 2012 2:42 PM