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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Import WBS lines in project purchase order in D365 through X++ code

dasdasd Profile Picture dasdasd 841
Recently I have a requirement of importing the work breakdown structure lines on purchase order lines as per associated project. So for achieving the requirement I have develop a job that can get the WBS lines and import those line on purchase order line through AXPurchLine class. Please see below screenshots.

Work break down structure lines which needs to be imported:














Source code of a method which breakdown in three images:


Image 1.1:

Explanation of below source code image:
  • Initialize of the tables and AXPurchLine class.
  • Get purchase order. (Here I have provided hard coded Purch Id) 
















Image 1.2:

Explanation of below source code image:
  • Query to iterate smmActivityParentLinkTable table that contains the references to entities which are associated with an activity.
  • Sub query to iterate PSAActivityEstimates table that contains project quotation estimates.
  • Declaration of  AXPurchLine class.
  • Set OOTB Parm methods of the class that can handle the given values.

















Image 1.3:

Explanation of below source code image:
  • For parm method "parmVariantId" get variant Id of the Purchase order Line Item through InventDimCombination.
  • For parm method "parmPurchUnit" get purchase unit id through InventTableModule table.
  • Save method of AXPurchLine class that inserts the records also runs all the possible validations for purchase order lines.











Result:



This was originally posted here.

Comments

*This post is locked for comments