This blog post shows the code for extracting comments provided on workflow at the time of submission.
This method requires RecId of the record on which workflow was executed. I used this code for fetching comments provided at the time of submitting workflow on Purchase order.
public static Notes getComments(RecId _purchTableRecId)
{
WorkflowTrackingStatusTable workflowtrackingstatustable;
WorkflowTrackingTable workflowtrackingtable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
select firstOnly RecId from workflowtrackingstatustable
join RecId from workflowtrackingtable
where workflowtrackingstatustable.ContextRecId == _purchTableRecId //RecId of the record
&& workflowtrackingstatustable.TrackingStatus != WorkflowTrackingStatus::Cancelled
&& workflowtrackingtable.TrackingContext == workflowtrackingcontext::Workflow
&& workflowtrackingtable.TrackingType == workflowtrackingtype::Submission
&& workflowtrackingtable.WorkflowTrackingStatusTable == workflowtrackingstatustable.RecId
join Comment from workflowTrackingCommentTable
where workflowTrackingCommentTable.WorkflowTrackingTable == workflowtrackingtable.RecId;
return workflowTrackingCommentTable.Comment;
}
This method requires RecId of the record on which workflow was executed. I used this code for fetching comments provided at the time of submitting workflow on Purchase order.
public static Notes getComments(RecId _purchTableRecId)
{
WorkflowTrackingStatusTable workflowtrackingstatustable;
WorkflowTrackingTable workflowtrackingtable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
select firstOnly RecId from workflowtrackingstatustable
join RecId from workflowtrackingtable
where workflowtrackingstatustable.ContextRecId == _purchTableRecId //RecId of the record
&& workflowtrackingstatustable.TrackingStatus != WorkflowTrackingStatus::Cancelled
&& workflowtrackingtable.TrackingContext == workflowtrackingcontext::Workflow
&& workflowtrackingtable.TrackingType == workflowtrackingtype::Submission
&& workflowtrackingtable.WorkflowTrackingStatusTable == workflowtrackingstatustable.RecId
join Comment from workflowTrackingCommentTable
where workflowTrackingCommentTable.WorkflowTrackingTable == workflowtrackingtable.RecId;
return workflowTrackingCommentTable.Comment;
}
No comments:
Post a Comment