このメソッドは、フィールド動作を必須、オプション、読み取り専用のいずれかに設定する場合に使用します。アクションがコミットされた後、フィールドの動作は読み取り専用に戻ります。
このメソッドは、Entity オブジェクトが編集可能な場合にのみ呼び出すことができます。既存の Entity オブジェクトを編集可能にするには、Session オブジェクトの EditEntity メソッドを呼び出します。
ベース IBM Rational ClearCase® と IBM Rational ClearQuest® との統合において、Rational® ClearQuest レコードの必須フィールドに値が指定されていない場合、Rational ClearQuest レコードを Rational ClearCase チェックインに関連付けることはできません。 この操作を実行しようとしたユーザーは、例外エラーを受け取ります。ユーザーはまず、Rational ClearQuest レコードの必須フィールドの値を入力する必要があります。そうしないと、SetFieldRequirednessForCurrentAction メソッドを使用してフィールドの必要性を変更するように、スキーマが変更されて Modify アクションでフックが実行されることがあります。
VBScript
entity.SetFieldRequirednessForCurrentAction field_name, newValue
Perl
$entity->SetFieldRequirednessForCurrentAction(field_name, newValue);
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); } }