Skip to main content

How to fetch Values from WorkFlow Tables

How to fetch Values from WorkFlow Tables

Hi friends,
   I am facing a problem since many days and now i got the logic to fetch values from a workflow table, but still it’s for only PO and PR and i am working on the GL transaction also, here is the Code, Use copy and paste it in a job and run.
static void theaxapta_WorkflowHisory()
{
    WorkflowTrackingTable           workflowTrackingTable;
    WorkflowStepTable               workflowstepTable;
    WorkflowTrackingStatusTable     workflowTrackingStatusTable;
    WorkflowTrackingCommentTable    workflowTrackingCommentTable;

    utcdatetime     dt[];
    string100     Comment;
    int i;
    ;
    i = 1;
   select workflowtrackingtable join workflowsteptable
    where workflowsteptable.StepId == workflowtrackingtable.StepId
    &&    workflowtrackingtable.ContextRecId == PurchTable::find('NBH1112_PO000025').RecId;

   while select workflowtrackingtable
            where  workflowtrackingtable.ContextRecId == PurchTable::find('NBH1112_PO000025').RecId
    {

        dt[i] = workflowtrackingtable.createdDateTime;
        i ++;
        info(strfmt("Step Name == %1......  user Code: %2", workflowsteptable.Name,  workflowtrackingtable.User));
    }
    info(strfmt('User Approved: %1 - %2.....%3......%4.......%5..........', dt[1], dt[2],dt[3],dt[4]));

    select workflowTrackingCommentTable  where workflowTrackingCommentTable.TrackingId == workflowTrackingTable.TrackingId;
    while select workflowTrackingCommentTable  where workflowTrackingCommentTable.TrackingId == workflowTrackingTable.TrackingId
    {
        info(strfmt("Comment...=  %1",workflowTrackingCommentTable.TrackingMessage));
    }


//    select workflowTrackingCommentTable
//    where workflowTrackingCommentTable.TrackingId == workflowTrackingTable.TrackingId;
//
//    info(strfmt('Date Approved: %1', workflowTrackingCommentTable.TrackingMessage, DateTimeUtil::applyTimeZoneOffset(workflowTrackingCommentTable.createdDateTime, DateTimeUtil::getUserPreferredTimeZone())));
//

}

Note: This is rough code, you may need to update it as per your requirement.

Comments

Popular posts from this blog

Customization Tips for D365 for Finance and Operations How to configure Excel Add in D365 Finance and Operations August 1, 2021 by alirazazaidi I recorded how to configure Excel Addin for D365 finance and operations. How to configure Power BI out of the box dashboard on local VM Dynamics 365 for Finance and Operations July 17, 2021 by alirazazaidi Hi friends, here is video, which I recording during configuring Dynamics 365 Finance and operations out of the box dashboard on local VM. My session is held on Urdu Hindi User group on 1 August. For this I need to configure it. During development we need to configure these dashboards and some times we need to extend these dashboard. Hope this video will helpful to you. How hide SSRS Parameter RDP Menu Name Dynamics 365 Finance and Operations

  Again documentation class XYZUIBuilder extends SrsReportDataContractUIBuilder { public void build() { RecId hcmWorkerRecId; str name, menuItemName; FormBuildGroupControl grp; //Dialog dialogLocal = this.dialog(); XYZDC rdpContract = this.dataContractObject(); DialogField workerfieldDiff; DialogField _FromDate,_Todate; // Add the pay cycle field. menuItemName = this.controller().parmArgs().menuItemName(); workerfieldDiff = this.addDialogField(methodStr(XYZDC ,parmworkerrecid),rdpContract); // hcmWorkerRecId = HcmWorker::userId2Worker(curUserId()); if (menuItemName =="ESSReport") { workerfieldDiff.visible(false); workerfieldDiff.value(0); } _FromDate= this.addDialogField(methodStr(BEKenyaP9DC,parmFromDate),rdpContract); _Todate = this.addDialogField(methodStr(BEKenyaP9DC,parmToDate),rdpContract); } }

D365 : SEND EMAIL

 class SRSendEmail_D365 {            public static void main(Args _args)     {           SysMailerMessageBuilder messageBuilder = new SysMailerMessageBuilder();         Email   toEmail;         Email   fromEmail;                   try         {             FromEmail = "fromemail@xyzcompany.com";             toEmail   = "oemail@xyzcompany.com";             messageBuilder.setBody("Hello from D365", false);             messageBuilder.setSubject("Email Test from D365");             messageBuilder.addTo(toEmail);             // Note: not calling setFrom() defaults to the current user for SMTP client, whereas ...

CODE TO PDF IN AX 2012

static void Job1(Args _args) {         PurchPackingSlipController      ssrsController = new SrsReportRunController();         TradeDocumentReportContract     purchPackingSlipContract = new TradeDocumentReportContract();         SRSPrintDestinationSettings     printerSettings;         VendPackingSlipJour             VendPackingSlipJour;         Args                            args;         //select the latest record based on create date         while select VendPackingSlipJour             order by VendPackingSlipJour.createdDateTime DESC             where VendPackingSlipJour.PackingSlipId == 'LJ-01'         ...