• liwu
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies

I have a VF page with APEX controller. The controller does a 'contact' DB query. This works fine for contacts that are part of an account. If however there is a contact which is not part of an account, the controller DB query doesn't return the correct results.

 

I presume this has something to do with "Contacts not associated with accounts are private and cannot be viewed by other users or included in reports." which is displayed on the "Edit contact" page.

 

Is there a way I can allow the VF/Apex page of mine access to view ALL contacts (including the ones that do not belong to an account)? And more importantly, can I add this setting (if it exists) as part of my app which includes this VF/Apex page.

 

  • May 15, 2013
  • Like
  • 0

I have an custom object which has a lookup relationship to User (I call this field UserReference). I have a visualforce page that displays several fields for each object in an apex:pageTable.

 

How do I display the lookup relationship in this table? I don't want to display the user ID, I want to display the name.

 

I would like to do something like:

 

<apex:column >
    <apex:facet name="header">User namet</apex:facet>
    {!myObject.UserReference__c.Name}
</apex:column>

 

but that clearly doesn't work.

 

I hope I don't have to loop through the list of myObjects in the controller and for each object perform a lookup into the user table to retrieve the name and then somehow make that available to the pageTable.

 

Anyone help me out?

  • April 22, 2013
  • Like
  • 0

One of the columns in my apex:dataTable is displaying a DateTime field. I do this like so:

 

<apex:column >
  <apex:facet name="header">Date</apex:facet>
  <apex:outputText value="{0,date,yyyy-MM-dd HH:mm:ss}">
    <apex:param value="{!MyObj.MyDate__c}" />
  </apex:outputText>      
</apex:column>

 The problem I have is that this date is being displayed in GMT and not the timezone of my login (BST). Is there a way to adjust this? 

 

On a sidenote, if I use this same MyObj.MyDate__c field in an apex class and do something like:

 

MyObj.MyDate__c.format('yyyy-MM-dd HH:mm:ss')

 It does format into my own timezone (BST)

 

 

  • April 17, 2013
  • Like
  • 0

I have a custom object. I display the entries in a visualforce page using an apex:dataTable. This works as expected. Because entries for the custom object can be updated I added an apex:actionPoller tag, but my visualforce section doesn't re-render.

 

From my system logs I can see that the poller actually fires. I added some debug to the controller as well and I can see that the get method for the {!MyMessages} variable is called and I can also see that returns a List which includes entries different then currently displayed - so why doesn't the visualforce section refresh in my browser?

 

This is the relevant code:

 

<apex:page standardController="Contact" extensions="MyMessagesController">

     <apex:form >
     <apex:pageBlock title="My custom messages">
     Message: <p/><apex:inputTextArea cols="80" rows="4" value="{!NewMessage.Message_Text__c}"/>
     
     <p/>
     <apex:commandButton action="{!newSMS}" value="Send"/> <p/>
     
       <apex:pageMessages />
       <apex:dataTable id="messagetable" value="{!MyMessages}" rendered="{!(MyMessages.size != 0)}" var="message" cellpadding="4" border="1" width="100%" columnsWidth="10%, 80%, 10%">
          <apex:column >
                <apex:facet name="header">Created</apex:facet>
                                        
                <apex:outputText value="{0,date,yyyy-MM-dd HH:mm:ss}">
                    <apex:param value="{!message.Created__c}" />
                </apex:outputText>
                        
                        
          </apex:column>
          
          <apex:column >
                <apex:facet name="header">Message</apex:facet>
                        {!message.Message_Text__c}
          </apex:column>
          
          <apex:column >
                <apex:facet name="header">Status</apex:facet>
                        {!message.ReasonCode__c}
          </apex:column>
     </apex:dataTable>
     
     <apex:outputText rendered="{!(MyMessages.size = 0)}" value="There are no custom messages to display." />
     </apex:pageBlock>
     
     <apex:pageBlock ><apex:actionPoller rerender="messagetable" interval="10"/></apex:pageBlock>
     
   </apex:form>
</apex:page>

 

 

The above includes a form input to add new entries to the custom object and this works fine (hitting save will reload the entire visualforce page and update the table)

 

 

Thanks,

 

Lew

 

  • April 16, 2013
  • Like
  • 0

I have an custom object which has a lookup relationship to User (I call this field UserReference). I have a visualforce page that displays several fields for each object in an apex:pageTable.

 

How do I display the lookup relationship in this table? I don't want to display the user ID, I want to display the name.

 

I would like to do something like:

 

<apex:column >
    <apex:facet name="header">User namet</apex:facet>
    {!myObject.UserReference__c.Name}
</apex:column>

 

but that clearly doesn't work.

 

I hope I don't have to loop through the list of myObjects in the controller and for each object perform a lookup into the user table to retrieve the name and then somehow make that available to the pageTable.

 

Anyone help me out?

  • April 22, 2013
  • Like
  • 0

I have a custom object. I display the entries in a visualforce page using an apex:dataTable. This works as expected. Because entries for the custom object can be updated I added an apex:actionPoller tag, but my visualforce section doesn't re-render.

 

From my system logs I can see that the poller actually fires. I added some debug to the controller as well and I can see that the get method for the {!MyMessages} variable is called and I can also see that returns a List which includes entries different then currently displayed - so why doesn't the visualforce section refresh in my browser?

 

This is the relevant code:

 

<apex:page standardController="Contact" extensions="MyMessagesController">

     <apex:form >
     <apex:pageBlock title="My custom messages">
     Message: <p/><apex:inputTextArea cols="80" rows="4" value="{!NewMessage.Message_Text__c}"/>
     
     <p/>
     <apex:commandButton action="{!newSMS}" value="Send"/> <p/>
     
       <apex:pageMessages />
       <apex:dataTable id="messagetable" value="{!MyMessages}" rendered="{!(MyMessages.size != 0)}" var="message" cellpadding="4" border="1" width="100%" columnsWidth="10%, 80%, 10%">
          <apex:column >
                <apex:facet name="header">Created</apex:facet>
                                        
                <apex:outputText value="{0,date,yyyy-MM-dd HH:mm:ss}">
                    <apex:param value="{!message.Created__c}" />
                </apex:outputText>
                        
                        
          </apex:column>
          
          <apex:column >
                <apex:facet name="header">Message</apex:facet>
                        {!message.Message_Text__c}
          </apex:column>
          
          <apex:column >
                <apex:facet name="header">Status</apex:facet>
                        {!message.ReasonCode__c}
          </apex:column>
     </apex:dataTable>
     
     <apex:outputText rendered="{!(MyMessages.size = 0)}" value="There are no custom messages to display." />
     </apex:pageBlock>
     
     <apex:pageBlock ><apex:actionPoller rerender="messagetable" interval="10"/></apex:pageBlock>
     
   </apex:form>
</apex:page>

 

 

The above includes a form input to add new entries to the custom object and this works fine (hitting save will reload the entire visualforce page and update the table)

 

 

Thanks,

 

Lew

 

  • April 16, 2013
  • Like
  • 0