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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Entity Data update from a custom Aspx Page

(0) ShareShare
ReportReport
Posted on by

Hi,
I have found many sample to create data in dynamics crm from a custom aspx page, but i need to update entity data.
any sample will be helpful.

Thanks 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Hosk Profile Picture
    on at

    in the aspx page you will create an iorganizationservice and using this you can CRUD - Create, Retrieve, Update, Delete

    I would look at the CRM SDK, there are examples in there and it will teach and was as give you sample code

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

    this blog is useful

    blogs.msdn.com/.../how-to-create-a-simple-webpage-leveraging-the-crm-2011-iorganizationservice-web-service.aspx

    this forum post will help

    social.microsoft.com/.../how-to-update-recordcrm-2011-through-aspnet

  • Community Member Profile Picture
    on at

    Thanks for the replay, but my problem is how to get the GUID of the record in the email, let me explain my scenario :

    I have a custom entity with field named Approval, when data created a workflow is fired to send email to the approve to approve this data, the customer want from the email approve the Data without accessing to the CRM but he is a CRM user, that's why i want to insert in the email a link to web page (pop-up) that show him only too option (Accept or Reject) and then Update the entity attribute.

  • Suggested answer
    Hosk Profile Picture
    on at

    if you are creating the link, why don't you put the guid in the link and pass it to your apsx page as an url parameter.

  • Community Member Profile Picture
    on at

    I tried but the problem is in "create Email" in the Workflow Dynamic Value, we have just the full Record URL, how to get just the guid to put it in the link as parameter

  • Community Member Profile Picture
    on at

    I can get the guid as parameters from the url, and i tried the code below but i get error :

    string smsguidurl = Request.QueryString["id"].ToString();
    Guid smsguid = new Guid(smsguidurl);
    ColumnSet attributes = new ColumnSet(new string[] { "new_testapp" });
    Entity retrievedsms = service.Retrieve("new_smsmessage", smsguid, attributes);
    retrievedsms["new_testapp"] = "Approved";
    service.Update(retrievedsms);

  • Suggested answer
    Hosk Profile Picture
    on at

    what is the error you are getting?

    I think you need code like this

    retrievedsms .Attributes["Approved"] = "Approved";

    is the new_testapp field a string? if it's an optionset the code won't work and you need to set an optionset

    you would need something like this

    OptionListValue = new OptionSetValue((int)parsedValue)

  • Community Member Profile Picture
    on at

    new_testapp is a string just for testing the update after that i'll work with option set, the error is below :

    [FaultException: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.]

      System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +14543410

      System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +622

      Microsoft.Xrm.Sdk.IOrganizationService.Retrieve(String entityName, Guid id, ColumnSet columnSet) +0

      Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.RetrieveCore(String entityName, Guid id, ColumnSet columnSet) +989

      Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Retrieve(String entityName, Guid id, ColumnSet columnSet) +37

      Approval.btnClick_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\SMSApprove\Approval.aspx.cs:41

      System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155

      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

  • Community Member Profile Picture
    on at

    however using

    retrievedsms .Attributes["Approved"] = "Approved";

    i get the same error

  • Hosk Profile Picture
    on at

    have you been to run any service.update from your apsx page.

    does this line

    Entity retrievedsms = service.Retrieve("new_smsmessage", smsguid, attributes);

    bring back a valid entity with the variable assigned values.

  • Community Member Profile Picture
    on at

    no i didn't execute any service.update from my aspx

    actually i'm not really developer, i'm crm functional but i get to achieve this with aspx page and trying to resolve it.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans