Configure Business Rules for Positions
You can create default and validation rules in these Positions processes and pages:
- Request a New Position
- Request a Position Change
- Positions
- Create Positions
- Duplicate Positions
- Update Positions
- Correct Positions
Here’s a list of the default and validation rules you can create in these pages:
- Default the value in a position DFF based on a position attribute
- Validate Position Name
- Validate Standard Working Hours
Examples
Example 1: Default the value in a position DFF based on the Regular or Temporary flag
Advanced Expression
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
* Default value expression for positionsV2.positionsDFF.payscale
* @param {object} context
* @return {string}
*/
function getPositionsV2PositionsDFFPayscale(context) {
const { $objectContext, $fields, $modules, $user } = context;
if($fields.positionsV2.RegularTemporary.$value() === 'T'){
return 'CW';
}
return null;
}
return { getPositionsV2PositionsDFFPayscale };
});
Example 2: Validate Position Name to check whether it includes the Job Name and Department Name
Advanced Expression
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
let job = $fields['positionsV2']['job'].$value();
let department = $fields['positionsV2']['department'].$value();
if (job && department ) {
let reqName = (job.JobName).substr(0,3) + '-' + (department.Name).substr(0,3);
let positionName = $fields['positionsV2']['PositionName'].$value();
if(positionName !== reqName){
return true;
}
}
return false;
}
return { runCondition };
});
Example 3: Validate Standard Working Hours: If Standard Working Hours isn’t equal to 37.5 or 40, display an error message
Advanced Expression
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
*
* @param {object} context
* @return {boolean}
*/
function runCondition(context) {
const { $objectContext, $fields, $modules, $user, $value } = context;
let stdwh = $fields['positionsV2']['StandardWorkingHours'].$value();
if (Number(stdwh) !== 37.5 && Number(stdwh) !== 40) {
return true;
}
return false;
}
return { runCondition };
});