C# how to add values in ItemFields inside EmbeddedSchemaField of a STUB component

108 views Asked by At

I have an embedded schema for a STUB component metadata field which has 4 fields and marked as "Allow Multiple Values", along-with other fields in SDL Tridion. I am using SDL Tridion Web 9.0.

The STUB component metadata is blank initially. I am using a save event handler in SDL Tridion to populate this metadata from External Metadata of ECL component. I am using EmbeddedSchemaField to hold initial metadata field for the embedded field, but I am unable to populate the ItemFields inside the EmbeddedSchemaField while saving. I am using the following code to initially hold blank field from collection of metadata Fields of my component.

_images = ((EmbeddedSchemaField)metadataFields["Images"]);

where metadataFields is the metadata fields collection.

While trying to add values to the ItemFields inside, I am trying to use

IList<ItemFields> _imagesFields = _images.Values;

but it gives me Count = 0. So I am unable to do anything with this any further. Any suggestions/hints will be very very appreciated.

0

There are 0 answers