Entity オブジェクトとレポートにエラーがないか検証します。
Entity をコミットするには、事前に検証しておく必要があります (フィールドが変更されていない場合でも)。レコードの内容をプログラムで変更する場合は、コードで必ず有効なデータを指定するようにしてください。
将来のリリースでエラー テキストが変更されることがあるので、戻された文字列はプログラムで構文解析および解釈をしないでください。 誤った値のフィールドの値を訂正する場合、GetInvalidFieldValues メソッドを使用すると、そのフィールドの FieldInfo オブジェクトを取得できます。
このメソッドは、Entity オブジェクトが編集可能な場合にのみ呼び出すことができます。既存の Entity オブジェクトを編集可能にするには、Session オブジェクトの EditEntity メソッドを呼び出します。
VBScript
set sessionObj = GetSession set entityObj = sessionObj.GetEntity("defect", "BUGID00000042") sessionObj.EditEntity entityObj, "modify" ' modify the Entity object status = entityObj.Validate if status = "" then entityObj.Commit else entityObj.Revert End If ' The Entity object is no longer editable
Perl
# Get the current session $sessionobj = $entity->GetSession(); # Select an entity to modify $entityobj = $session->GetEntity("defect","BUGID00000042"); # Take the modify action on the entity object $sessionobj->EditEntity($entityobj,"modify"); # ...make modifications to the entity object $status = $entityobj->Validate(); if ($status == ""){ $entityobj->Commit(); } else { $entityobj->Revert(); } # At this point, the entity object is no longer modifiable