Skip to Content

**This blog is obsolete. There’re far better and easier ways to address the problem**

 

Recently a customer I am consulting for came up with a not-so-unique requirement. For privacy reasons let’s call the customer acme and acme’s requirement was to automatically generate email addresses for the employees they hired.

 

Requirement:

If Walter White were to be hired at Acme, his email address would have to be Walter.White@acme.com               


Seems easy –  Doesn’t it? But not when you have to factor in for the duplicates in the system.The following blog elucidates how a combination of MDF Object, Business Rules and a custom integration process came together to fulfill acme’s requirement and saved the day.

 

First Things First: Create a Business rule that’s always true

Navigation: EC-> Admin Tools -> Search for Configure Business Rules
Create the rule “gen-uniq-email” as per this screen grab here.

 

/wp-content/uploads/2015/02/image001_643958.jpg

 

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. Look up for the complete list here  https://partners.successfactors.com/productcentral/PSDocuments/RulesEngineHandbook.pdf
  • You can also perform this activity in the data model xml  provided you have access to provisioning.

 

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.

 

 

Now tie the business rule you created with the field in question i.e., email

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

/wp-content/uploads/2015/02/image002_643959.jpg

 

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

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

/wp-content/uploads/2015/02/image003_643960.png

Walter White translates to Walter.White@acme.com – all good!

/wp-content/uploads/2015/02/image004_643967.png

 

Now what happens when acme has another Walter White coming on board? Email duplication issues!

Solution

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.

/wp-content/uploads/2015/02/image005_643968.jpg

 

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

 

/wp-content/uploads/2015/02/image006_643982.jpg

 

 

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.

 

/wp-content/uploads/2015/02/image007_643984.jpg

 

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.

 

Let’s shift our crosshairs to the elephant in the room i.e., the BOOMI process.

 

BOOMI process

The process is pretty straight forward. Every now and then (as scheduled) the process comes alive, reads the latest emails from the SF Object PerEmail and writes it into our custom MDF object cust_email.

 

/wp-content/uploads/2015/02/image008_643995.jpg

 

All good? Now let’s hire another Walter White.

 

image009.PNG

 

The new Walter White has a different email id from the previous one – serves the purpose

 

 

FAQ

 

Why do we need a BOOMI process here?

  • Because we cannot update the MDF object directly from within the rules engine.

Is BOOMI process to only way do this?

  • No, MDF objects offer OData APIs. Technically we can use any other contrivance to achieve this so long it can be scheduled to run every now and then.

 

 

To conclude:

 

Business Rules Engine is fabulous with a lot of in built feature-functions.

Nevertheless it would be great to see a spruced up Business Rules framework that can write, as against only read now, into MDF objects directly, perform basic string functions like search-replace and if it’s not a tall ask – provide ability to access APIs, external and internal.

 

With such features, Business Rules Engine can help not only business processes but also tactical integrations. While the strategic A2A integrations take the BOOMI/HCI route, tactical integrations like creating asana/jira tasks for impending HR tasks or streaming updates to progress trackers can definitely take this route.

To report this post you need to login first.

25 Comments

You must be Logged on to comment or reply to a post.

  1. Brandon Toombs

    I would suggest use of background checks integrated with SuccessFactors Recruiting Management to prevent the hire of Walter White , let alone 2! 🙂

    Great blog on tackling a little more complex issue using MDF and Boomi.  Definitely showcases some of the more advanced flexibility inEC.

    (0) 
  2. Luke Marson

    Great job Girish and good to see you showing your integration expertise here, as well as with MDF. I’m looking forward to more articles and hope to see you soon.

    (0) 
  3. Prasanna Manikandan Balu

    Hi Girish,

    I appreciate the simplicity of this blog and it’s always easy to comprehend. I’m currently looking for any expression within the rule to extract the last 4 characters of a string.

    I have built the custom field WBS in MDF alternate cost distribution, the requirement is when saving the record I have to check if the cost centre value is equal to last 4 characters of WBS string. Kindly share your thoughts.

    Regards

    Prasanna Manikandan

    (0) 
    1. Jagan Gunja

      see sample here:

      data : a type string,b type i,c type string,d type i.

      a = …               assign WBS to a

      b = strlen( a ). “required if string length not known

      d = b – 3.  

      c = ”.

      do while d < b.

      c = a(d).

      d = d + 1.

      enddo. 

      write :/ c.

      (0) 
    2. Girish BR Post author

      Thanks Prasanna,

      Now for your question, string functions in business rules are pretty limited – there is no search and replace, you can really only do a concat.

      So, best way is to propagate the last 4 characters of the WBS element from the cost center and use concat to derive the whole WBS element. Looks a little ugly on the UI, but as of now that’s the only way.

      (0) 
      1. Prasanna Manikandan Balu

        Dear Girish,

        Believe you are doing good, after several attempts of checking options, I decided to write to you. I have a challenge and this is about MDF Alternate Cost Distribution (PARENT MDF).

        I want to raise an error message when the sum of percentages in Alternate Cost Cost Distribution is less than 100 and I have constructed the rule as per attachment with rule and data screenshot.

        This rule is added in Alternate Cost Distribution Object and triggered @ ‘Save’ event.

        The challenge is the rule checks every row of Alternate Cost Distribution Item (CHILD MDF) and displays errors.

        Is there a way to extract and check the total of percentages against the limit ‘100’

        Share me if you have an approach for this.

        Thanks for your Support.

        %Rule.PNG

        (0) 
        1. Sanjay Kumar

          Hi Prasanna/ Girish/ all,

          Sorry to rake up this old thread but was this question answered? I am stuck with a similar requirement, could someone please help?

          The rule onSave needs to validate the sum of a field with two or more instances. Are there any functions that can perform this looping/iterative summation? Or is there a smart way to achieve this?

          Many thanks

          Sanjay

          (0) 
  4. Ankita Roy Chowdhury

    This is a beautiful discovery!

    Clients will appreciate the fact that such an important activity can be automated by the system will take away some steps at the time off Onboarding and the dependency on their respective IT team for the same.

    (0) 
  5. Kareen Anasilvia Salazar Morales

    Hi Girish, thanks for the information, I’m trying to generate similar information, but I don’t know how manage special characters don’t supported, like ‘ñ’, ‘á’, ‘é’; I want to replace a list of special characters in the string generated, is there some functions to change the codification of the string?  Or, is there some way to use temporary variables in business rules?

    Best regards!

    (0) 
  6. Naresh Kumar

    Dear Girish,

    Thanks for sharing the scenario, it was excellent.

    In your blog you have shared one link which shows how to use other functionality of “Business Rules”, but that is not opening and throwing some error. Below is the link which is not displaying.


    https://partners.successfactors.com/productcentral/PSDocuments/RulesEngineHandbook.pdf

    can you please resend me the link on naresh079@gmail.com

    it will be great help. Thanks!

    Regards,

    Naresh.

    (0) 
  7. Velmurugan Kanagasabai

    Very useful article…

    I have one question here… The Sequence object will get reset for each new user?

    For example,

    while hiring Walter White for the second time, the sequence counter increased.

    similarly if i hire Walter Black for the second time, will the sequence be 1 or 2?

    Thank you

    -Vel

    (0) 
  8. Divya Adepu

    Hello Girish BR..Actually i tried to configure the business rule. An error is shown . Could you please let me know about it.

    Mapping of field email-type: Entity Type must be an external code defined in picklist ecEmailType

    (0) 

Leave a Reply