PurchReqTable purchReqTable = PurchReqTable::findPurchReqId("002154");
PurchReqLine purchReqLine;
WorkflowParticipantExpenToken workflowParticipantExpenToken;
WorkflowParticipantExpenTokenLine workflowParticipantExpenTokenLine;
WorkflowUserList userList = WorkflowUserList::construct();
while select workflowParticipantExpenToken
where workflowParticipantExpenToken.ExpenditureDocumentType == WorkflowParticipantExpenDocumentType::PurchReq
&& workflowParticipantExpenToken.Name == "Project Manager"
{
info(strFmt("%1", workflowParticipantExpenToken.Name));
while select ProjId, SourceDocumentLine, BuyingLegalEntity, RecId
from purchReqLine
where purchReqLine.PurchReqTable == purchReqTable.RecId
{
changecompany(CompanyInfo::findRecId(purchReqLine.BuyingLegalEntity).DataArea)
{
workflowParticipantExpenTokenLine = WorkflowParticipantExpenTokenLine::findTokenLine(workflowParticipantExpenToken.RecId, purchReqLine.BuyingLegalEntity);
PurchReqWFExpendiParticipantProvider provider = PurchReqWFExpendiParticipantProvider::construct();
provider.documentType();
RefRecId dimensionAttributeSetRecId;
MarkupTrans markupTrans;
if (purchReqLine.ProjId)
{
provider.resolveProjectDistributions(purchReqLine.SourceDocumentLine, workflowParticipantExpenTokenLine, userList);
dimensionAttributeSetRecId = workflowParticipantExpenTokenLine.ProjectDimensionAttributeSet;
}
else
{
dimensionAttributeSetRecId = workflowParticipantExpenTokenLine.OrganizationDimensionAttributeSet;
}
if (dimensionAttributeSetRecId)
{
provider.resolveDimensions(userList, purchReqLine.SourceDocumentLine, dimensionAttributeSetRecId);
while select SourceDocumentLine from markupTrans where markupTrans.TransTableId == purchReqLine.TableId &&
markupTrans.TransRecId == purchReqLine.RecId
{
provider.resolveDimensions(userList, markupTrans.SourceDocumentLine, dimensionAttributeSetRecId);
}
}
//provider.Get
}
}
}
int i = 1;
for(i=1;i<=userList.getCount();i++)
{
info(userList.get(i));
}