+ Start a Discussion
admin 7admin 7 

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

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