Integrations and APIs for Service

Get Involved. Join the Conversation.


    GetValuesForNamedID to get Custom Object Menu values
    Topic posted February 2, 2011 by bill.shipman Blue Ribbon: 750+ Points, last edited October 29, 2011 
    2257 Views, 10 Comments
    GetValuesForNamedID to get Custom Object Menu values


    I have a custom RMA object in an RMA namespace with a field called RMA_Status that is a custom menu. I'm using ROQL to query the RMA_Status as a NamedID from the GenericFields list, which is working. But I seem to be unable to use GetValuesForNamedID to get the text values for this same menu for me to match it up to.

    The code i'm trying to use is below and the error i get is "NamedID not found: RMA.RMA.RMA_Status". Looking at the suported strings at the link below, I'm guessing this isn't supported for custom objects, but just though I'd ask.|getValuesForNamedID


    Code Snippet:



    • Chris Omland

      Hi Bill, this functionality was added in the Feburary 2011 release set to GA in a couple weeks.

    • Stuart Concannon

       Hi Chris

      We have Feb 11 but cannot make it work. Do you have an example for a custom object? Or was it not added?


    • Chris Omland

      Hi Stuart, I confirmed this does not appear to be functioning as expected. I'm looking into this now.

    • Christopher Farmer

      Hi all,

      I'm having a similar problem:

      I have a menu field with 15 different items attached to a custom object. I have a Contact custom field of type menu which has the exact same items. When an item is selected in the custom object menu (which is in an aggregation relationship with the Contact), I need to alter the selected item in the Contact custom field.

      I need to be able to match up the text values in these menus using GetValuesForNamedID as Stuart is doing, but I'm receiving the same error.

      Do you have any news regarding this Chris? Do you know when it may be fixed?


    • Chris Omland

      We have addressed this in our May 2011 release which is set to GA shortly. I have also requested this be service packed back to November 2010 sites.

    • JustRhianna

      We are trying to use this on a November 11 site and are still hitting roadblocks. We have no values being returned. Anyone had success with this? I have some sample code from one of the guys on my dev team below.


      partial class Form1 : Form


              private string _strDB1;


      public Form1()





      private void
      btnUploadMA_Click(object sender, EventArgs e)


                  var objSiteLocation = new

      objSiteLocation.ApplicationName.Value = "CitizenLink";

      objSiteLocation.Name.Value = "CitizenLink";

      objSiteLocation.RightNowSyncPortClientUrl.Value = "***";

      objSiteLocation.RightNowSyncPortClientUserName.Value = "***";

      objSiteLocation.RightNowSyncPortClientPassword.Value = "xxxx";


      var objClientInfoHeader = new OperationLayer.RNSS.ClientInfoHeader
      { AppID = "Get NamedId values"};


      objNamedId = RightNowGenericFunctions.PerfromGetValuesForNamedId(objSiteLocation,
      "RELATIONSHP", "ContactAddress.Country", null);


      foreach (var
      namedId in objNamedId)











      public class RightNowGenericFunctions


      #region Constructor


      public static RightNowSyncPortClient
      GetClient(SiteLocation objSiteLocation)


      var objEndpointAddress = new


      var objBasicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);

      objBasicHttpBinding.Security.Message.ClientCredentialType =


      objBasicHttpBinding.MaxReceivedMessageSize = 2147483647;

      objBasicHttpBinding.MaxBufferSize = 2147483647;

      objBasicHttpBinding.ReaderQuotas.MaxStringContentLength = 2147483647;

      = 2147483647;

      objBasicHttpBinding.ReaderQuotas.MaxDepth = 2147483647;

      objBasicHttpBinding.ReaderQuotas.MaxBytesPerRead = 2147483647;

      objBasicHttpBinding.ReaderQuotas.MaxArrayLength = 2147483647;


      var objRightNowSyncPortClient = new RightNowSyncPortClient(objBasicHttpBinding,


      ClientCredentials = { UserName = { UserName =
      objSiteLocation.RightNowSyncPortClientUserName.Value } }



      if (objRightNowSyncPortClient.ClientCredentials
      != null) objRightNowSyncPortClient.ClientCredentials.UserName.Password = objSiteLocation.RightNowSyncPortClientPassword.Value;


      var objBindingElementCollection =

      = false;


      objRightNowSyncPortClient.Endpoint.Binding = new


      return objRightNowSyncPortClient;





      #region Get


      public static
      NamedID[] PerfromGetValuesForNamedId(SiteLocation objSiteLocation, String strNamespace, String
      strFieldName, ClientInfoHeader objClientInfoHeader)




      var objRightNowSyncPortClient = GetClient(objSiteLocation);


      strNamespace, strFieldName);


      catch (Exception


      return null;








    • Pathaksa Tongpitak

      Hi everyone,


      Try this, it works for me:

      using System.Linq;

      MessageBox.Show(getMenuIDByName("RMA", "RMA", "RMA_Status", "MenuTextToLookUp").ToString());

              public long getMenuIDByName(string packageName, string customObjectName, string fieldName, string fieldValueName)
                  ClientInfoHeader clientInfoHeader = new ClientInfoHeader();
                  clientInfoHeader.AppID = "Basic Get";
                  NamedID[] valuesForNamedID = _client.GetValuesForNamedID(clientInfoHeader, packageName, customObjectName + "." + fieldName);
                  return valuesForNamedID.Where(f => f.Name == fieldValueName).First();

    • JustRhianna

      We tried this and it is not working.


      We are trying to get values from a Package called Relationshp an object named ContactAddress which has a menu field in it called Country the field Country gets its values from another object in the same package called ContactAddressCntry


      Maybe we are missing something?


      It returns null no matter what we do



    • Pathaksa Tongpitak

      What parameters are you exactly using?

      In your case it should be like this:

      getMenuIDByName("Relationship", "ContactAddress", "Country", "United States");

    • Allan Schrum

      You can perform a GetValuesForNamedID( clientInfoHeader, "Relationship", "ContactAddress.Country" ) which should return a list of all values that exist for that menu item. For custom objects it is important to pass in the package name separately from the object specification.

      If that does not work, please let me know.

      An alternative is to do GetValuesForNamedID( clientInfoHeader, "Relationship", "ContactAddressCntry" )

      Either approach should work and return the same values. Again, if either does not work please let me know so I can follow up on why.

      Pathaksa's routine should work as well although it only returns the particular ID value for the string you may be looking for instead of a list. But his example should work as well if you only want the specific ID of a menu item.