Techno-functional Dynamics 365 F&S Data Model Part 14 of 25 – Position Creation Process

Techno-functional Dynamics 365 F&S Data Model Part 14 of 25 – Position Creation Process

D365 Position Creation Process Techno-functional F&S Part 14

D365 Position Creation Process Techno-functional F&S Part 14

Today, we’re going to focus on one of the most important processes in the HR module application, which is position creation process in Dynamics 365. D365 Position Creation Process Techno-functional F&S Part 14 explains creation of position in Dynamics 365 Human Resources module application.

‘Creating a Position’ in MS Dynamics 365 F&S

Positions are an important element of the lower level of an organization hierarchy, Position is the basic building block that helps form a hierarchy structure. Simply stated, a position is an individual instance of a job, for example, the position, “ERP Manager”. This just one of the positions associated with the job, “ERP Manager.” Positions exist in a department and are assigned to workers allocated to specific roles in an organization.

How to Create Position Manually: Dynamics 365 F&S Functional Walkthrough

Step 1: Go to Positions in Human Resources

First, go to Human resources > Positions > Positions.

How to Create Position Manually: Dynamics 365 F&S Functional Walkthrough

Step 2: Click on +New to Create Position

After that, click on the ‘+New’ tab at the top left corner. This will direct you to ‘Create Position.

Step 2: Click on +New to Create Position

Step 3: Add Relevant Fields in Dynamics 365 Finance and Operations

Then, It will open the dialog where you will be adding relevant fields.

Step 3: Add Relevant Fields in Dynamics 365 Finance and Operations

After you click on the “Create Position”, you will be redirected to the ‘detail form’ where you will be adding details in the general section. These details correspond to different attributes that define and register the agreed-upon relationship of the worker in the listed organization.

Step 3: Add Relevant Fields in Dynamics 365 Finance and Operations

Looking for Microsoft Dynamics 365 Training Courses, Instructor Brandon can help you in this as we have the most advanced Dynamics 365 Training Courses from Microsoft along with Top Level Certifications which can add real-time value and enhance your career as a professional in IT World.

Moreover, you can also read about Microsoft courses and Dynamics 365 certifications with every possible detailed information provided.

Microsoft training courses and Dynamics 365 certifications
Expand the Position duration section (this can be the duration of the contract) and set the relevant fields. After that Expand the Reports to position section (this defines the immediate relationship)

Click New to open the ‘drop-down list’ dialog. In the Reports to the field, enter, or select a value and click Create.

Techno-functional Dynamics 365 F&S Data Model, Part 14 of 25 – Position Creation Process

Expand the Worker Assignment section (this relates to the active project/assignment that the position is applied to). Click New to open the drop dialog. In the worker field, enter or select a value and Create Worker Assignment.

Techno-functional Dynamics 365 F&S Data Model, Part 14 of 25 – Position Creation Process

Expand the Payroll section. In the Pay cycle field, enter or select a value. In the Paid by field, enter or select a value, and in the Annual regular hour’s field, enter a number.

Techno-functional Dynamics 365 F&S Data Model, Part 14 of 25 – Position Creation Process

Expand the other sections and add relevant details to fields. Click on the “Save” button.

Now, we move on to the technical part of creating a position.

The Data Model Behind the Position: D365 Position Creation Process F&S Technical Walkthrough

We focused on the basic functional process that is involved in properly defining a position and now we are going to move on to describe the technical aspect of creating a position.

Entity Relationship Diagram: D365 Position Creation Process

Exhibited in the ERD diagram, These are some of the important tables involved in creating a position in Dynamics 365. You can see the primary tables, the relationships, and the cardinality constraints.

Entity Relationship Diagram: D365 Position Creation Process

Below you will see a Runnable Class to create a position

// Using USMF Contoso Company for sample data. 
class ibCreatePosition
{        

    /// <summary>
    /// Runs the class with the specified arguments.
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {
        HcmPosition hcmPosition, hcmParentPosition;
        HcmPositionDetail hcmPositionDetail;
        HcmTitle hcmTitle;
        HcmJob hcmJob;
        PayrollPayCycle payCycle;
        CompanyInfo companyInfo;
        PayrollWorkCycle payrollWorkCycle;
        HcmPositionHierarchy hcmPositionHierarchy;
        HcmPositionHierarchyType hcmPositionHierarchyType;
        HcmPositionWorkerAssignment hcmPositionWorkerAssignment;
        HcmWorker hcmWorker;
        HcmReasonCode hcmReasonCode;
        PayrollPositionDetails payrollPositionDetails;
        OMOperatingUnit omOperatingUnit;
        HcmPositionDuration hcmPositionDuration;
        HcmPositionType hcmPositionType;

        HcmPositionId hcmPositionId, parentPostionId;
        utcdatetime                 minDateTime = DateTimeUtil::minValue();
        utcdatetime                 maxDateTime = DateTimeUtil::maxValue();
        utcdatetime					today = today();

        hcmPositionId = '000598';
        hcmTitle = HcmTitle::findByTitle('IT Manager');
        hcmJob = HcmJob::findByJob('ERP Manager');
        payCycle = PayrollPayCycle::findByPayCycle('m');
        companyInfo = CompanyInfo::find();
        omOperatingUnit = OMOperatingUnit::findName('IB Consultant Services', OMOperatingUnitType::OMDepartment);
        payrollWorkCycle = PayrollWorkCycle::findByCycle('Standard 40 Mon-Sun');
        hcmWorker = HcmWorker::findByPersonnelNumber('000158');
        hcmReasonCode = HcmReasonCode::findByReasonCode('Industry');
        hcmParentPosition = HcmPosition::findByPosition('000108');
        hcmPositionType = HcmPositionType::findByType('Full-time');

        //validate the Position Id if it exists or not
        hcmPosition = HcmPosition::findByPosition(hcmPositionId);
        if(!HcmPosition::exist(hcmPosition.recId))
        {
            //Header details of Position
            ttsbegin;
            hcmPosition.clear();
            hcmPosition.initValue();
            hcmPosition.PositionId = hcmPositionId;
            hcmPosition.insert();
			//Add Position Duration
            hcmPositionDuration.initValue();
            hcmPositionDuration.Position = hcmPosition.RecId;
            hcmPositionDuration.ValidFrom = today();
            hcmPositionDuration.ValidTo = maxDateTime;
            hcmPositionDuration.insert();
			//Add report to position details
            hcmPositionHierarchy.initValue();
            hcmPositionHierarchy.Position = hcmPosition.RecId;
            hcmPositionHierarchy.ParentPosition = hcmParentPosition.RecId;
            hcmPositionHierarchy.PositionHierarchyType = HcmPositionHierarchyType::lineHierarchyType();
            hcmPositionHierarchy.ValidFrom = today();
            hcmPositionHierarchy.ValidTo = maxDateTime;
            hcmPositionHierarchy.insert();
			//Add worker assignment details
            hcmPositionWorkerAssignment.initValue();
            hcmPositionWorkerAssignment.Position = hcmPosition.RecId;
            hcmPositionWorkerAssignment.AssignmentReasonCode = hcmReasonCode.RecId;
            hcmPositionWorkerAssignment.Worker = hcmWorker.RecId;
            hcmPositionWorkerAssignment.ValidFrom = today();
            hcmPositionWorkerAssignment.ValidTo = maxDateTime;
            hcmPositionWorkerAssignment.insert();
			//Add paycycle details
            hcmPosition.initValue();
            payrollPositionDetails.Position = hcmPosition.RecId;
            payrollPositionDetails.PayCycle = payCycle.RecId;
            payrollPositionDetails.PaidByLegalEntity = companyInfo.RecId;
            payrollPositionDetails.PayrollNormalHours = 8;
            payrollPositionDetails.WorkCycle = payrollWorkCycle.RecId;
            payrollPositionDetails.ValidFrom = today();
            payrollPositionDetails.ValidTo = maxDate();
            payrollPositionDetails.insert();

            //Line details of Position
            hcmPositionDetail.initValue();
            hcmPositionDetail.Position = hcmPosition.RecId;
            hcmPositionDetail.PositionType = hcmPositionType.RecId;
            hcmPositionDetail.Description = "ERP Dev Manager8";
            hcmPositionDetail.Department = omOperatingUnit.RecId;
            hcmPositionDetail.Job = hcmJob.RecId;
            hcmPositionDetail.Title = hcmTitle.RecId;
            hcmPositionDetail.FullTimeEquivalency = 1;
            hcmPositionDetail.ValidFrom = minDateTime;
            hcmPositionDetail.ValidTo = maxDateTime;
            hcmPositionDetail.insert();
            ttscommit;
        }
		else
        {
            error(strfmt("The specified record %1 already exist", hcmPosition.PositionId));
        }

    }

}

Although there are many tables included in this process, we’re going to focus on two major tables. The two major tables we will focus on are ‘HcmPosition and ‘HcmPositionDetail.’ Let’s go ahead and start with HcmPosition.

HcmPosition:

HcmPosition table contains a record for the position that is used with main, HRM, and payroll tables. The fields in this table are dictated to define a position in an organization. This table stores the header information of the Position. This table is useful for HR and Payroll modules in Dynamics 365. Let’s have a look at the types of data HcmPosition contains:

  • This table contains the information of position that can be assigned to the worker that can be measuring employee performance, providing an objective tool to enable the assessment and rating of an individual’s achievement against their specified goals

Below, we have listed other significant fields of the HcmPosition, the data types along with their respective descriptions.

Field Data Type Description
PositionId string This field contains the position id number

Now let’s look at HcmPositionDetail.

HcmPositionDetail:

The HcmPositionDetail table provides date effective information that is related to a specific position.
Let’s have a look at some characteristics of the HcmPositionDetails table:

  • Payroll details can be added to the position and this table contains that information.
  • This table is also maintaining the worker position assignment.

Listed below are a few important fields, data types along with the description.

Field Data Type Description
Description string This field contains the description of the position
Job int This field contains the reference of job
Position int This field contains the reference of header table HcmPosition
Title int Stores the reference of the title
ValidFrom dateTime This field contains the effective start date
ValidTo dateTime This field contains the effective end date

Conclusion: D365 Position Creation Process Techno-functional F&S Part 14

In this technical blog post D365 Position Creation Process Techno-functional F&S Part 14, what we have learnt is as following:

  • covered the position creation process in Dynamics 365
  • reviewed the technical side of creating a position
  • discussed two major tables: HcmPosition and HcmPositionDetail
  • discussed ways in which to use both tables.

We sincerely hope that you enjoyed part 14 of our exciting series on the Dynamics 365 data model. We aim to provide quality service at all times.  And as always, if you need to reach me, you know how to get in touch by reaching out to me here.  – Brandon Ahmad, founder of InstructorBrandon and Dynatuners

Videos