Returns a list of accessible actions for a given record (Entity object).
This method is similar to the GetActionDefNames method of EntityDef; however, the list returned by this method contains only those actions that can be performed on the Entity object in its current state. You can use this method before calling the EditEntity method of the Session object to determine which actions you can legally perform on the record.
In addition to listing only the actions that are allowed based on state, the returned list is also limited to the actions a user has permission to perform. However, this permission check is based only on group access permissions. If instead, the action or any base action has an access_control hook, that hook is not executed to determine if the user has permission to perform the action. Therefore, the user may get a "permission denied" error message when they execute one of those actions.
If this method is called from within a hook, then the user will always have permission to execute any action that is legal for the current state of the record.
VBScript
entity.GetLegalActionDefNames
Perl
$entity->GetLegalActionDefNames();
VBScript
set sessionObj = GetSession entityDefName = GetEntityDefName set entityDefObj = sessionObj.GetEntityDef(entityDefName) ' Search for a legal action with which to modify the record actionDefList = GetLegalActionDefNames For Each actionDef in actionDefList actionDefType = entityDefObj.GetActionDefType(actionDef) if actionDefType = AD_MODIFY Then sessionObj.EditEntity entity, actionDef Exit For End If Next
Perl
$sessionobj = $entity->GetSession(); $entitydefname = $entity->GetEntityDefName(); $entitydefobj = $sessionobj->GetEntityDef($entitydefname); # Search for a legal action with which to modify the record $actiondeflist = $entity->GetLegalActionDefNames(); foreach $actionname(@$actiondeflist) { $actiondeftype = $entitydefobj->GetActionDefType($actionname); if ($actiondeftype eq $CQPerlExt::CQ_MODIFY) { $sessionobj->EditEntity($entity,$actionname); } }