• Dorian - JLC
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi,

 

I'm building a VF Page that will be in a account. In this VF page I'm calling a related list :

 

<apex:dataTable value="{! account.agence__r}" var="item" border="2px;">
     
       <apex:column headerValue="Agence" style="padding: 2px 2px 2px 2px ;width:140px;">
          <apex:outputField value="{! item.name}" />
       </apex:column>
       
       <apex:column headerValue="Responsable" style="padding: 2px 2px 2px 2px ;width:140px;">
          <apex:outputField value="{! item.Z_responsable__c}" />
       </apex:column>
       
       <apex:column headerValue="Adresse" style="padding: 2px 2px 2px 2px ;width:140px;">
          <apex:outputField value="{! item.Z_adresse__c}" />
       </apex:column>
       
       <apex:column headerValue="Ville" style="padding: 2px 2px 2px 2px ;width:140px;">
          <apex:outputField value="{! item.Z_ville__c}" />
       </apex:column>
       
     </apex:dataTable>

 When the user click on " Modify " button (Custom Button not the SF Button ) all output become input, so the user can modify data (JavaScript function).

 

So to save changes I have to make a save button with an extension controller of Account, but I don't know how i can link the controller with the visualforce, I mean how can I get data when the user click on the button " Save " ?

 

I should do something like that but theses methode can be use for other object than standard Object ?

public class MyController {

    private final Account account;

    public MyController() {
        account = [SELECT Id, Name, Site FROM Account 
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Account getAccount() {
        return account;
    }

    public PageReference save() {
        update account;
        return null;
    }
}

I know that I can acces to the data of an input like that :

data = account.InputName 

 But with the related List if I have Multiples records I can't do it , or i will have a tab with data of a specifique field of all related records ?

 

Best regards,

Dorian

Hi,

 

I am not sure my Subject is correctly write or not.But I faced issue on something like this,

 

Example I have one object named Employee with contains attribute such  InternalID ,ExternalID, name , age

 

I need to retrieve the data where InternalId = ExternalID something like below

 

select Name, Age__c  from Employee__c where InternalID__c = ExternalID__c 

 

 

I knew in Oracle we can do something like this, but I m not sure in SFDC can we do that?Usually if there requirement to do that, what is the best way to do it?