web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

(0) ShareShare
ReportReport
Posted on by

Hello folks,

I am using purchAutoCreate_Sales in x++ code to create the purch orders, it works fine and creates a PO.

However need to ensure that the  created PO is submitted to the workflow through the code.

Upon checking the workflow I found that type of workflow type  is VendInvoiceRecordingTemplate also found this URL but cannot figure out what should I replace custinvoiceTable for my workflow.

Initially I thought it should be vendinvoiceinfotable, however looks like that is not the correct table as none of the PO created via purchAutoCreate_Sales are creating recs in that vendinvoiceinfotable even after I manually confirm the PO.

Please suggest a solution.

Thanks

Mav

  • Sukrut Parab Profile Picture
    71,637 Moderator on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    There is vendor invoice journal workflow, vendor invoice workflow, vendor invoice line worklow etc. in AP module. Where do u see purchase invoice journal workflow ?

    Also note, if you enable vendor invoice automation all the invoices created through Data management as pending vendor invoices submitted automatically to the workflow using process automation, you can take a look at that as well.

  • Mav Profile Picture
    on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Hello,

    Any update on this would be really helfpul.

    Thanks

    Mav

  • Mav Profile Picture
    on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Its standard out of the box OOB purchase invoice journal workflow.

  • Sukrut Parab Profile Picture
    71,637 Moderator on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    The workflow you are trying to submit on PO is custom created workflow or are u using standard workflow ?Is its custom then you might have to add custom method which is going to be similar to custInvoiceTable which just sets the state on the workflow on the originating table.

  • Mav Profile Picture
    on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Hello Sukrut,

    No problem, I am using VendInvoiceRecordingTemplate type workflow, which is accessible at  action pane workflow of purchase order.

    I am trying to replace the code from this link which is for custinvocetrans to that of purchtable.

    I am NOTfacing any challenge in selecting purchtable record , only challenge I am facing is how to replace below line of code with purchtable as I am unable to find any setWorkflowState() or similar function at purchtable.

    "custInvoiceTable::setWorkflowState(_custInvoiceTable.RecId, CustFreeInvoiceWFApprovalState::Submitted); "

    Thanks

    Mav

  • Sukrut Parab Profile Picture
    71,637 Moderator on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Sorry , I did not understand what is missing.  Can you please explain which workflow you are using and what kind of challenges you have for selecting puchtable record.

  • Mav Profile Picture
    on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Hello Sukrut,

    Yes that was done.

    Only thing pending is to replace below line of code with Purchtable and I coulld not find any setWorkflowState() or similar in Purctable code.

    custInvoiceTable::setWorkflowState(_custInvoiceTable.RecId, CustFreeInvoiceWFApprovalState::Submitted);

    Thanks

    Mav

  • Sukrut Parab Profile Picture
    71,637 Moderator on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Hi Mav , 

    Did you try using method  activateFromWorkflowType  from class workflow to submit PO to workflow? Check code below, recId parameter should be the recId of Purchtable. 

    //Activate the workflow
    Workflow::activateFromWorkflowType(workFlowTypeStr(YourWorkflow), recId, "@AccountsPayable:VendChangeProposalSubmit_SubmittedMessage", NoYes::No);

  • Mav Profile Picture
    on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Hello  all,

    Anyone any update on this would be helpful.

  • Mav Profile Picture
    on at
    RE: Submitting purch order created using purchAUtoCreate_sales in X++ to workflow through code

    Hello Andre,

    Any update on above would be helpful.

    Thanks

    Mav

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

Product updates

Dynamics 365 release plans