none
Insert multi valued Custom Field PSI sample RRS feed

  • Question

  • Hi all,

    I was looking for a sample about how to insert or update a multivalued CF of a Lookup Table with no result. Can any one provide me a easy example??

     

    Thanks!


    Miguel Soler
    Sunday, February 5, 2012 11:06 PM

Answers

  • Kashif,

    LTPropUID and LTPropID dont exist in a lookup.

    But thanks


    Miguel Soler

    • Marked as answer by Miguelet_ Tuesday, February 14, 2012 12:01 PM
    Tuesday, February 14, 2012 11:47 AM

All replies

  • Hi Miguel,

    Are you trying to update Lookup table itself or want to update Project's CF of a multivalue LT?

     


    Thanks, Kashif
    Monday, February 6, 2012 7:53 AM
  • Hi Kashif,

    What I exactly want is to update or insert a Project´s CF of a multivalue LT.

    Thanks,

     


    Miguel Soler
    Monday, February 6, 2012 9:05 AM
  • I assume you've set up your psi. The rest you need is the following

    Update Custom Field

    The article is about updating,you can use the following snippet to add new CF.

     

    WebSvcProject.ProjectDataSet projectDs = 
                    project.ReadProject(projectId, WebSvcProject.DataStoreEnum.WorkingStore);
      
    SvcProject.ProjectDataSet.ProjectCustomFieldsRow cfRow = projectDs.ProjectCustomFields.NewProjectCustomFieldsRow();
    
    cfRow.CUSTOM_FIELD_UID = Guid.NewGuid();
    cfRow.PROJ_UID = PROJ_UID;
    cfRow.MD_PROP_UID = LT Value Prop UID
    cfRow.MD_PROP_ID =   LT Value Prop ID
    cfRow.FIELD_TYPE_ENUM = 21 //,15 whatever the type is
    // Depending on the Type above you'll set its value
    cfRow.TEXT_VALUE or cfRow.NUM_VALUE //etc
    
    projectDS.ProjectCustomFields.AddProjectCustomFieldsRow(cfRow);
    
    

    From here you can continue with the article and update your project using QueueUpdateProject.

    If you still have any issue let me know.

     


    Thanks, Kashif


    Monday, February 6, 2012 9:28 AM
  • Hi Kashif,

    I guessed that to insert a cf of a Lookup table (not multivalued), I have to insert a code_value, that cames up from the value on a Lookup Table.

    Im not sure about this:

    cfRow.MD_PROP_UID = LT Value Prop UID
    cfRow.MD_PROP_ID =   LT Value Prop ID

    The link that u supported does not say anything about lookuptables...

    I need some more guidance about this issue.

    Thanks!


    Miguel Soler

    Thursday, February 9, 2012 3:42 PM
  • Yes you're right, for lookup table's value you've to use code_value. The FIELD_TYPE_ENUM would be as of text that is 21. I think Lt_Struct_UID would be placed for code_value, in short just put the looktup table value's UID. Something like this.

    cfRow.MD_PROP_UID = LT Prop UID // NOT VALUE
    cfRow.MD_PROP_ID =   LT Prop ID // NOT VALUE

    cfRow.FIELD_TYPE_ENUM=   21

    cfRow.CODE_VALUE=   LT VALUE'S UID

    Just try you'll figure out it. Let me know if it still doesn't work or you can show your code.


    Thanks, Kashif


    Thursday, February 9, 2012 4:11 PM
  • Kashif,

    LTPropUID and LTPropID dont exist in a lookup.

    But thanks


    Miguel Soler

    • Marked as answer by Miguelet_ Tuesday, February 14, 2012 12:01 PM
    Tuesday, February 14, 2012 11:47 AM
  • Miduel my bad, instead of referring to Custom Field's IDs I mentioned LT. Hope your problem is solved.

    Thanks


    Thanks, Kashif

    Tuesday, February 14, 2012 1:35 PM