Flow - Submit Timesheets to Xero

TwixRiva allows you to submit timesheets to Xero. The source data can be from any standard and custom object that can represent a timesheet information in Xero. After the mapping is done, simply configure a trigger such as a process builder to call a function to push the timesheet record to Xero.

Steps to perform to set it up:

Step 1 - Identify your source object in the mapping. For this example, we have created a custom object Timesheet to better illustrate the mapping setup. The Timesheet object will be the source object.

These steps below are very important. Xero is very strict when it comes to Timesheets. And rightly so, it drives employees pay slips, and you do not want to get that wrong.

Salesforce Data

Xero

Description

Salesforce Data

Xero

Description

Timesheet related data

 

 

Timesheet__c.Resource_Xero_Id__c

EmployeeId

This provides reference for the Xero employee in the timesheet. This recordId is available in Xero. When you have connected your salesforce org to Xero, the information can be retrieved from the Xero Setting tab.

Open the App Launcher, search for “Xero Setting List” tab, click the the “Employee List” Tab

 

Timesheet__c.Date_From__c

StartDate

Identifies the start date of the Pay period of the timesheet. This is defined in Xero.

Timesheet__c.Date_To__c

EndDate

Identifies the end date of the Pay period of the timesheet. This is defined in Xero.

 

Time Logs related data

Salesforce Data

Xero

Description

Salesforce Data

Xero

Description

Time_Log__c.Earnings_Rate_Id__c

EarningRateID

Identifies the Earning Rate ID for the time log. This information is available in the Xero Settings. When you have connected your salesforce org to Xero, the information can be retrieved from the Xero Setting tab.

 

Time_Log__c.Date__c

 

This is the date when the resource/employee log the number of hours.

This will not be sent to Xero, however, the date will be used for aggregating the total hours for each dates.

Time_Log__c.Hours_Worked__c

NumberOfUnits

The number of hours for the time log

 

Step 2 - When the mapping is ready, navigate to Setup - > Custom MetaData Types - > Managed Records Next to XeroAutoCreate TimeSheet Mapping.

Step 3 - Create a new mapping by clicking the “New” button.

Note:

  • Status - Specify the status of the timesheet when it it sent to Xero. This can be map from a custom field or a literal value like in the example. The values are “DRAFT” and “AUTHORISED”

  • Line Related to Object - This is the line item object for the timesheet. This is where the “Time Log Date” and “NumberOfUnits” field reference should be available.

  • ParentId - Repreresents the relationship field of the “Line Related to Object” to the Timesheet source object. This can either be the look-up field or the parent field in a mater-detail relationship.

 



Step 4 - After the mapping is created, define a trigger on when to send the timesheet to Xero. For this example, we are going to use a process builder. When the timesheet is approved, we are going to call a an apex class to pass the record Id of the timesheet record. In the Apex class search field, type in “Push Record to Xero”. Set the following parameters for the Set Apex Variables.

Parameter Name

Value

Description

Parameter Name

Value

Description

XeroObject

Timesheet

This is the standard value.

SourceObject

Timesheet__c

This is the the API Name of the source object of our timesheet data

recordId

Timesheet__c.Id

This is the field reference for the record Id of the timesheet record

 

 

Step 5 - Activate the process builder.