2

I'm newbie to salesforce platform and starting to learn. Currently, we are using salesforce service cloud and have implemented ticketing system and have bunch of things being tracked in case history.

For a case certain actions are being taken by users (First Action) which triggers automatic closure (Second Action) of case when user updates a case field to any of predefined set of values.

enter image description here

Here instead of Second Action being done by actual user I want to change it to system user, as this update (closure of case) is being made by system not salesforce's actual user. How can i achieve that?

5
  • Hi Lalit, would need some more info here. What is triggering First action and second action? Is it a trigger or manual? May 13, 2016 at 6:38
  • So we have case field "after sales status" this can be updated to X or Y. Now status can be updated to x by a batch job or to Y manually by some user. For both the status update we close the case. We want this action (closing the case) should come as action performed by system not by user since it is performed for system not user in actual.
    – lalit
    May 13, 2016 at 6:52
  • 2
    In this case, you have to write a trigger. Which will fire when the After Sales Status is changed, close the case with system user. May 13, 2016 at 8:12
  • I think same is being done currently but how we can change to admin user, which is not current/logged-in user?
    – lalit
    May 13, 2016 at 8:19
  • Could you please post the trigger code if it is currently there? Need to look into the trigger. May 13, 2016 at 10:36

1 Answer 1

2

When a transaction executes, it runs under the running user's profile/permissions.

Hence, whoever the user is that starts the transaction by:

  • Clicking a button that does an update ...
  • including updates done by triggers, workflows, or async calls launched by the transaction

will be the user associated with the DML change in the field history related list.

If it is super important that you record that the case closure was done by some automated process, that automated process has to be running independent of the user that initiated the close event. For example:

  1. Close event is saved as a deferrable event into a custom object CloseRequest__c
  2. A scheduled job or infinite chained queueable job that was started by a scheduled job reads CloseRequest__c and acts on them by doing the actual Case.Status = Closed. This scheduled job can be started to run under some special "headless" user.
1
  • Thanks @cropredy, yeah was thinking of that as alternate solution and this makes sense logically to not have a triggered action.
    – lalit
    May 16, 2016 at 6:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .