4

I have a requirement, If a User has clicked on edit button of a record and is in edit page and meanwhile another user clicks edit on the same record, then I should show a message informing the second user that "User X is currently viewing the record".Can I track the User who is currently viewing the record ? The edit page will be a Visualforce page.

1

The pure mechanics of the problem are not difficult to envision:

  1. When the page loads a record, check to see if this record is already in use, if so, tell the user, and if not, store on the server somewhere the fact that it was loaded (probably in a custom field on the record).
  2. When the record is no longer in use, tell the server that it is no longer in use.

The short answer to your question: "Can I track the User who is currently viewing the record ?"

Yes.

But you would have to roll your own for this, and implement it on every single object where you would want this behavior. But it would be a high level of effort.

I would guess that when most implementations get down to the cost of effort involved in building this themselves and weigh what other more useful features they could do instead; features that actually solve a real business problem, it would fall by the wayside.

1

Biggest issue would be to store/passing information. Adding user to list should be easy (for example update one of fields in constructor) but the problem is updating them.

At this moment the only thing I can think now is to have field with stored user Id updated every time someone open VF, with information section refreshed by JS. This field should be clear/remove user Id from it by JS runed on page close and save

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.