指定されたフィールドの動作 を識別します。
フィールドは、必須、オプション、読み取り専用のいずれでもかまいません。エンティティが編集可能 Entity オブジェクトでない場合、このメソッドは常に値 READONLY を戻します。Entity オブジェクトが編集可能な場合、アクションは開始されているので、戻り値は READONLY、MANDATORY、OPTIONAL のいずれでもかまいません。
このメソッドは、値 USE_HOOK を戻すことはありません。フィールドの動作が許可フックによって判別される場合、Rational® ClearQuest® によってそのフックは既に実行されていて、結果の値がキャッシュされています。その後、このメソッドにより、キャッシュ値が戻されます。
GetFieldNames メソッドを使用すると、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);
}
}