Identifica il funzionamento del campo specificato.
Un campo può essere obbligatorio, facoltativo o di sola lettura. Se l'entità non è un oggetto Entity modificabile, questo metodo restituisce sempre il valore READONLY. Se l'oggetto Entity è modificabile, poiché è stata avviata un'azione, il valore di ritorno può essere READONLY, MANDATORY o OPTIONAL.
Questo metodo non restituisce mai il valore USE_HOOK. Se il funzionamento del campo è determinato da un hook di autorizzazione, Rational ClearQuest avrà già eseguito tale hook e individuato il valore risultante. Questo metodo restituisce quindi il valore individuato.
È possibile utilizzare il metodo GetFieldNames per ottenere un elenco di nomi validi per il parametro field_name.
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);
}
}