Job to Copy WBS (Work breakdown structure) from One Quotation to another

Recently i got chance to work on data replication tool from my period to another, where i need to create the WBS from one quotation to another quotation in some different period. i created the below job and through it is worth it to share on blog, i will keep posting some other similar job utlities that helps us in daily AX life.

static void CopyHierarchyFromOneQuotationToAnother(Args _args)
Hierarchy          hierarchy;
str             hierarchyId;
HierarchyTemplateCopying  hierarchyTemplateCopying;
HierarchyCreate       HierarchyCreate;
Args            args = new Args();
// Job copies the WBS (WORK BREAKDOWN STRUCTURE) from one Quotation to another.
salesQuotationTable salesQuotationTable = salesQuotationTable::find(“QA-100478”);// To Quotation
if (HierarchyLinkTable::findRefTableRecId(tablenum(SalesQuotationTable), SalesQuotationTable.RecId) == null)
//create Hierarchy record
hierarchyCreate = HierarchyCreate::construct(HierarchyType::Project);
hierarchy = hierarchyCreate.parmHierarchy();
hierarchyId = hierarchy.HierarchyId;
hierarchyId = HierarchyLinkTable::findRefTableRecId(tablenum(SalesQuotationTable), salesQuotationTable.RecId).HierarchyId;
hierarchy = Hierarchy::find(hierarchyId);
hierarchyTemplateCopying = new HierarchyTemplateCopying();
hierarchyTemplateCopying.parmHierarchyName(“QA-100479”);// From Quotation;


One Response to Job to Copy WBS (Work breakdown structure) from One Quotation to another

  1. Ashok says:

    very nice thanks…!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: