get WorkFlow Approval Name

WHILE select workflowtrackingstatustable
join workflowtrackingtable
where workflowtrackingstatustable.ContextRecId == PurchTable.RecId //RecId of the record
&& workflowtrackingtable.TrackingContext == workflowtrackingcontext::WorkItem
&& workflowtrackingtable.TrackingType == workflowtrackingtype::Approval
&& workflowtrackingtable.WorkflowTrackingStatusTable == workflowtrackingstatustable.RecId
{
     info(strFmt(“%1″,SysWorkflowHelper::getDirPartyNameFromUserId(workflowtrackingtable.USER)));
}

or

display HcmWorkerName displayWorkflowApproverName()
{
    WorkflowTrackingTable tracking;
    WorkflowTrackingStatusTable trackingStatus;
    WorkflowWorkItemTable workitem;
    HcmWorkerName ret = "";
    UserInfo user;

    select tracking order by tracking.createdDateTime desc join trackingStatus
        where tracking.WorkflowTrackingStatusTable == trackingStatus.RecId
        && tracking.TrackingType != WorkflowTrackingType::Completion
        && ((tracking.TrackingContext == WorkflowTrackingContext::Step) || (tracking.TrackingContext == WorkflowTrackingContext::Task))
        && trackingStatus.ContextTableId==this.TableId && trackingStatus.ContextRecId == this.RecId;
    select workitem where workitem.RefRecId == this.RecId && workitem.RefTableId == this.TableId &&
        ((workitem.Status == WorkflowWorkItemStatus::Pending) || (workitem.Status == WorkflowWorkItemStatus::Delegated));

    return HcmWorker::find(HcmWorker::userId2Worker(workitem.UserId)).name();


}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s