Skip to Content
Technical Articles
Author's profile photo Venkata Subbarao Pathangi

SAP SuccessFactors Employee Central – Automatically generate email addresses and phone number for the employees during hiring.

How to Automatically generate email addresses and phone number for the employees during hiring.

 

Requirement:

If First name is Test and Last name is Emaildefault were to be hired, his email address would have to be Test.Emaildefault@tbc.com, Email Type to be Business and Is Primary to be Yes.

Also Phone Type to be Office, Country Code to be +44, Phone Number to be 000000 and Is Primary to be Yes.

It should automatically default or fill those fields.

Lets Start!!!!!!

 

Step:1

Navigation: EC-> Admin Tools -> Search for Configure Business Rules

Create the rule as per this screen below for Email default.

 

Email%20Rule

Points to be noted:

  • Base object has to be Employee Information as you need this rule to kick in while hiring.
  • Format() is a function that comes shipped. There are many other useful functions that you can use out of the box
  • Format() lets you use java style runtime variables %s. The rule here essentially means replace the first %s with the first name and the next %s with the last name of the employee.

 

Step:2

Now tie the business rule you created for emailInfo

Navigation: EC->Admin Tools-> Search for “Manage Business Configuration”

Email%20Assignment

 

Step:3

Navigation: EC-> Admin Tools -> Search for Configure Business Rules

Create the rule as per this screen below for Phone default.

 

Phone%20Rule

 

Points to be noted:

Base object has to be Employee Information as you need this rule to kick in while hiring.

 

Step:4

Now tie the business rule you created for phoneInfo

Navigation: EC->Admin Tools-> Search for “Manage Business Configuration”

 

Phone%20Assignment

 

Step:5

Let’s take our rule for a spin by trying to hire an employee.

Navigation: EC->Admin Tools-> Search for ‘Add New Employee’

 

Add%20New%20Employee

 

Check the Email and Phone Info data.

 

Default

Fields are automatically defaulted.

Looks all good!

 

Hope this was helpful.

 

Regards,

Venkata Subbarao Pathangi

Assigned tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Nathan Wilkinson
      Nathan Wilkinson

      Interesting post, but in 8 years implementing EC I have never had the request to set up email addresses this way.   The nuggets in this post are setting the country code and 'business'.  However, for this to be scalable for a global implementation then your rule would become very complex and may find it easier referencing the company table.

      Thanks

      Author's profile photo Lalit Singh
      Lalit Singh

      Thanks Venkata for sharing.

      One of my clients had similar requirement.

      Author's profile photo Swapnilkumar Lakade
      Swapnilkumar Lakade

      Gr8...Thanks Venkata, this is really useful.

       

      Is there any possibility to create USERNAME automatically while hiring the employee, in similar logic of email id creation.

      Author's profile photo Karthika Guduru
      Karthika Guduru

      Thank you venkata, Useful

      Author's profile photo Sebastian Wieland
      Sebastian Wieland

      What will happen, if you got two people having the same name in the company?
      There is no check logic, right?

      Author's profile photo Venkata Subbarao Pathangi
      Venkata Subbarao Pathangi
      Blog Post Author

      Hi Sebastian,

      We can put logic.

      The solution is fairly simple. Just create the email address in the rule and check for its availability in the EC database. If already available, suffix the email with an incremental number, else, just use the email. But…

      • There is no way to access employee email data either via a function or via an API call at the business rule level => we got to create our own email store – we do that with an MDF object.
      • The business rule framework also doesn’t provide a way to create an entry in the MDF object. Hence we have to populate the MDF object with via an external contrivance – a custom BOOMI process to be precise.

      Step 1: Create MDF Object  – cust_email
      Navigation:EC->Admin Tools-> Search for “Configure Object Definitions”.
      Just create an object with effective dating set to none, API visibility set to editable and retain the External Code and Name. Everything else is optional and can be configured on a need basis.

      Now get object cust_email into the business rule

      For the moment  let’s assume that the aforementioned BOOMI process already exists and keeps the MDF object cust_email afresh with all the new email addresses as and when they are generated.

      With that assumption let’s understand the business rule here.

      For starters, there is an if statement. The if statement checks for the existence of the email address in the MDF object. If it does exist-> then suffix the email address with an incremental number else just use the email address.

       

      the Then Statement has a few new faces

      • Format template now reads – %s.%s%s@acme.com
      • The third argument is basically the suffix. E.g. Walter.White1@acme.com. So how do we get such a suffix generated?
      • We can use the standard function GetNextValue() along with the MDF object Sequence to achieve the incremental behavior of the suffix. In this rule email-auto-increment is one specific Sequence object

       

      So the Sequence object has to be created beforehand.

      Navigation:EC->Admin Tools-> Search for “Manage Data” -> Create new sequence.

       

      The sequence starts with the number 1 and it’s auto-incremented in steps of 1.

      Now the business rule as such is in place. Provided the cust_email object is updated every now and then we are assured of a unique email address every time a new person is hired.

       

      Regards,

      Venkata Subbarao Pathangi