Returns the behavior (requiredness) of a field as defined in the schema for a given state. If no state is given, it returns the default behavior (requiredness) for the field. A field can be mandatory, optional, or read-only.
You can use the GetFieldNames method of the Entity object to obtain a list of valid names for the field_name parameter.
VBScript
entitydef.GetFieldRequiredness (field_name, state_name)
Perl
$entitydef->GetFieldRequiredness($field_name, $state_name);
VBScript
' get field requiredness as defined in the schema. ' Assuming we are in a hook entitydefname = GetEntityDefName current_state_name = LookupStateName entitydef = session.GetEntityDef(entitydefname) requiredness = entitydef.GetFieldRequiredness("Myfield", current_state_name)
Perl
# get field requiredness as defined in the schema. # Assuming we are in a hook my $entitydefname = $entity->GetEntityDefName(); my $current_state_name = $entity->LookupStateName(); my $entitydef = $session->GetEntityDef($entitydefname); my $requiredness = $entitydef->GetFieldRequiredness("Myfield", $current_state_name);