volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Off

Programatically add MetaField to Edit/View Form

I am currently creating my MetaFields for both MetaDataPlus and BusinessFoundation programatically.

When using MDP everything works as expected and the added fiels show up om the MDP-class when viewing i.e lineitems.

But when adding metafields to a BusinessFoundation object it only gets added to the specified class and I manually have to add the fields to the Form-views (Edit Form, View Form).

Does anyone have any suggestions on how to programatically add metafields to the forms for a specific metaclass?

#121509
May 12, 2015 15:34

Same issue as I'm having in this post: Make custom meta fields display in Commerce Manager contact management

Does anybody have an answer for this?

#121610
Edited, May 15, 2015 9:17

I'm guessing there is no solution to this besides handling this manually..

#122038
May 26, 2015 9:42

That's my conclusion as well, but it would be nice with a confirmation from EPiServer. This seems like a fairly straight forward thing to accomplish, so I don't understand why it isn't possible.

#122040
May 26, 2015 9:49
Vote:

After adding the metafields to the metaclass you can add the field to the desired form by code as well.

The function to use is:
FormController.AddMetaPrimitive(string metaClassName, string formName, string fieldName)
(Mediachase.BusinessFoundation.MetaForm.FormController)

The Form names are:

Edit Form -> [MC_BaseForm]
Short Info Form -> [MC_ShortViewForm]
View Form -> [MC_GeneralViewForm]

#144850
Feb 19, 2016 16:40

Thank you Mark!

#145424
Mar 03, 2016 14:47
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.