In this post I'll be sharing a job to get purchase order workflow submitted userID and datetime.
Change the logic according to your requirement.
class WorkflowUserDatetime
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
WorkflowTrackingTable workflowTrackingTable;
WorkflowTrackingStatusTable workflowTrackingStatusTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
PurchTable purchTable = PurchTable::find('POV002357'); // Change the table name
select firstFast RecId, User,CreatedDateTime from workflowTrackingTable
order by RecId desc
join workflowTrackingCommentTable
where workflowTrackingCommentTable.WorkflowTrackingTable == workflowTrackingTable.RecId
exists join workflowTrackingStatusTable
where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatusTable.RecId
&& workflowTrackingStatusTable.ContextRecId == purchTable.RecId // Change table recid
&& workflowTrackingStatusTable.ContextTableId == purchTable.TableId // Change table ID
&& workflowTrackingTable.TrackingType == WorkflowTrackingType::Submission;// Change the enum value to approval to get approved user details
if (workflowTrackingTable.RecId > 0)
{
Info(strFmt("%1 - %2", workflowTrackingTable.CreatedDateTime , workflowTrackingTable. User));
}
}
}
Comments
Post a Comment