• admin 7
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 8
    Replies
User-added image<apex:page controller="locationController"> 
Location Table <apex:messages style="color:red"></apex:messages>
 <apex:form>
 <apex:pageblock>
 <apex:pageblocktable value="{!locationList}" var="locItem"> 
 <apex:column headervalue="Country">
 <apex:inputfield value="{!locItem.Country__c}"> 
 </apex:inputfield> 
 </apex:column> 
 <apex:column headervalue="State/Province"> <apex:inputfield value="{!locItem.State__c}"> 
 </apex:inputfield>
 </apex:column> <apex:column headervalue="City">
 <apex:inputfield value="{!locItem.City__c}"> </apex:inputfield>
 </apex:column>
 </apex:pageblocktable> 
 </apex:pageblock> 
 </apex:form> 
 </apex:page> - 
 
 
 public with sharing class locationController {
 public list locationList{get;set;}
 public locationController() {
 locationList = [Select ID, Country__c, State__c, City__c From student__c];
 } 
 }
i have object A and object B, in object A&B have same field unic_id__c, in B object based on Unic_id__c get the referrence id value display in object B with same field name, Can you write a trigger for this senario 
This is my code please write test class for my class

Apex Code:

public with sharing class ContactNew{
 public contact org { get; private set; }

private ApexPages.StandardController sController;  
    private String queryString;  
              public ContactNew(ApexPages.StandardController controller) {  
        sController = controller;  
        org = (contact)controller.getRecord();  
    } 
    public Pagereference SaveAndnew()
 {
 
   upsert org;

   string s = '/' + ('' + org.get('Id')).subString(0, 3) + '/e?';
   ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.Info, s));
   return new Pagereference(s);
 }
 }


Visualforce Page

<apex:page standardController="contact" extensions="ContactNew" >
  <apex:sectionHeader Title="Contact edit" Subtitle="New contact"/>
  <apex:form >
  <apex:pageBlock Title="contact Edit">
  <apex:pageBlockButtons >
  <apex:commandButton value="Save" action="{!save}"/>
    <apex:commandButton value="Save & New" action="{!SaveAndnew}"/>
      <apex:commandButton value="cancel" action="{!cancel}"/>
      <apex:pageBlockSection >
      <apex:inputField value="{!Contact.FirstName}"/>
       <apex:inputField value="{!Contact.LastName}"/>
  
      </apex:pageBlockSection>
        </apex:pageBlockButtons>

      </apex:pageBlock>
      </apex:form>
      </apex:page>
<apex:page controller="tt">
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:pageBlockTable value="{!wrapper}" var="wrap">
                <apex:column headerValue="Account Name" value="{!wrap.accRec.Name}"/>
                <!-- you can add related fields here   -->
                <apex:column headerValue="Contact Name" value="{!wrap.conRec.Name}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Controller:

public class tt
{
    public List<Account> accLst {get; set;}
    public List<Contact> conLst {get; set;}
    public List<MyWrapper> wrapper {get; set;}

    public tt()
    {
        accLst = [select id,name from account   ] ;
        conLst = [select id,name from contact   ] ;
        wrapper = new List<MyWrapper>() ;
        for(Integer i=0 ;i<20;i++)
            wrapper.add(new MyWrapper(accLst[i] , conLst[i])) ;
    }
    
    public class MyWrapper
    {
        public Account accRec {get; set;}
        public Contact conRec {get; set;}
        
        public MyWrapper(Account acc , Contact con)
        {
            accRec = acc ;
            conRec = con ;
        }
    }
}
One custom object having 9 questions, there are 2 users with different profile and   1st user must see all the questions he answered 5 questions   and 2nd user must see all the questions  and first 5 have read access  only reaming 4 questions read and write access, ,this my page code can you help to me in controller code please  thanks in advance 


VF PAge:

<apex:page standardController="Questionnaire__c" extensions="Questionnaire_Extension">
    <apex:sectionHeader title="Questionnaire Edit" subtitle="{!Questionnaire__c.name}"/>
    <apex:form >
        <apex:pageBlock title="Questionnaire Edit" mode="edit">
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Save & New" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Save & New" action="{!save}" />
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Information" columns="2">
                <apex:inputField value="{!Questionnaire__c.Name}" required="true"/>
                <apex:inputField value="{!Questionnaire__c.OwnerId}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Inmate__c}" required="false"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Victim Characteristics" columns="2">
                <apex:inputField value="{!Questionnaire__c.First_Time_Offender__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Prior_Sexual_Assault_Victom__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Gang_Member__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Weak_Non_Assertive__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Mental_Phisically_Devlopmentally_Disable__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Mental_Health_Issues__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Perceived_Gender_Status__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Sex_offender_History__c}" required="false"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Did The Victim?" columns="2">
                <apex:inputField value="{!Questionnaire__c.File_a_Grievance__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Request_a_Cell_Move__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Known_Enemy__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Request_a_Housing_Move__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Request_Protective_custody__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Request_a_Tranfer_Out__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Be_Classified_as_a_High_Profile_Inmate__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Prior_Protective_Custody_Inmate__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.What_Was_the_Outcome_of_the_D_Report__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Was_a_D_report_Field_Yes_No__c}" required="false"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Victim Injuries" columns="2">
                <apex:inputField value="{!Questionnaire__c.No_Physical_Injuries__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Broken_Bones__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Knife_stab_wounds__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Bruise_Sprain_Black_Eye_Cut__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Anal_Vaginal_Tears__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Others_please_specify_in_details__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.ViTeeth_Chipped_or_Knocked_Out__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Internal_Injuries__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Knocked_Unconscious__c}" required="false"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Post Incident Action Taken" columns="2">
                <apex:inputField value="{!Questionnaire__c.Medical_Exam__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Adminstration_of_Rape_Kit__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.STD_Testing_Conducted__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.HIV_AIDS_Testing_Conducted__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Conducted__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Counseling_and_Mental_Health_Treatment__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Already_realeased_Discharged__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Offered_But_Declined_Testing_or_Treatmen__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.None_of_the_Above__c}" required="false"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Additional Victim Information" columns="2">
                <apex:inputField value="{!Questionnaire__c.Victim_Previously_Knew_Staff__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Victim_worked_For_Staff__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Previous_Investigation__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Prior_Victim_Alleged_Sexual_Assault__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Time_Spent_in_Facility__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Time_Remaining__c}" required="false"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Post Incident Action Items" columns="4">
                <apex:inputField value="{!Questionnaire__c.Medical_Exams_Offered__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Date__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Location__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Date1__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Std_Test_Offered__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Date2__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Location1__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Date3__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Victim_advocate_Access_Offered__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Date4__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Location2__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Date5__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Mental_Health_Access_Offered__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Location4__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.DNA_Sample_Offered__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Rape_Kit_Offered__c}" required="false"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="After the Incident was Reported,was the Victim?" columns="2">
                <apex:inputField value="{!Questionnaire__c.Placed_in_Adminstrative_Segregation_Prot__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Placed_in_Medical_Unit_Ward_Hospital__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Confined_to_Own_Cell_Room__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Issued_Disciplinary_Report_Loss_of_Privi__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Given_Higher_Custody_Level_in_Facility__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Separated_from_Perpetrator__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Another_Housing_Unit_or_Dorm_Given_a_Si__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Placed_in_Camera_Room_Under_Surveillanc__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.Transferred_to_Another_Facility__c}" required="false"/>
                <apex:inputField value="{!Questionnaire__c.other_please_specify_in_the_mail__c}" required="false"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:

Can u help controller code here please
HI , 

I wrote VF page on contact's First Name(with Salutation)  on new contact page, i want disply the same as detail page can you write the code for detail page....




Code

<apex:pageBlockSectionItem >
    <apex:outputlabel value="First Name"/>
    <apex:outputpanel >
        <apex:outputfield value="{!Contact.Salutation}" />
        &nbsp;
        <apex:outputfield value="{!Contact.FirstName}" />
    </apex:outputpanel>
</apex:pageBlockSectionItem>




 
We have two Visualforce pages that were created for opportunities. Everything is working fine in a normal browser.However, only the edit button shows up in Salesforce1
All of the security is the same for both pages.(Note: Both the Edit and New button for opportunities have been overridden to their respective VF page).
 
i have object A and object B, in object A&B have same field unic_id__c, in B object based on Unic_id__c get the referrence id value display in object B with same field name, Can you write a trigger for this senario 
This is my code please write test class for my class

Apex Code:

public with sharing class ContactNew{
 public contact org { get; private set; }

private ApexPages.StandardController sController;  
    private String queryString;  
              public ContactNew(ApexPages.StandardController controller) {  
        sController = controller;  
        org = (contact)controller.getRecord();  
    } 
    public Pagereference SaveAndnew()
 {
 
   upsert org;

   string s = '/' + ('' + org.get('Id')).subString(0, 3) + '/e?';
   ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.Info, s));
   return new Pagereference(s);
 }
 }


Visualforce Page

<apex:page standardController="contact" extensions="ContactNew" >
  <apex:sectionHeader Title="Contact edit" Subtitle="New contact"/>
  <apex:form >
  <apex:pageBlock Title="contact Edit">
  <apex:pageBlockButtons >
  <apex:commandButton value="Save" action="{!save}"/>
    <apex:commandButton value="Save & New" action="{!SaveAndnew}"/>
      <apex:commandButton value="cancel" action="{!cancel}"/>
      <apex:pageBlockSection >
      <apex:inputField value="{!Contact.FirstName}"/>
       <apex:inputField value="{!Contact.LastName}"/>
  
      </apex:pageBlockSection>
        </apex:pageBlockButtons>

      </apex:pageBlock>
      </apex:form>
      </apex:page>
<apex:page controller="tt">
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:pageBlockTable value="{!wrapper}" var="wrap">
                <apex:column headerValue="Account Name" value="{!wrap.accRec.Name}"/>
                <!-- you can add related fields here   -->
                <apex:column headerValue="Contact Name" value="{!wrap.conRec.Name}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Controller:

public class tt
{
    public List<Account> accLst {get; set;}
    public List<Contact> conLst {get; set;}
    public List<MyWrapper> wrapper {get; set;}

    public tt()
    {
        accLst = [select id,name from account   ] ;
        conLst = [select id,name from contact   ] ;
        wrapper = new List<MyWrapper>() ;
        for(Integer i=0 ;i<20;i++)
            wrapper.add(new MyWrapper(accLst[i] , conLst[i])) ;
    }
    
    public class MyWrapper
    {
        public Account accRec {get; set;}
        public Contact conRec {get; set;}
        
        public MyWrapper(Account acc , Contact con)
        {
            accRec = acc ;
            conRec = con ;
        }
    }
}
HI , 

I wrote VF page on contact's First Name(with Salutation)  on new contact page, i want disply the same as detail page can you write the code for detail page....




Code

<apex:pageBlockSectionItem >
    <apex:outputlabel value="First Name"/>
    <apex:outputpanel >
        <apex:outputfield value="{!Contact.Salutation}" />
        &nbsp;
        <apex:outputfield value="{!Contact.FirstName}" />
    </apex:outputpanel>
</apex:pageBlockSectionItem>




 
We have two Visualforce pages that were created for opportunities. Everything is working fine in a normal browser.However, only the edit button shows up in Salesforce1
All of the security is the same for both pages.(Note: Both the Edit and New button for opportunities have been overridden to their respective VF page).