0

Scenario: I'm the manager and I have an employee. My employee was on a sick leave so I want to put a message on his/her user profile that this employee is on a sick leave.

Problem: The problem is when I open his profile I can't see the "Out of Office" button.

Question: Can a user only see his own "Out of office" Button and not the "Out of office button" of other users? aside from admin which who can see everyone's "Out of office" button?

Thank you.

  • "Out of office" is a button or a checkbox ? – Jarvis Sep 14 '18 at 10:13
  • It is a standard button. I tried checking the page layout in the User Profile Page Layout and there is no Mobile & Lightning Actions. This is in the User Object. – Atoc Sep 14 '18 at 10:40
1

You cannot do this using UI but using APEX you can achieve this flow. We have OutOfOffice object available which you can use to create message for other users in your org using API/apex.

public static void set(Id userId, String message, Date startDate, Date endDate) {
    // extract existing record
    Id outOfOfficeId;
    for(OutOfOffice o: [SELECT Id FROM OutOfOffice WHERE UserId = :userId]) {
        outOfOfficeId = o.Id;
    }
    upsert new OutOfOffice(
        Id = outOfOfficeId,
        UserId = userId,
        IsEnabled = true,
        StartDate=startDate,
        EndDate=endDate,
        message=message);
}
public static void reset(Id userId) {
    delete [SELECT Id FROM OutOfOffice WHERE UserId = :userId];
}

You can use this method to set/reset out of office.

| improve this answer | |
  • Is this a Salesforce limitation? Thank you buddy. – Atoc Sep 14 '18 at 10:46
  • @Atoc I don't have any document to support my statement but I think yes. or may be missing permission. – Tushar Sharma Sep 14 '18 at 10:59
  • 1
    There is a way for other users to see the Out Of Office button and this is by giving them an Administrative Permission Manage user which is not advisable. :) thank you for the answer. – Atoc Sep 17 '18 at 6:42

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.