2 Replies Latest reply on Jan 5, 2018 1:29 AM by GaryMoor

    Update Employee Record From Service Request

    GaryMoor Rookie

      I want to update an Employee object field with information submitted on a service request.

       

      First off I added a new field to the Service Request Object called TargetUser

       

      Then created a Service Request offering with form items:

      NameOfLeaver (gets the leavers Display Name, not the CurrentUser)

      LeaveDate (gets the date of the Leaver)

       

      with a request fulfilment workflow to::

      1. update a TargetUser field in Service Request

      2. run a quick action UpdateLeaver

       

      The Quick Action UpdateLeaver was a compound action using a SearchAndLink action using a relationship to the Employee

      Employee#.DisplayName (Display Name) = $(TargetUser)

      Then adds an action that updates the Employee field LeaveDate

       

      If I run the service request it updates the TargetUser field however it does not update the employee.  If I then go into Service Request and run the Quick action again it works, updating the Employee record. From this I assume the information is not transferring due to the request not being saved at first.  I have tried to create a second quick action to store the NameOfLeaver info and save the service request before carrying on with the workflow (instead of just using an update) but to no avail. 

       

      I have looked at the discussion similar to this by [email protected] 24-Nov-2016 07:24 but I dont seem to be able to extract exactly what I am trying to achieve.

       

      Any suggestions of how I can ask for a user name and then use this to target and Employee and update a field from a form item?

       

      Thanks.

        • 1. Re: Update Employee Record From Service Request
          rosscarins Employee

          Hi Gary,

          It might be more successful if you collect the RecID of the Employee in the request offering and then pass that to SR and in turn the Employee Record.

           

          Assuming your "Name of Leaver' field is a drop down, in the settings you can collect additional fields in the RO:

           

           

          Then you can add a new read only field on the form which you set to a default value (the RecID of the leaver):

           

           

          You'd then make the field not visible. That might then work with your existing setup. If it doesn't I'd probably try using a Business Rule on the Service Request BO that triggers on change of your TargetUser field, that way you know the SR is saved before it tries doing the update.

           

          Let me know if you have any other questions.

           

          Cheers.

          • 2. Re: Update Employee Record From Service Request
            GaryMoor Rookie

            Thanks for the tip, helped enormously.  I found I had 3 issues (OK errors).

            1. I had used the display name - Changed this to RecId as advised (Cheers Ross)

            2. Although I had added a unique link field just for the relationship I had for some reason selected the ParentLink - Changed this to the EmployeeRequestLink field I had added

            3. Biggest issue, I was trying to use a compound quick action, this did not work. - Changed this to use a single action for the Search and Link, then another action to update the Employee fields

             

             

            So here is the final config:

            In the Employee Object I added fields

             

            In the Service Request Object I added fields

            In the Service Request Object created the relationship

            In the Service Request Object I created quick actions

            and

             

            In the request set the workflow to

            Where the update block put the employee RecId into the TargetUser field and the date entered onto the form in the Update_A field.

             

            Hope this helps anyone else who comes across this or a similar issue.