Prefill Form

May 12, 2016 at 8:00 AM
I can prefill string or date field that way:
@Edit.Toolbar(actions: "new", contentType: "NewsItem", prefill = new { Category = "something" } )
and work fine for string, date or number fields...

But if try to set default value for "entity type" I get item not find.

How I can prefill "referenced" fields?
May 12, 2016 at 3:55 PM
You should use the entity GUID as the prefill, as it won't change (spelling, updates, other languages, ...)
May 12, 2016 at 4:22 PM
My View Entity is "DocumentList" and has entity field:

Category1 entity has Titile and Description string fields

In this (DocumentList) view I create action:
@Edit.Toolbar(actions: "new", contentType: "Document", prefill: new { Date = DateTime.Today, Category1 = Content.Category1[0].EntityGuid } )__

With this action I want to create new instance of "Document" with field : Date(Date), Title(string), Intro(string), Category1(entity Category1),,,
When new "Document" is opened the Date Field is OK, but the Category1 field is collapsed (no value, no options to add...)

If I use this code inside body of view:

@Content.Category1[0].EntityGuid I get guid value..

So what I doing wrong?
May 12, 2016 at 4:27 PM
It may be a bug - we just got one that could be related

If it is a bug, I'll fix it within the next 2-3 days