Determine Publisher Prefix RRS feed

  • Question

  • I have some plugin that should work with different publishers. Assume the plugin needs to set the field [PublisherPrefix]_name. Somehow I need to find out what [PublisherPrefix] is. I could put it into a web resource and load it from there. However, to make it easier and less error-prone I want to determine the prefix during runtime. How do I find the publisher for the solution that has triggered the plugin?
    Thursday, December 5, 2013 6:27 AM

All replies

  • Here is the Query :

    QueryExpression _Query = new QueryExpression
                    EntityName = "publisher",
                    ColumnSet = new ColumnSet(true),
                    Criteria =
                        FilterOperator = LogicalOperator.And,
                        Conditions =
                                new ConditionExpression
                EntityCollection _Entities = _service.RetrieveMultiple(_Query);
                if (_Entities.Entities.Count > 0)
                    Entity _Publisher = _Entities.Entities[0];
                    string _Prefix = _Publisher.Attributes["customizationprefix"].ToString();

    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog

    • Proposed as answer by _Vikram Thursday, December 5, 2013 7:17 AM
    Thursday, December 5, 2013 7:16 AM
  • Vikram, thanks. This code assumes that I know what the name of the publisher is. However, that is exactly what I need to find, i.e. what is the publisher of the solution for which that plugin is being executed. Once I have the publisher I can easily get the prefix as you also have shown in your code.

    After thinking about this some more, I think I can simply get the logical name of the entity for which the plugin is being executed. Then I remove everything after the first underscore. This should then be the prefix, i.e. I don't need to take the path of first finding the publisher.

    Thursday, December 5, 2013 7:29 AM
  • Hi,

    If you have only custom entities in solution then finding prefix from entity name will be a best solution, instead of taking some other route.

    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Thursday, December 5, 2013 7:48 AM