I want to have attributes name in picklist of the entity through javascript mscrm online RRS feed

  • Question

  • Dear all;

    i want to bring all the attribute (for example account entity) into picklist field through javascript on the form 

    Wednesday, April 1, 2015 12:28 PM

All replies

  • I'm not really sure what you mean but I want to give you some starting points: Do you want the attribute values (like 'George', 'LondonStreet') o or attribute names (like 'Name'/'Street' or 'name'/'addres1_line1') (Display Names/Schema Names)

    First of all this is a link that explains how to add items to an option set: Add item to option set

    Second part is to get all attribute values/display names/schema names from a form

    1. If you want the attribute values in a picklist: retrieve all attributes on the form with Xrm.Page.entity.attributes.get(), loop them and get the value (attribute.getValue()), add them to the picklist.
    2. If you want the attribute display names & schema names, use the XrmServiceToolkit. It has a function XrmServiceToolkit.Soap.RetrieveEntityMetadata(). This function has some parameters
    • entityFilters : string (case sensitive): Entity, Attributes (this one yes), Privileges, RelationShips 
    • logicalName : string: entity to get metadate from
    • retrieveIfPublished: bool: retrieve unpublished metadata?
    • callback: callback function with results function(results){...}

    Get all attribute display names/schema names out of the results object (use a browser watch), add them to the picklist.

    Hope it helps

    Kind regards

    Wednesday, April 1, 2015 2:38 PM