Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Kent 30 posts 54 karma points
    Dec 04, 2012 @ 20:12
    Kent
    0

    SendEmailTask uses OrderGUID?

    By default, the EmailService passes an order guid to the email template. But when I try to query the purchase orders by guid I get a 'GenericADOException': "could not execute query". So how am I supposed to retrieve the PurchaseOrder with just a guid?

    Here is my code:

     

    string orderNumber = Request.QueryString["orderNumber"];
    PurchaseOrder purchaseOrder = PurchaseOrder.FirstOrDefault( x => x.OrderGuid.ToString() == orderNumber ); // Blows up here

     

    But it works if I send the email manually and pass an order number:

    // Send order confirmation email manually
    EmailProfile emailProfile = SiteContext.Current.CatalogContext.CurrentCatalogSet.EmailProfile;
    var emailService = new EmailService();
    var mailAddress = new MailAddress( order.GetBillingAddress().EmailAddress );
    string orderId = order.OrderId.ToString();
    string s = emailService.Send( emailProfile, "OrderConfirmation", mailAddress, orderId );

    // Get order details
    string orderNumber = Request.QueryString["orderNumber"];
    PurchaseOrder purchaseOrder = PurchaseOrder.FirstOrDefault( x => x.OrderId.ToString() == orderNumber );

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 07, 2012 @ 20:57
    Søren Spelling Lund
    0

    You're really close.

    You need to use the Guid type instead of string like so:

    PurchaseOrder purchaseOrder =PurchaseOrder.SingleOrDefault( x => x.OrderGuid== new Guid(orderNumber));

    Hope this helps.

  • Kent 30 posts 54 karma points
    Dec 11, 2012 @ 20:41
    Kent
    0

    That's what I needed. thanks!

Please Sign in or register to post replies

Write your reply to:

Draft