Custom Field on Forum Post
Hi,
I have added a custom field onto both the Forum Thread and Forum Post items. However in my code when I try to extract the value of that field I cannot call GetValue on the ForumPost class but am able to on ForumThread. Is this a bug or am I just missing something completely obvious?
Thanks
Hi, Richard.
Thank you for contacting us.
Unfortunately, the GetValue extension method has not been implemented for the ForumPost class. I will need to check to see if this is expected or a bug and I will get back as soon as I know.
To create custom fields in pages you must first make PageData into a dynamic meta type:
var metaManager = Telerik.Sitefinity.Data.Metadata.MetadataManager.GetManager();
if
(metaManager.GetMetaType(
typeof
(PageData)) ==
null
)
var type = metaManager.CreateMetaType(
typeof
(PageData));
metaManager.SaveChanges();
App.WorkWith().DynamicData().Type(
typeof
(PageData)).Field().TryCreateNew(
"MyPageDataField"
,
typeof
(
string
)).SaveChanges(
true
);
var dynamicContent = App.WorkWith().DynamicData().Fields().Where(dc => dc.FieldName ==
"MyPageDataField"
).Get();
var pg = App.WorkWith().Pages().Where(pk => pk.Title ==
"pagetitle"
).Get().SingleOrDefault();
pg.Page.SetValue(
"MyPageDataField"
,
"somevalue"
);
Hello, Richard.
Just to follow up, the issue with GetValue and ForumPost is a bug which will be fixed in an upcoming release. You can follow it in PITS here.
I apologize for any inconvenience this causes you. Please let us know if we can be of further assistance.
All the best,
Randy Hodge
the Telerik team
Hi,
I am writing here to let you know that the issue is fixed in the latest internal build!
You can now create custom fields for forum posts using the API.
If there are any issues with this, don't hesitate to contact us.
Regards,
Bonny
Telerik