locked
Unable to find My entity in the Step Registration + Plugin Registration Tool RRS feed

  • Question

  • Hi i am writing a plugin code to generate an auto number while creating the record for the entity, I have used a temporary entity to generate the first number and i am using dynamic entity. here is the code sample

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.Crm.Sdk;
    using Microsoft.Crm.SdkTypeProxy;
    using var1=Plugin2.CrmSdk;
    using System.Web.Services.Protocols;
    namespace Plugin2
    {
        public class Numberplugin : IPlugin
        {
            #region Iplugin Members
            public void Execute(IPluginExecutionContext context)
            {
                try
                {
                    DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties["Target"];
                    var1.CrmAuthenticationToken token = new var1.CrmAuthenticationToken();
                    token.OrganizationName = "AdventureWorksCycle";
                    var1.CrmService service = new var1.CrmService();
                    service.Url = "http://localhost/MSCRMServices/2007/CrmService.asmx";
                    service.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    service.CrmAuthenticationTokenValue = token;
                    var1.ColumnSet cols = new var1.ColumnSet();
                    cols.Attributes = new string[] { "pag_token", "pag_tokennumberid" };
                    var1.QueryExpression query = new var1.QueryExpression();
                    query.EntityName = var1.EntityName.pag_tokennumber.ToString();
                    query.ColumnSet = cols;
                    var1.RetrieveMultipleRequest retrieve = new var1.RetrieveMultipleRequest();
                    retrieve.Query = query;
                    var1.RetrieveMultipleResponse retrieved = (var1.RetrieveMultipleResponse)service.Execute(retrieve);
                    if (retrieved.BusinessEntityCollection.BusinessEntities.Length > 0)
                    {
                        var1.pag_tokennumber number = (var1.pag_tokennumber)retrieved.BusinessEntityCollection.BusinessEntities[0];
                        string newstr = number.pag_token;
                        int increment = int.Parse(newstr);
                        increment = increment + 1000;
                        StringProperty strp = new StringProperty();
                        strp.Name = "pag_ticketnumber";
                        strp.Value = Convert.ToString(increment);
                        entity.Properties.Add(strp);
                        number.pag_token = increment.ToString();
                        service.Update(number);
                    }
                }
                catch (SoapException ex)
                {
                    throw ex;
                }
            #endregion

     

     


            }
        }
    }

    Now i am using the Plugin Registration tool to register the plugin . I have resiatered the assembly with the on disk option the addition was successful . Then i am registering a new step. On create However in the next tab for the Primary Entity the name of my custom entity is not popping . I have published the entity. I have updated the Crm Service but i am not being able to see my custom entity

    • Moved by ashawani_dubey Wednesday, March 31, 2010 2:55 AM user Forum Merge (Feladó:Microsoft Dynamics CRM)
    Friday, July 3, 2009 3:07 PM

All replies

  • Which version of registration tool do you use?

    Please try to use the latest version, and download here: http://code.msdn.microsoft.com/crmplugin

    I have found that the tool included in the crm sdk is outdated and buggy.

    Otherwise I don't understand your coding concept clearly. Have you tried to compile and use your own crmproxy (Plugin2.CrmSdk) ?
    New plugin concept force you to use factory-built sdk, and ICrmService instead of dynamically compiled crm service proxies.


    Regards,

    Tibor
    SzT
    Monday, July 6, 2009 7:04 AM