+1-888-365-2779
Try Now
More in this section

Forums / Ecommerce / Ecommerce Order Custom Field for Notes

Ecommerce Order Custom Field for Notes

3 posts, 0 answered
  1. Martin
    Martin avatar
    22 posts
    Registered:
    27 Sep 2013
    21 Oct 2014
    Link to this post

    Hi

     I'm using Global.asax to add new fields to the Orders table....

    I've used the example in the documentation to create a meta field which works fine:

                // Add a new meta field to the Order table
                App.WorkWith()
                    .DynamicData()
                    .Type(typeof(Order))
                    .Field()
                    .TryCreateNew("PurchaseNo", typeof(string))
                    .SaveChanges(true);

    However I need to add a meta field for Notes

    Using the above code creates a database field of type nvarchar(255)

    Is there a way to create a meta field which  will become nvarchar(max) in the database table?

    Regards

     Martin

     

  2. Ivaylo Angelov
    Ivaylo Angelov avatar
    68 posts
    Registered:
    27 Oct 2016
    23 Oct 2014
    Link to this post
    Hello Martin,

    Your code should look like the following to get the desired result:
    App.WorkWith()
        .DynamicData()
        .Type(typeof(Order))
        .Field()
            .TryCreateNew("Notes", typeof(string))
                .Do(f =>
                {
                    f.FieldName = "Notes";
                    f.ColumnName = "Notes";
                    f.Title = "Notes";
                    f.DBSqlType = "NVARCHAR(MAX)";
                    f.DBType = "LONGVARCHAR";
                })
            .Done()
    .SaveChanges(true);


    Regards,
    Ivaylo Angelov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Martin
    Martin avatar
    22 posts
    Registered:
    27 Sep 2013
    27 Oct 2014 in reply to Ivaylo Angelov
    Link to this post

    Many thanks Ivaylo

    That was perfect!

    Field now correctly updates

     Regards

    Martin

3 posts, 0 answered