Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Dynamic CRM new fields

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Some new fields were create in Dynamics CRM.

Now need to push some data to those new fields from asp.net website.

Need to add those new fields to:

[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]

namespace Xrm

how should this be done? I read that these is a tool that generates this class file (CrmSvcUtil.exe).

But I do not understand how this would work.

Is this something that need to be done through Dynamics CRM admin?

Please advise.

Thanks

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamic CRM new fields

    Hi,

    My issue is that need to add fields to code that were added in the crm itself.

    This is the error I get:

    "'lead' entity doesn't contain attribute with Name = 'myname'."

  • Suggested answer
    Sergio Macias Profile Picture
    Sergio Macias 225 on at
    RE: Dynamic CRM new fields

    Hi Shmar

    If the case is that you have an asp.net web project and want to insert data in CRM you need these steps:

    1. Have a class to get the connection object (this connection is for a CRMOnline)

    public IOrganizationService CRMCon()

    {

    String connectionString = "Url=instancename.crm.dynamics.com; Username=user@instancename.onmicrosoft.com; Password=passxx; authtype=Office365";

    CrmServiceClient conn = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString);

    return (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

    }

    *But you can find the different connections string for the onpremise here: http://ninjadeveloper.com/how-to-connect-to-dynamics-crm-2016-online-and-on-premise-using-a-c-console-application/

    1.1 Once you get the object CRMCon you pass it to the next method

    2. In the server side of your app you can have different options using the SDK to insert/retrieve or delete info here's  one example to insert records

    public Guid CreateLead(IOrganizationService service)

    {

    Entity lead = new Entity("lead");

    lead.Attributes.Add("subject", "Lead from .NET");

    lead.Attributes.Add("lastname", "Macias");

    lead.Attributes.Add("firstname", "Sergio");

    lead.Attributes.Add("telephone1", "81542531");

    lead.Attributes.Add("companyname", "My Company");

    lead.Attributes.Add("websiteurl", "www.mycompany.com");

    Decimal revenue = 12250;

    lead.Attributes.Add("revenue", new Money(revenue));

     

    Guid MyResultGuid = service.Create(lead);

    return MyResultGuid;

     

    }

    In this step you can see that I´m using the late bound, in this case you need to know the schema name for your fields, here you need to remember that all names are lower case.

    Hope this helps you.

  • Suggested answer
    Jason M. Cosman Profile Picture
    Jason M. Cosman 5,234 on at
    RE: Dynamic CRM new fields

    Hello Shmar;

    There are several ways to communicate with CRM through asp.net. Your talking about early bound entity classes which I recommend reading about at: msdn.microsoft.com/.../gg327844.aspx. It really is easy to generate with lots of examples in the CRM SDK and the link I've provided. Your also able to use the web API to connect. I'd recommend starting at: msdn.microsoft.com/.../mt593051.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans