3 Replies Latest reply on Jun 13, 2017 11:24 AM by yannick1

    link objects via business rules

    wernerbj Apprentice

      Hi,

       

      I extend the BO "OrgUnit" with a custom field "SAPId", because this is our Business Primary key given by an Import file.

      I also extend the BO "Employee" with a custom field "SAPId" validated by the OrgUnit Entries.

       

      Now have to implemented two file importer (csv):

      * The first has to Import (and update) all OrgUnits. The Primary key in the Import file is the "SAPId"

      * The second has to Import (and update) all employees. In the Import file is given the OrgUnit.SAPId. So I have to find out the OrgUnit.RecId by OrgUnit.SAPId and link the OrgUnit via Employee.OrgUnitLink

       

      What is the best way to link the correct OrgUnit on updating Employee.SAPId?

       

      best regards

      Björn

        • 1. Re: link objects via business rules
          yannick1 Apprentice

          Hello Bjorn,

           

          If I understand you well, you want to be able to link an Employee’s Org Unit using the OrgUnit.SAPID in the Employee csv import file. If this is right, then you can achieve this through a search and link trigger business rule. But before creating this rule, there are some configurations involved as described below:

           

          1.       Create 2 text fields in the Employee object: "OrgUnitSAPId" (which will contain the value from the OrgUnit.SAPId from the import file) and "OrgUnitSAPRecId" (which will contain the recid of the Org Unit). You can make these fields Unicode text fields so that you can see the pick lists which we will create below).
          2.       Create 2 pick lists; OrgUnitSAPRecId:

          OrgUnitSAPId:

          3. Go back to the fields you added in Employee and validate them with the above pick lists as shown below:

           

           

          4. Navigate to your picklist “OrgUnitSAPRecId” and modify the value field to “RecId”. This is a trick to allow a pick list to store number values.

           

          5. Add an editing business rule in Employee as below:

          This business rule is used to set the Org Unit's rec id  when the OrgUnitSAPId is updated. You will have to type the expression $([OtherObject]RecId) as the RecId is hidden.

           

          6. Create your search and link trigger business rule in Employee as shown below:

           

          The first composite action called "Search and Link Employee's Org Unit" will be a search and link which will be defined as follows:

           

          Note: You will have to select the right relationship which has been defined on the field OrgUnitLink on Frs_CompositeContract_Contact. You can check this by going to this field to check the relationship which has been set:

           

           

          The second composite action called "Clear fields" will be an update to clear the fields OrgUnitSAPId and OrgUnitSAPRecId. This is done so that the next import will set these fields and fire the business rules.

           

          Make sure that in the import mapping, you map the OrgUnit.SAPId in the import file to the field OrgUnitSAPId in Employee so that the various business rules which you added in Employee will fire and set the Employee's right Org Unit.

           

          Hopefully this is what you are trying to achieve and it helps you. Let me know if you have any questions or issues.

           

          Yannick.

          2 of 2 people found this helpful
          • 2. Re: link objects via business rules
            wernerbj Apprentice

            Hi Yannick,

             

            thank you very much for your very detailed answer. This is very helpful.

             

            best regards

            Björn

            • 3. Re: link objects via business rules
              yannick1 Apprentice

              Glad it helped you.