Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

CRUD operation for the Different Data Types field present in Dynamics CRM

Posted on by Microsoft Employee

Hi Team,

I have to perform the CRUD operation for the different data types field present in CRM.

Suppose i have a custom field of data type "Single line of text" then for this particular type of field i should be able to insert or delete or update or retrieve the data through GUID or any other way.

Like ways i need to do for other data types of the field.

Not getting the logic and the code to proceed further.

Can anyone please help me out to get the logic and the code?

Thanks in Advance :)

*This post is locked for comments

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: CRUD operation for the Different Data Types field present in Dynamics CRM

    Hello Anita,

    This might help you: http://himbap.com/blog/?p=2821

    msdn.microsoft.com/.../gg328416.aspx;MSPPError=-2147217396

    Thanks

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: CRUD operation for the Different Data Types field present in Dynamics CRM

    Hi Anita,

    It should be straight forward. Below i sthe sample for create

    // Create a new contact record

                    Entity accountEnt = new Entity("account");
                    // Single Line
                    accountEnt["name"] = "Test Account";
                    // Owner Lookup
                    accountEnt["ownerid"] = new EntityReference("team", new Guid("A09EAF81-B7B7-E711-8168-E0071B675C91")); // Look up to a team with this id
                    // Currency Lookup
                    accountEnt["transactioncurrencyid"] = new EntityReference("transactioncurrency", new Guid("C2D2DA87-A282-E711-8125-70106FA12A51")); // Look up to a Currency AUD 
                    // Option Set/ Drop Down
                    accountEnt["customertypecode"] = new OptionSetValue(1); // Pass the integer number to optionsetvale object. 1 being competitor value
                    // Money
                    accountEnt["creditlimit"] = new Money(100M); // Pass the decimal number to money object.
                    // Whole Number
                    accountEnt["numberofemployees"] = 1000; // Pass the integer value. 
                    // Two Option (Boolean)
                    accountEnt["creditonhold"] = true; // Pass the boolean value (true or false).
                    service.Create(accountEnt);

    To read/ update a value, you just need to use the same datatype as mentioned above in create.

    To delete a value, simple set the value to null. This will empty the the value of the field

    accountEnt["name"] = null;

    Take a look at this for more info-
    msdn.microsoft.com/.../gg334754.aspx

    Hope this helps
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRUD operation for the Different Data Types field present in Dynamics CRM

    Hi Francesco Picchi and Mihir Shah,

    Thanks a lot for the response.

    Will explain my scenario here:

    My requirement is, I want to perform the action update or insert or retrieve or delete the data present in the field by using the console Application.

    So, after creation of the field i should be able to perform all these actions on the field.

    Hope my requirement is bit clear.

    Thanks in Advance :)

    Anita Chaudhary

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRUD operation for the Different Data Types field present in Dynamics CRM

    Please refer to this community post:

    https://community.dynamics.com/crm/b/scaleablesolutionsblog/archive/2016/01/18/crud-operations-using-web-api 

    Hope it helps!

    If you found the answer helpful, please mark as Verified 

    Thank You & Best Regards

    Francesco Picchi

    Microsoft Dynamics CRM Consultant, Bologna, ITALY

    Independent Contractor

    http://www.francescopicchi.com

  • Suggested answer
    Mihir@CRM Profile Picture
    Mihir@CRM 4,036 on at
    RE: CRUD operation for the Different Data Types field present in Dynamics CRM

    I am not sure what exactly you want to do but here are few options -

    1. Use Data Import - Settings > Data Management > Imports or use Data loader

    2.  Use Web API calls to insert / update or retrieve data

    Refer to the SDK

    www.microsoft.com/.../details.aspx

    Hope this helps.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans