cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Populate last 6 digits of personnel no to a custom field

shadeesh2
Explorer
0 Kudos
423

Hi Experts, I want to auto populate the last 6 digits of employee no in a custom field in employee central module using the business rule. Please refer the scenario below

The employee no is 8 digits and we want to use the last 6 digits of the number as a payroll id (custom field) for example the employee no. 12345678 and the payroll id should be 345678 (excluding first two digits).  Would you please guide me on how to achieve this?

Best Regards, Shadeesh

Accepted Solutions (0)

Answers (1)

Answers (1)

S_Strangfeld
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @shadeesh2,

without knowing the details of your object config, you could probably use the substring() function in a rule to just display the last 6 digits.

Therefore it might be necessary to convert the value to a string (in case your employee number isn't a string already), which can be done via format number() function. If payroll ID is a number, you can convert the string back to a number via toNumber() function.

That's a simple solution, there might be others as well.

Here an example of such a rule, whereas the first statement is for a target field of type number, second one for target field of type string. In case the source field is of type string already, you wouldn't even need the format number() function and you could just go with the substring() function.

rule to cut number from ten to eight digits.jpg

Hope this helps...

BR, Sylvia

 

shadeesh2
Explorer
0 Kudos
Thanks it worked.