Показать сообщение отдельно
Старый 28.09.2017, 12:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
alirazazaidi: Workflow Approve Name  in Grid Dynamics Ax 2012 R3
Источник: https://www.tech.alirazazaidi.com/wo...cs-ax-2012-r3/
==============

Small tip, with reference at the end of post. I got small task, User want Last approval Name in grid at the result.

I wrote following code snippet as method in a required table and bind it to grid field.



X++:
display Name LastApprovalName()
{
WorkflowTrackingStatusTable workflowTrackingStatus;
WorkflowTrackingTable workflowTrackingTable;
WorkflowTrackingCommentTable workflowTrackingCommentTable;
UserInfo userInfo;
RecId _recId;
Name _name;

_recId=5637145391;
select firstFast RecId, User from workflowTrackingTable
    order by RecId desc
    join workflowTrackingCommentTable
    where workflowTrackingCommentTable.WorkflowTrackingTable == workflowTrackingTable.RecId
join UserInfo
    where UserInfo.id == WorkflowTrackingTable.User
    exists join workflowTrackingStatus
    where workflowTrackingTable.WorkflowTrackingStatusTable == workflowTrackingStatus.RecId
       && workflowTrackingStatus.ContextRecId == this.RecId
       && workflowTrackingStatus.ContextTableId == tableNum(MyTablelRequestTable) //PurchTable
       && workflowTrackingTable.TrackingType == WorkflowTrackingType::Approval;

if (workflowTrackingTable.RecId > 0)
{
    _name=userInfo.name;
}
else
{
    _name='';
}

return _name;
}




Original Code snippet is https://community.dynamics.com/ax/b/...-approved-date



Источник: https://www.tech.alirazazaidi.com/wo...cs-ax-2012-r3/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось mazzy; 28.09.2017 в 12:34.