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)

Creating a project contract through X++ (New question)

(0) ShareShare
ReportReport
Posted on by

Hi experts,

I am here again, with problems creating a project contract through X++.

Previously, I was following https://dynamicsuser.net/ax/f/developers/51941/project-contract-creation-using-x , and apparently, I was lost at the step: "this.parmprojectcontract(projinvoiceTable.ProjInvoiceProjId);" shown inside the code. The user apparently did not mention where and how the parmprojectcontract method was or works. So I could not go any further than that steps.

Could anyone kindly guide me through the creation of a new project contract using X++ in Dynamics 365?

Thanks in advance.

Lincoln Poh

*This post is locked for comments

I have the same question (0)
  • Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Please try the job at the below link, which is a x++ job to create project contract.Its on AX2012, not sure whether it will work on D365 but its worth giving a shot.

    (AX 2012 - CREATING PROJECT CONTRACT - JobName: ProjectContractCreation under For R2 and R3)

    harish-m.livejournal.com/31981.html

  • Verified answer
    Community Member Profile Picture
    on at

    Hello Sukrut Parab & Chaitanya Golla

    Thank you so much for trying to help out.

    My apology for my late reply.

    @Sukrut Parab: I understand that parmprojectcontract is a parm method, but I did not know where should I parm it to. Now, I'm assuming it is being parmed to the form. However, in the end, I ended up removing that parm and modifying my code a little, and it still worked out well. Thanks for the help though!

    *Edit: When you mentioned Project Id, you actually meant Project contract ID, and not Project Id, right? Because Project Id belongs to another table, in the creation of Project...*

    @Chaitanya Golla: Previously, I tried that link, however, that version was too old, some of the methods do not exist in the current AX (365 For operation).

    For those who are following this thread, below lies the solution. You could just use this method inside a class or form and change it accordingly to suit your preference, and call the method using "createProjContract()".

    private void createProjContract() 
    {
    	info("Project contract is being created");
    
    	//Creating a new Project contract/ agreement
    	ttsbegin;
    	projInvoiceTable.clear();
    	projInvoiceTable.initValue();
    	custTable = CustTable::find(custAccount);
    	numSeq = NumberSeq::newGetNum(ProjParameters::numRefProjInvoiceProjId(),true,true);
    
    	projInvoiceTable.ProjInvoiceProjId  = numSeq.num();                
    	projInvoiceTable.CurrencyId         = "USD"
    	projInvoiceTable.Description        = custTable.name();
    	projInvoiceTable.insert();
    	
    	info("projInvoiceTable.ProjInvoiceProjId: " + projInvoiceTable.ProjInvoiceProjId);
    	projFundingSource.ContractId         = projInvoiceTable.ProjInvoiceProjId;
    
    	projFundingSource.CustAccount        = "USMF-00001";
    	projFundingSource.FundingSourceId    = custTable.name();
    	projFundingSource.FundingType        = ProjFundingType::Customer;
    	projFundingSource.PaymentTermsId     = "Net8"; 
    
    	//projFundingSource.PaymentscheduleId  = 
    	projFundingSource.editProjFunder(true,projFundingSource.CustAccount);
    
    	projFundingSource.insert();
    
    	projFundingRule::createDefaultFundingRule(projInvoiceTable.ProjInvoiceProjId, projInvoiceTable.RecId);
    
    	ttscommit;
    }
  • Rohin Profile Picture
    4,624 on at

    Thanks Lincoln,  I am successfully implement your code in my environment (Ax 2012 R2) , its working correctly there as well. Thanks for sharing....

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