<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=6889170&amp;fmt=gif">
Skip to content
  • There are no suggestions because the search field is empty.

Methods | ScriptContext.GetOrCreateField(String, ChoiceFieldItemType) Method

Gets or creates the field matching both the given name and choice type.

Syntax

C# Copy
public FieldItem GetOrCreateField(
	string fieldName
        ChoiceFieldItemType choiceFieldItemType
)

Parameters
fieldName    String
               
The name of the field.
choiceFieldItemType    
ChoiceFieldItemType
                The choice type of the field.

Return Value
FieldItem
The existing field if the field exists and matches the choice type; otherwise, the newly created field.

Implements
IScriptContext.GetOrCreateField(String, ChoiceFieldItemType)

Exceptions

Exception Condition
Exception Thrown when a matching field name exists but the choice type does not match the field type.

Remarks
Calls GetField(String) to check if the field exists, then checks if the ChoiceFieldItemType matches the existing field. When neither match, calls CreateField(String, ChoiceFieldItemType) to create a new field instance.

See Also

Reference
IScriptContext Interface
GetOrCreateField Overload
Compiled.EDD.Scripting Namespace