Identifies the behavior of the specified field.
A field can be mandatory, optional, or read-only. If the entity is not an editable Entity object, this method always returns the value READONLY. If the Entity object is editable, because an action has been initiated, the return value can be READONLY, MANDATORY, or OPTIONAL.
This method never returns the value USE_HOOK. If the behavior of the field is determined by a permission hook, Rational® ClearQuest® will have already executed that hook and cached the resulting value. This method then returns the cached value.
You can use the GetFieldNames method to obtain a list of valid names for the field_name parameter.
VBScript
entity.GetFieldRequiredness(field_name)
Perl
$entity->GetFieldRequiredness(field_name);
VBScript
' Change all mandatory fields to optional ' Retrieve the collection of fields fieldNameList = GetFieldNames For Each fieldName in fieldNameList ' Find out if the selected field is mandatory fieldReq = GetFieldRequiredness(fieldName) if fieldReq = AD_MANDATORY ' Since it is, make it optional Then SetFieldRequirednessForCurrentAction fieldName, AD_OPTIONAL End If Next
Perl
# Change all MANDATORY fields to OPTIONAL # Retrieve the collection of fields $fieldnamelist = $entity->GetFieldNames(); foreach $fieldname (@$fieldnamelist) { # Find out if the selected field is mandatory $fieldreq = $entity->GetFieldRequiredness($fieldname); if ($fieldreq eq $CQPerlExt::CQ_MANDATORY) { # Since it is, make it optional $entity->SetFieldRequirednessForCurrentAction($fieldname, $CQPerlExt::CQ_OPTIONAL); } }