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

‘Creating a Position’ in Dynamics 365 F&S

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.

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

First, go to Human resources > Positions > Positions.

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

 

Step 2

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

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

Step 3

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

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

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.

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



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: Dynamics 365 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:

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.

Techno-functional Dynamics 365 F&S Data Model, Part 14 of 25 – 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:

In this post, we:

  • 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

Leave a Reply

Your email address will not be published. Required fields are marked *