none
Read MSPS 2010 Enterprise Custom Field Lookup Tables Using VBA RRS feed

  • Question

  • Hi,

    I was wondering if someone can help me with an issue I am experiencing please. I am trying to read Enterprise Lookup Tables values of a Enterprise Custom Field in order to identify which value should be selected using VBA. Specifically:

    I have a Enterprise Custom Field (Project Level) and I am trying to update the value from being NULL to the appropriate value using VBA. The Enterprise Custom Field (Project Level) has a Enterprise Lookup Table attached to it, so only certain values can be selected. The trouble is, I do not know what the value is that I want to set the Enterprise Custom Field (Project Level) to without reading a populated Enterprise Custom Field (Task Level) first. The first 5 characters of the Enterprise Custom Field (Task Level) identifies the possible value for the Enterprise Custom Field (Project Level) value by comparing it to the last 5 characters of each value in the Lookup Table of the Enterprise Custom Field's (Project Level).

    Here is my code:

    'Disable error-handling
    On Error Resume Next                                                                                                                                

    For intLookupTableValueSearch = 1 To 5000

    If Right(Application.CustomFieldValueListGetItem(Application.FieldNameToFieldConstant( _
            "Enterprise Custom Field (Project Level)", pjProject), pjValueListValue, intLookupTableValueSearch),5) = _
    Left(tskTask.GetField(FieldNameToFieldConstant("Enterprise Custom Field (Task Level)", pjTask)),5) Then

    If Err.Number = 0 Then

                    ActiveProject.ProjectSummaryTask.SetField Application.FieldNameToFieldConstant( _
    "Enterprise Custom Field (Project Level)", pjProject), Application.CustomFieldValueListGetItem( _
    Application.FieldNameToFieldConstant("Enterprise Custom Field (Project Level)", pjProject), _
    pjValueListValue, intLookupTableValueSearch)

    Else

    Exit For

    End If

    End If

    Next intLookupTableValueSearch

    I have a feeling that this code is specific to local custom fields with the MSP plan and it is not possible to do this, but I hope I am wrong. If MSP knows what values can be selected on the drop-downs, I hope that this would be possible.

    If anyone can provide any answer to this problem, I would be very grateful.

    Thanks in advance,

    Andrew

    Thursday, August 22, 2013 6:01 PM