Ecommerce Order Custom Field for Notes

Posted by Community Admin on 05-Aug-2018 17:12

Ecommerce Order Custom Field for Notes

All Replies

Posted by Community Admin on 21-Oct-2014 00:00

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

 

Posted by Community Admin on 23-Oct-2014 00:00

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
 

Posted by Community Admin on 27-Oct-2014 00:00

Many thanks Ivaylo

That was perfect!

Field now correctly updates

 Regards

Martin

This thread is closed