SetFieldRequirednessForCurrentAction

설명

현재 조치 지속 기간 중에 필드의 동작을 설정합니다.

필드 동작을 필수, 선택적 또는 읽기 전용으로 설정하려면 이 메소드를 사용하십시오. 조치를 확약한 후 필드의 동작을 읽기 전용으로 되돌립니다.

Entity 오브젝트가 편집 가능한 경우에만 이 메소드를 호출할 수 있습니다. 기존의 Entity 오브젝트를 편집 가능하게 만들려면 Session 오브젝트의 EditEntity 메소드를 호출하십시오.

주: 후크가 필드 특성 또는 값을 변경한 후 변경된 필드 또는 모든 기타 필드에 해당하는 논리 변수를 새로 고쳐야 합니다. 필드 값을 설정하면 레코드 내 필드의 필요성 또는 값을 변경하는 후크가 시작됩니다. 후크 또는 스크립트는 로컬 변수를 새로 고쳐 레코드 내의 값과 동일한 상태를 유지할 수 있게 해야 합니다. 현재 값이 필요하면 로컬 변수를 새로 고치십시오.

기본 IBM Rational ClearCase® 및 IBM Rational ClearQuest®를 통합할 경우 Rational® ClearQuest 레코드에 값이 지정되지 않은 필수 필드가 포함되어 있으면 Rational ClearQuest 레코드를 Rational ClearCase 체크인과 연관시킬 수 없습니다. 이 조치를 수행하는 사용자는 예외 오류를 수신합니다. 사용자는 먼저 Rational ClearQuest 레코드의 필수 필드에 값을 입력해야 합니다. 또는 SetFieldRequirednessForCurrentAction 메소드를 사용하여 필드 필수 조건을 변경함으로써 수정 조치에서 실행할 후크를 제공하도록 스키마를 변경할 수 있습니다.

구문

VBScript

entity.SetFieldRequirednessForCurrentAction field_name, newValue 

Perl

$entity->SetFieldRequirednessForCurrentAction(field_name, newValue); 
ID
설명
entity
사용자 데이터 레코드를 나타내는 Entity 오브젝트. 후크 내에서 구문에 이 부분을 생략할 경우, Entity 오브젝트가 현재 데이터 레코드에 해당한다고 가정합니다(VBScript에만 해당).
field_name
엔티티의 올바른 필드 이름을 식별하는 문자열.
newValue
필드의 새 동작 유형을 식별하는 Long 값. 이 값은 Behavior 열거형 유형에 있는 상수 중 하나에 해당합니다. (USE_HOOK 상수에는 사용할 수 없습니다.)
Return value
없음

예제

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);
   }
} 

피드백