Copied to clipboard

Flag this post as spam?

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

  • Kenni Rau 8 posts 109 karma points
    Mar 01, 2021 @ 12:22
    Kenni Rau

    Custom order properties

    I'm in need of an array property on an order which contains objects. I have tried to add the property with the following code:['productDetailsList'] =['productDetailsList'] ||  {
        value: [],
        isReadOnly: false,
        isServerSideOnly: false
    vm.tempSeriesEntry = {
        sku: "SKU1337",
        seriesNumber: "SERNUM1337",
        isReturned: false

    I see the property correct when I log the object, but when I try to save the order I get the following error: Failed to save order: The request is invalid.

    I have tried to change to value to bool, int og string and it works just fine. Is it not possible to have an array as the value?

  • Matt Brailsford 3020 posts 15702 karma points MVP 7x c-trib
    Mar 01, 2021 @ 13:45
    Matt Brailsford

    Hi Kenni,

    All properties are currently stored as strings so you'd need to serialize / deserialize the array when setting / getting the property value.

    We have an enhancement request to make this more strongly typed, but it isn't something we currently have in place so for the time being, you'll need to handle the conversion yourself.

    Maybe wrapping the code in an extension method for the time being would do the trick.

    public static class OrderExtensions
         public static List<SeriesEntry> GetProductDetails(this OrderReadOnly order) 
            => JsonConvert.DeserializeObject<List<SeriesEntry>>(['productDetailsList']);
        public static void SetProductDetails(this Order order, List<SeriesEntry> entries) 
            => order.SetProperty("productDetailsList", JsonConvert.SerializeObject(entries));

    Hope this helps


  • Kenni Rau 8 posts 109 karma points
    Mar 02, 2021 @ 08:40
    Kenni Rau

    Hey Matt,

    I'll just serialize and deserialize then, thanks ;)

Please Sign in or register to post replies

Write your reply to: