# Custom field in delivery method

**URL:** <https://forum.litium.com/t/custom-field-in-delivery-method/1367>\
**Category:** Questions\
**Tags:** litium-6\
**Created:** [March 5, 2020, 9:40am UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367 "2020-03-05T09:40:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gonzalo](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gonzalo](https://forum.litium.com/u/Gonzalo)\
**Post date:** [March 5, 2020, 9:40am UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367/1 "2020-03-05T09:40:13Z")

</div>

Is it possible to add custom field to a delivery method?

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/9c40d5f17c9a1a061dd375c39ef327a555cc2f5d.png)

Litium version: 6.2.2

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [March 5, 2020, 10:10am UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367/2 "2020-03-05T10:10:56Z")

</div>

You can add custom panels in this views that you can handle your extra field and data.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/55b38f66eeb69e0b500ab282892a9e8ccf91c827.png)

---

<div class="post-metadata">

**Author:** ![Gonzalo](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gonzalo](https://forum.litium.com/u/Gonzalo)\
**Post date:** [March 5, 2020, 1:18pm UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367/3 "2020-03-05T13:18:47Z")

</div>

Yes, i tried that but doesn’t seem to show any extra custom field.

Here my code:  
using System.Linq;  
using Litium.Foundation.ModuleExtensions;  
using Litium.Foundation.Modules.ECommerce.Carriers;

```
namespace Litium.Accelerator.Mvc.Site.ECommerce.Panels
{
public partial class DeliveryJeevesField : System.Web.UI.UserControl, IPanelData<DeliveryCarrier>
{
    private readonly string _jeevesCommentKey = "JeevesComment";

    public void InitPanelData(DeliveryCarrier value)
    {
        // Get administrator comment that is stored as additional delivery info
        var jeevesComment = value.AdditionalDeliveryInfo.FirstOrDefault(x => x.Key == _jeevesCommentKey);
        if (jeevesComment != null)
        {
            JeevesCommentTextBox.Text = jeevesComment.Value;
        }
    }

    public void SavePanel(DeliveryCarrier value)
    {
        // Save administrator comment to additional delivery info
        var jeevesComment = value.AdditionalDeliveryInfo.FirstOrDefault(x => x.Key == _jeevesCommentKey);
        if (jeevesComment != null)
        {
            jeevesComment.Value = JeevesCommentTextBox.Text;
        }
        else
        {
            value.AdditionalDeliveryInfo.Add(new AdditionalDeliveryInfoCarrier(_jeevesCommentKey, value.ID, JeevesCommentTextBox.Text));
        }
    }

}
}

```

![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/fa829f79cb2f44d716043d80fc9f697e4ca05ee4.png)

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [March 5, 2020, 3:03pm UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367/4 "2020-03-05T15:03:09Z")

</div>

Try to use the `IPanelData<DeliveryMethodCarrier>` instead of the `IPanelData<DeliveryCarrier>`, the `DeliveryCarrier` is used during order creation.

---

<div class="post-metadata">

**Author:** ![Gonzalo](https://avatars.discourse-cdn.com/v4/letter/g/4bbf92/32.png) [@Gonzalo](https://forum.litium.com/u/Gonzalo)\
**Post date:** [March 5, 2020, 4:10pm UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367/5 "2020-03-05T16:10:56Z")

</div>

Ok, where can i save this data?

CustomData or Panels?

can i save it as DictionaryCollection?

Thanks

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [March 5, 2020, 4:33pm UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367/6 "2020-03-05T16:33:07Z")

</div>

You can stor the information on the `DeliveryMethodCarrier.CustomData` this object will be serialized to json and stored with the delivery method, so all datatypes that can be converted to and from json with [Json.Net](http://Json.Net) can be used.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [April 2, 2020, 4:33pm UTC](https://forum.litium.com/t/custom-field-in-delivery-method/1367/7 "2020-04-02T16:33:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
