Validates the Entity object and reports any errors.
Before an Entity can be committed, it must be validated (even if no fields have been changed). If you are changing the contents of a record programmatically, you should make sure that your code provides valid data.
You should not attempt to parse and interpret the returned String programmatically, because the error text may change in future releases. If you want to try to correct the value in an field with incorrect values, you can use the GetInvalidFieldValues method to get the FieldInfo Object for that field.
Vous pouvez uniquement appeler cette méthode si l'objet Entity est éditable. Pour rendre un objet Entity existant éditable, appelez la méthode EditEntity de l'objet Session.
You can also call this method from within any hook to refresh the validation data that is available to the ClearQuest clients. However, be aware that using this type of validation too often might slow performance.
VBScript
entity.Validate
Perl
$entity->Validate();
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