web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

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

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Mahendar Pal Profile Picture
    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
    55,410 Moderator 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
    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
    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
    MihirShah Profile Picture
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans