I’m trying to create a transform that takes the last 5 digits of a 6 digit Workday Employee ID (FILENUMBER) and then prepends 000. For example, if the FILENUMBER is 123456, I expect the output to be 00023456.
The regex I use: ^.*(\d{5})$ with substitute 000$1 which I tested on regex101 and gets the expected result
In addition to the left pad transform that @gogubapu shared, you can use the substring transform to make sure you only get the last 5 of the 6 digits in the employee ID.
In the end I went with the ‘getEndOfString’ operation in combination with the ‘Concatenation’ operation as it was mentioned in the ‘Substring’ operation documentation that the substring transform does not provide an easy way to get the last n characters of a string.
Still curious to know why the regex throws the rendering template error so if someone is able to shine a light on that
{
"name": "Format Employee ID with Prefix",
"type": "concat",
"attributes": {
"values": [
"000",
{
"attributes": {
"name": "Cloud Services Deployment Utility",
"operation": "getEndOfString",
"numChars": "5"
},
"type": "rule",
"name": "Get End Of String Transform"
}
]
}
}