1

Is there any way I can update a field on the record through automation to make sure that the last modified user gets updated to automation process user on the record?

So, here's our issue, we have recently implemented Field Service Lightning. Our partner users will be assigned work orders which they can either accept or reject. Our automation works in such a way that when a work order is rejected through a on-screen flow, it gets assigned to other tech on basis of our scheduling policy and then, a chatter notification and FSL mobile app notification will be sent to the new tech.

Problem arises when partner user rejects and the work order is assigned to other tech, chatter and app notification specifies the previous partner user name (last modified by) which we absolutely do not want. For ex: If partner user A rejects a Work Order, partner user B would get a notification saying that A has assigned the WO. We do not want partner users seeing each other's name.

6
  • what's the end goal? I ask because I don't believe you can force this as that user is for Salesforce automated actions you don't necessarily own (ex. deletion of custom field after 15 days, sandbox post refresh script). Dec 27, 2019 at 20:40
  • In simple terms, the reason is we do not want our partner users to see who the last modified user is.
    – TonySF
    Dec 27, 2019 at 20:42
  • Depending on the overall process, I usually have a "SFDC Admin" user in an org which can be done for this situation which obviously takes up a license (used for dataloads, scheduled jobs, etc). I'd advise not creating some workflow simply to fire on records to change the last modified by if you can avoid it though. Another thought, are you able to simply hide the "lastModifiedBy" field for partner users on a separate layout? Dec 27, 2019 at 20:50
  • Could you just take Last Modified off the page layouts for partner users?
    – Charles T
    Dec 27, 2019 at 21:14
  • Please look at the edited initial post. It is not just about the visibility of the last modified user.
    – TonySF
    Dec 27, 2019 at 21:25

1 Answer 1

2

There's no way to do this synchronously (within the same transaction), so there's always going to be the possibility that partner users could see the original Last Modified By information. You can't ever change the running user within a non-test transaction.

To change the Last Modified By user, you'd need to fire a Platform Event from a trigger, which will be processed asynchronously - outside the current transaction - in an Automated Process context. Automation that reacts to that Platform Event, whether Process or Trigger, could read a record Id from the payload and perform some no-op update to the record, resulting in a Last Modified By of Automated Process.

But, as noted above, this may not be foolproof in achieving your ends. Any automation that's reacting within the original modifying transaction will still show the original Last Modified By, and it's likely that your Chatter automation would fall into that category. Additionally, a user who viewed the record at just the right time might still see that original value as well, prior to the time at which the asynchronous update runs.

Disclaiming that I am not experienced with Field Service Lightning, the only other route that I see is to avoid having partner users modify records at all, by bouncing all updates into the Automated Process user's context via Platform Event, or using a callout to enter the context of some arbitrary system user.

That's a rather heavy solution, and it may or may not work with your current Flow automation.

5
  • Hello David, Thanks for the detailed explanation. I was able to modify the lastmodifieduser by following these steps: On the Rejection flow, as a final step, I'm letting portal user create a platform event with the id of the record to be modified. I've wrote a trigger which will be the subscriber/listener, whenever a new message is received, the trigger would update a field on the record and lastmodifieduser is updated. I have one question. Can we delete event message after the update is made, the latest processid number is getting updated all the time. Not sure if it is possible.
    – TonySF
    Dec 30, 2019 at 17:36
  • Platform Events are an ordered stream; they don't get deleted but pass off the end of the retention window. I'm not sure I understand the issue though.
    – David Reed
    Dec 30, 2019 at 17:40
  • My concern is, we will be dealing around 20-30 records at a time, wouldn't the latestprocessid updating all the time cause any issues in updating these records. This might be a stupid question but Is there any way we can suspend the latestprocessid once the required update is made for a record.
    – TonySF
    Dec 30, 2019 at 17:58
  • @TonySF I confess I'm not sure what LatestProcessId is. (I don't work in Field Service Lightning).
    – David Reed
    Dec 30, 2019 at 20:04
  • Never mind.. I was able to resolve it.. Thank you for the suggestions..
    – TonySF
    Dec 30, 2019 at 20:37

You must log in to answer this question.

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