You are viewing limited content. For full access, please sign in.

Question

Question

Must a field be created in Administration Console before being added with code?

asked on December 4, 2014
EntryInfo ei = Entry.GetEntryInfo(17, LFSession);
                    FieldValueCollection fvc = ei.GetFieldValues();
                    fvc.Add("TestField", "Chicken Parm");
                    ei.Lock(LockType.Exclusive);
                    ei.SetFieldValues(fvc);
                    ei.Save();
                    ei.Unlock();
                    ei.Dispose();

This code does not work. It produces the error, "Message: Field not found. [9016]". Does the field "TestField" have to already exist somewhere? Do I need to create the field with code before I add it?

0 0

Answer

SELECTED ANSWER
replied on December 4, 2014

The code above sets the field on the document, it does not create the field definition. Fields need to be defined in the repository before they can be set on documents. You can create fields through the SDK if that's want you need.

0 0

Replies

replied on December 4, 2014

It is possible to create fields with the SDK, but it would be unusual for you to want to define new ones on the fly.  You will typically be assigning fields that have already been created by an administrator.

0 0
replied on December 5, 2014

Thanks folks. Makes sense.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.