Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Unanswered

copying a data from purchase requisition to purchase order

Posted on by 114
Hi All,
I added a new field “TestFields” to the PurchReqTable (PurchReqTable.TestFields), and added the same field to the PurchTable (PurchTable.TestFields), I want to copy the data from the new field to the PurchTable.TestFields when I approve and complete the workflow on the purchase requisition.
I found the PurchAutoCreate_PurchReq class and in the setPurchTable method, I added purchTable.TestFields = purchReqTable.TestFields; But it didn't work.
When I changed to purchTable.TestFields = 'TEST';, purchTable successfully received the data.
I know that PurchReqTable and PurchTable are not 1 to 1 relationships, but I want to ignore them.
 
Where should I add the insertion code?
 
Regards
  • Raj Borad Profile Picture
    Raj Borad 408 on at
    copying a data from purchase requisition to purchase order
    Hi Danzel,
    You can use the insert method of PurchTable Table and add your logic there.
     
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,537 Super User 2024 Season 2 on at
    copying a data from purchase requisition to purchase order
    Hi Danzel,

    This should be straightforward. The variable purchReqTable should be set in this class, but probably without all fields. I suggest using the debugger to check the value in your custom field the moment you try to copy the value. 
  • Danzel Zuo Profile Picture
    Danzel Zuo 114 on at
    copying a data from purchase requisition to purchase order
    @André Thank you for your reply.
    In fact, I only added this one line of code, I didn't purposely fetch the data from the purchReqTable, and I'm not quite sure how to go about it.
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,537 Super User 2024 Season 2 on at
    copying a data from purchase requisition to purchase order
    Hi Danzel,

    Can you share the full coding you added? Then we can have a look together with you. When your will start debugging you might find out that the variable purchReqTable might not have a record selected or your extension field was not selected in a database call.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,537 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,520 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans