Techno-Functional Dynamics 365 Data Model Explanation for Reporting, Part 23 of 25: Project Creation and Contract Table Process

Techno-Functional Dynamics 365 Data Model Explanation for Reporting, Part 23 of 25: Project Creation and Contract Table Process

How to Create Project Contracts in Microsoft Dynamics 365?

Microsoft Dynamics 365 Project Management and Accounting

In Microsoft Dynamics 365, ‘Project Management’ gives the most powerful tools to complete projects on time; within your budget.

Project Management and Accounting simplifies project-planning and execution by providing robust cost control and up-to-date operations and financial analytics.

It also, consequently, provides real-time integration with Supply Chain and Financial Management processes.

Project Creation and Contract Table Process

In this blog post series, we will provide you all technical and functional details of Project Creation and Project Contracts.

In Dynamics 365, you can create six types of projects; depending upon your overall project scoping and evaluations such as time and material. This can be used for customer billing: including cost for hours, expenses, items and fees.

Fixed price is for projects which consist of account transactions. It is also used for calculating the WIP. Moreover, you can calculate the completion of projects and groups of projects.

As for Investments, they are used for projects that don’t produce immediate earnings.

Cost Project, like an investment, is used for tracking the internal projects of organizations that are mostly shorter than investments projects.

Internal is used to track internal projects within the organization. Time projects are is used to track the time of projects and groups of projects. Project management and accounting is a very powerful tool to see the analytics of projects and groups of projects.

In this series, we do a walk-through of all essential parts of projects management and accounting; lets start with Functional Recap for Project Creations and Contract Creations.

Quick Functional Recap: Create Project Contracts in Dynamics 365

In Microsoft Dynamics 365, there are five stages of projects: Created, Estimated, Scheduled, In Process and Finished. We are using ‘contoso’ records for reference; you can use your company for creating the projects in Dynamics 365.

Lets have a quick functional recap of the creation of Project Creation.

STEP 1: Project Management and Accounting

  • Navigate to Project Management and Accounting, and then expand projects tab and click on All projects forms.

STEP 1: Project Management and Accounting

STEP 2: Create a New Project

  • In the action panel, click on New button to create the new project in Microsoft Dynamics 365.

STEP 2: Create a New Project

STEP 3: Create Project Contracts

  • To Create a New Contract in Microsoft Dynamics 365, Click on Plus Button.

this is for creating the new contracts

STEP 3: Create New Contract

STEP 4: New Project Contract

  • Write the Contract Name and Funding Type which can be “Customer”, “Organization”, “Grant” and “On hold” [depending upon the requirements]. For an example, however, we are selecting Customer Funding Type; but you can choose your own depending upon requirements. Select the funding source and click Ok; your contract will be created.

STEP 4: New Project Contract

STEP 5: Create New Project

    1. Click on the Create Project Button to create New Project.
    2. Select Project Type , Project Name, Project Contract , Customer and Project Manager; then click on Create project button to create the project.

STEP 5: Create New Project

STEP 6: Newly Created Project Added to Projects

  • Go to All Projects
  • See newly created project added to projects

STEP 6: Newly Created Project Added to Projects

Quick Technical Recap: MS Dynamics 365 Create Project Contracts

Lets have a quick technical recap of Project Creation process.

The primary tables used in this process are “ProjTable”, “CustTable”, “ProjGroup”, “ProFundingSource”, and “ProjInvoiceTable”. You can have a deep understanding of these tables by looking at the ERD Diagram below.

Entity Relationship Diagram (ERD):

This ERD diagram, which is used for item creation process, explains to you the relationship of all tables with its cardinality constraints.

Quick Technical Recap: MS Dynamics 365 Create Project Contracts

Code:

//Template class for Contract Creation
class ContractCreation
{
    public str CreateContract(str CustAcc)
    {
        ProjInvoiceTable projInvoiceTable;
        CustTable custTable;
        CustAccount custAccount;
        ProjFundingSource projFundingSource;
        NumberSeq numSeq;
 
        ttsbegin;
        projInvoiceTable.clear();
        projInvoiceTable.initValue();
        custTable = CustTable::find(CustAcc);
        numSeq = NumberSeq::newGetNum(ProjParameters::numRefProjInvoiceProjId(),true,true);
 
        projInvoiceTable.ProjInvoiceProjId  = numSeq.num();
        projInvoiceTable.CurrencyId         = "USD";
        projInvoiceTable.Description        = custTable.name();
        projInvoiceTable.insert();
 
        projFundingSource.ContractId         = projInvoiceTable.ProjInvoiceProjId;
        projFundingSource.CustAccount        = CustAcc;
        projFundingSource.FundingSourceId    = custTable.name();
        projFundingSource.FundingType        = ProjFundingType::Customer;
 
        projFundingSource.editProjFunder(true,projFundingSource.CustAccount);
 
        projFundingSource.insert();
 
        projFundingRule::createDefaultFundingRule(projInvoiceTable.ProjInvoiceProjId, projInvoiceTable.RecId);
 
        ttscommit;
        return projInvoiceTable.ProjInvoiceProjId;//Return Contract id
    }
}
 
//Runnable class for creation of project
class ibProjectCreation
{
    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    ///
    public static void main(Args _args)
    {
        ProjInvoiceTable projInvoiceTable;
        ProjTableType projTableType;
        NumberSeq projNumberSeq, numSeq;
        ProjId projIdLastSon, projectId;
        ProjTable projTable;
        ProjId projMask;
        ProjName _projName;
        Integer sonNum;
        ProjType _projType;
        ProjGroupId _projGroupId;
        ProjInvoiceProjId _projInvoiceProjId;
        ProjLinePropertyId _projInvoiceStatusId;
        ContractCreation   contract = new ContractCreation();
        str ContID;
   
        ContID =  "US-020";
 
        _projType = ProjType::TimeMaterial;
        _projGroupId = 'TM';
        _projName = "Proj-Test";
        _projInvoiceProjId = contract.CreateContract(ContID);//Contract created and return the newly created contract id
 
        projTable.ProjId = '000070';
        projectId = projTable.ProjId;
 
        projTable.Type = _projType;
        projTable.ProjGroupId = _projGroupId;
        projTable.Name = _projName;
        projTableType = projTable.type();
 
        projTableType.initProjTable();
 
        projTable.ProjInvoiceProjId = _projInvoiceProjId;
        projInvoiceTable = ProjInvoiceTable::find(_projInvoiceProjId);
        projTable.CustAccount = projInvoiceTable.Name;
        projTable.initFromInvoice(projInvoiceTable);
        projTable.CheckBudget = ProjGroup::find(_projGroupId).CheckBudget;
 
        if (_projInvoiceStatusId)
        {
            ProjLinePropertySetup::updateLinePropertyProj(projTable.ProjId, _projInvoiceStatusId, TableGroupAll::Table, true);
        }
 
        projTable.initFromCustTable(CustTable::find(projTable.CustAccount));
        if (ProjTable::exist(projTable.ProjId))
        {
            throw error("Project already exists");
        }
 
        if (!projTableType.validateWrite())
        {
            throw error ("Validations failed");
        }
 
        projTable.insert();
 
        if (projNumberSeq)
        {
            projNumberSeq.used();
        }
        else
        {
            projTable.clear();
 
            if (projNumberSeq)
            {
                projNumberSeq.abort();
            }
        }
        info (strfmt('Project %1 successfully created ', projectId));
    }
}

ProjTable:

      1. This table stores the information about the job id’s and is very useful for tracking job id.
      2. Status of the projects is also stored in this table; it is very useful in making reports of different statuses of projects.
      3. The ProjTable table contains information about each project and subproject.
Field Data Type Description
ProjId String Project Id is stored in this field which is the primary key of the table
JobId String This field contains the information about Job Id
CustAccount String Customer Account number is stored in this table
ProjGroupId String Project Group id is stored in this field which is used in finance reporting and ledger journal setup
Status Enum Status of the project is stored in this field which is used for the execution state of the projects
Description String This field contains description of the projects

CustTable:

      1. The CustTable table contains a list of customers for the accounts receivable and customer relationship management.
      2. This table contains information of customers. All the details of customers can be retrieved from this table.
      3. Customer balances, bank and invoices details are stored in this table. It can used in making different financial reports and forms for projects.
Field Data Type Description
AccountNum string This field contains the Account Number of customers
BankAccount Enum Bank account number of customers is stored in this table.
Party Int64 Party Id number is stored in this table.
DlvMode String Delivery Mode is stored in this field like “Truck” , “Air” and “Parcel”
CustGroup String Customer group is stored in this table which is used for financial reporting
InvoiceAccount String Customer invoice account is stored in this table.

ProjFundingSource:

      1. The ProjFundingSource table contains information about customers who are invoiced by the associated contract.
      2. This table contains contracts of projects; all contract details of projects can be retrieved from here.
      3. Party funding types and financial details can be track from this table. It is further useful in estimations of products and can be used in different financial reporting and forms.
Field Data Type Description
FundingSourceId string This field used to save corresponding Funding Source id of projects
FundingType Enum Funding type is saved in this field as there are different types of funding available in dynamics 365.
Party Int64 This field stored the information of party
ProjGrant Int64 This field used to save corresponding project grant of the projects
CustPurchaseOrder String This field contain information of customer purchase order for projects
ContractId String This field contain the contact id of projects

ProjGroup:

      1. This table is used to store information of ProjectGroup and Period id of the projects.
      2. The ProjGroup table groups projects together. The defined project groups contain settings that will be used during posting. The project groups can also be used for grouping project transactions in reports and inquiries
Field Data Type Description
ProjGroupId String This field contains information about project Group
PeriodId String Project period id is stored in this field
ProjType Enum Project type is stored in this field as there are six types of projects available in Dynamics 365.
Name String This field contains the information of project group Name.

ProjInvoiceTable:

      1. The ProjInvoiceTable table contains information about project contracts and is used to group projects.
      2. This table contains the information about project contract and projects types; which is used for creating the reports of projects.
Field Data Type Description
ProjInvoiceProjId String This field contains information for project invoice id
Name String Name of invoice account
ContractType Enum Contract type is stored in this field
CurrencyId String Price currency of all the projects is stored in this field
PostingProfile String Posting profile of projects is stored in this field
ProjPriceGroup String Project price group associated with party is stored in this table

Summary: How to Create Project Contracts in Microsoft Dynamics 365?

In today’s blog, you have finally learnt to create Projects and Project Contracts in Dynamics 365.

With proper parameters, you have gotten acquainted with creating Project Contracts with dimensions; and also gained a deeper understanding of the technical aspects of this step [including primary tables and ERD].

In the Next part of this series, we will explain Projects setups to you; including Billing Rules, Funding Sources, FundingRules and WorkBreakDown structures of the projects.

We sincerely hope that you enjoyed this technical blog post on Creating Project Contracts with Microsoft Dynamics 365. At Instructor Brandon, we aim to provide quality service at all times. If you feel the need to reach out to me, you can get in touch  here. – Brandon Ahmad, founder of Instructor Brandon and Dynatuners.

Videos