how to update record(CRM 2011) through ASP.net RRS feed

  • 問題

  • My question is not simple as it sounds in my title. let me explain,

    I have a entity called "Medical history"( both in CRM 2011 n ASP.net portal). Now, I create a record from ASP.net , in CRM, an entity will be created. everything working fine. What i really need is  I should be able to a create the record ONLY once. After creating a record from ASP, customer can ONLY update(edit ) that particular record. is there a work around for this ??!! 

    According to my Code, every time the customer click on" submit" from the ASP.net a record is created. that means.. customer can create multiple record(dis is Exactly opposite to my client requirement) . by-d-way am using "  service.Create(Medical);" to create the record. how can i restrict the customer to create ONLY ONE record and how can i update the same record every time. customer shouldn't  not be allowed to create multiple records.


    2011年12月23日 上午 10:33


  • Thanks for  your reply , il check it out
    • 已標示為解答 Pradeep47 2011年12月28日 上午 03:53
    2011年12月28日 上午 03:53


  • Hi,

    You will have to add the logic in your code to handle the update if a record already exists. For example: the click of the Submit button.

    When you do a Service.Create(Medical); this should give you a guid/ID of the entity record that was created. you can then 'Retrieve' the record from the database & set any attribute values that you want to update & then call 'Update' method of the service/IOrganizationService.

    Something like this which updates the same record with new values for the attributes.

    Entity account = new Entity("account");
    account["name"] = "Fourth Coffee";
    _accountId = _service.Create(account);

    ColumnSet attributes = new ColumnSet(new string[] { "name", "ownerid" });
    account = _service.Retrieve(account.LogicalName, _accountId, attributes);
    account["address1_postalcode"] = "98052";
    account["revenue"] = new Money(5000000);


    More example is avilable in the CRM SDK documentation http://www.microsoft.com/downloads/en/details.aspx?FamilyID=420f0f05-c226-4194-b7e1-f23ceaa83b69.



    • 已提議為解答 aanch 2012年4月3日 下午 12:36
    2011年12月27日 下午 10:56
  • Thanks for  your reply , il check it out
    • 已標示為解答 Pradeep47 2011年12月28日 上午 03:53
    2011年12月28日 上午 03:53