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.
You can call this method only if the Entity object is editable. To make an existing Entity object editable, call the EditEntity method of the Session object.
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