3

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?

  • Hi Lalit, would need some more info here. What is triggering First action and second action? Is it a trigger or manual? – Shailesh Patil May 13 '16 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 '16 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. – Shailesh Patil May 13 '16 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 '16 at 8:19
  • Could you please post the trigger code if it is currently there? Need to look into the trigger. – Shailesh Patil May 13 '16 at 10:36
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.
  • Thanks @cropredy, yeah was thinking of that as alternate solution and this makes sense logically to not have a triggered action. – lalit May 16 '16 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.