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 );
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:
But it works if I send the email manually and pass an order number:
You're really close.
You need to use the Guid type instead of string like so:
Hope this helps.
That's what I needed. thanks!
is working on a reply...