Find your content:

Search form

You are here

Display Self-Service fields on Contact Object

 
Share

I would like to display Self-Service Portal fields on the contact object. I need the fields "IsActive" and "Last Login". Is it possible by trigger?


Attribution to: Itay B

Possible Suggestion/Solution #1

Salesforce already provides a way to see if a case is related to a self-service user. In the self-service portal settings you can select a case origin (the default is 'web') and as long as this is unique you know that any cases with that origin were created from the SSP.

Furthermore, there is a 'visible in SSP' field on the case that tells you if SSP users can see the case and comment on it (and their comments will show up in the case comments related list).

There is no built-in way to see if the related SSP user is active or their last login date directly on the case but the contact does have a "view self-service user" button so it would be two clicks from the case detail page to get to this information.

If you need this right on the case detail page you will need to be an inline VF page similar to what @mohith wrote but it should be on the SelfServiceUser NOT User like he has it.

visalforce page:

   <apex:page standardController="Case" extensions="stampLoginDetailsforPortalUser">
  <apex:pageMessages />
  <apex:pageBlock rendered="{!loginInfo.size >0}">
  <apex:pageBlockTable value="{!loginInfo}" var="a">

 <apex:column headerValue="Last Login" value="{!a.LastLoginDate}"/>
  <apex:column headerValue="IsActive" value="{!a.IsActive}"/>
  </apex:pageBlockTable>
   </apex:pageBlock>
   </apex:page>

controller:

public with sharing  class stampLoginDetailsforPortalUser {
    private Case UserCase;

    public stampLoginDetailsforPortalUser(ApexPages.StandardController stdController) {
        Case temp = (Case) stdController.getRecord();
            this.UserCase = [select contactID from Case where ID = :temp.ID];
    }

    public List<User> getloginInfo(){
        List<User> us=[Select Id,LastLoginDate,IsActive,ContactId from SelfServiceUser where ContactId=:UserCase.ContactId];

        if(us.size()==0){
            ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.INFO,  'Login for self service portal user not enabled'));
        }

        return us;
    }
}

Attribution to: Greg Grinberg
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/3551

My Block Status

My Block Content