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 :
Microsoft Dynamics AX (Archived)

Automatic Purchase Order After Purchase Requisition

(0) ShareShare
ReportReport
Posted on by 2,426

Hi All,
my client wants to use PO & PR Workflow in same time.
i had created both workflow.
and he need automatically creation of PO from once PR Approved.
So i setup automatic creation of po once PR Approved through purchase policy and batch job, it is working fine but problem is once PR Approved PO Is creating with Approved Status.
if we wants run PO workflow it should be with DRAFT Status.
So Please Help Me to solve this issue.
For Manual Creation of Purchase Order after completion of Purchase Requisition it is working fine -- small customization
Classes\PurchAutoCreate_PurchReq\endUpdate
public void endUpdate()
{
super();
// Calculate discount before purchTable is automatically changed to approval status
if (purchTable.ChangeRequestRequired)
{
purchTable.reread();
if(PurchParameters::find().AutomaticTotalDiscount)
{
purchTable.updateFinalDisc();
}
}
//purchTable.autoApproveChangeRequest(); commented this line
}

For Automatic
In purchase Requisition in setup policies they have given option as
Automatically Create Purchase Order
then in Periodic - Batch Purchase Order Generation from there Batch Job setup is done
and After approved status of Purchase Requisition only the batch job runs and purchase order is created and after succesful creation of purchase requisition The status of purchase requisition is changed to Closed Status..which means Purchase Order is created as per my knowledge
After successful creation of purchase order the status of purchase order is coming as Approval.we want to customize as Draft
Please Provide any help

Thanks,
Regards,

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Have you enabled Change management in Procurement and sourcing parameters?

  • AX 2012 r3 Profile Picture
    2,426 on at

    Hi martin,

    Yes it is in enable status.

    Regards.

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Does it all work if you do it manually? Don't you have, for example, a condition in for your workflow that excludes these orders?

    Also, don't forget you can debug code and see what's going on there.

  • AX 2012 r3 Profile Picture
    2,426 on at

    Hi martin,

    At starting they used to do manual at that time also it is coming as Approval Status.

    After Customizing Classes\PurchAutoCreate_PurchReq\endUpdate()

    The status is changing to Draft in Manual Creation

    I tried to debug the code.But Not working

    i placed Breakpoints in PurchReqPurchaseOrderGenerationBatch-run()

    and i tried placing in Purchtable - Init(),Validate()

    None of them are hitting

    Regards

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Before getting into a discussion about debugging, can you please that you're talking about the "current version" of Dynamics AX, i.e. AX 7?

  • AX 2012 r3 Profile Picture
    2,426 on at

    Hi Martin

    I am talking about AX 2012 R3

    Regards

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    All right, I've changed the version for this thread from "current version" to AX 2012. Please pay attention to the version, because it's often very important (like in this case).

    If you're trying to debug batch jobs, don't forget that they run in CIL, so you can't use the X++ debugger. You need Visual Studio in such cases. It's not difficult, but it's still often easier to first run your code in X++ and switch to CIL only when it's debugged. You can learn more about debugging on MSDN in Debugging in Microsoft Dynamics AX 2012.

  • AX 2012 r3 Profile Picture
    2,426 on at

    Hi Martin,

    There are many errors in development environment.

    So i generated Incremental CIL..It is not completing because of AOT Errors.

    Can i debug in Visual Studio

    Regards

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    If you haven't generated CIL, your changes in X++ aren't there when running batches.

    You'll have to fix your errors.

  • AX 2012 r3 Profile Picture
    2,426 on at

    Hi martin,

    They need it urgent.So i am searching for classes

    There is something that is actually showing status as Approved

    I am trying to find in Classes

    Please provide me any help in finding right path to customize code

    Regards

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans