Copied to clipboard

Flag this post as spam?

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


  • Alessandro 31 posts 152 karma points
    Apr 06, 2022 @ 06:26
    Alessandro
    0

    use SearchOrder for custom properties

    Hi Matt, do you know if it is possible to use the SearchOrder method to find an order which has a certain custom property?

    I added to a order the following property:

    var p = context.Order.AsWritable(uow).SetProperties(new Dictionary<string, string>
    {
         { "axervePaymentId", capr.payload.paymentID }
    });
    

    wich is a unique property and I'd like to retrieve the order by paymentId.

    I'm completely a noob on lambda and linq so, if it is possible, a little snippet would be greatly appreciated.

    Thanks

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Apr 06, 2022 @ 08:13
    Matt Brailsford
    100

    Hi Alessandro,

    I think something like this should work

    var orders = _orderService.SearchOrders((where) => where.FromStore(STOREID)
        .And(where.IsFinalized())
        .And(where.HasProperty("axervePaymentId", "VALUE")));
    

    Hope this helps

    Matt

  • Alessandro 31 posts 152 karma points
    Apr 06, 2022 @ 08:38
    Alessandro
    0

    hello Mat, thanks a lot. It definitely works!

Please Sign in or register to post replies

Write your reply to:

Draft