You need to sign in to do that
Don't have an account?
Daniel Bleasdale
VisualForce Page not showing on custom button
What must I do to be able to select my VisualForce page on a custom button?
My VisualForce page utilises a custom Controller and is pulling in two objects.
Here is where the button is used:-
Here is my VisualForce code:-
Thankyou
My VisualForce page utilises a custom Controller and is pulling in two objects.
Here is where the button is used:-
Here is my VisualForce code:-
<apex:page lightningStyleSheets="true" Controller="myController" title="Apprentice Documentation"> <apex:form > <!--myController refers to the Apex class I created called myController.apxc this is so I can use two object types in one form in place of a Standard controller For refrence ApprenticeObj = new Apprentice__c and ComponentsObj = new Apprenticeship_Component__c--> <!--Style--> <style> body{ font-family: Arial,Helvetica,sans-serif; color: #000000; Padding:25px; } </style> <!--End of Style--> <apex:pageBlock > <apex:pageBlockSection columns="3"> <apex:inputField value="{! ApprenticeObj.Name}"/> </apex:pageBlockSection> </apex:pageBlock> <!--Apprentice Details Section--> <apex:pageBlock title="Apprentice Details"> <apex:pageBlockSection columns="2"> <apex:inputField value="{! ApprenticeObj.Apprentice_name__c}"/> <apex:inputField value="{! ApprenticeObj.Curriculum_Verified__c}"/> <apex:inputField value="{! ApprenticeObj.ULN__c}"/> <apex:inputField value="{! ApprenticeObj.Employer__c}"/> <apex:inputField value="{! ApprenticeObj.Programme_Area__c}"/> <apex:inputField value="{! ApprenticeObj.Vacancy__c}"/> <apex:inputField value="{! ApprenticeObj.Learning_Start_Date__c}"/> <apex:inputField value="{! ApprenticeObj.Levy_Status__c}"/> <apex:inputField value="{! ApprenticeObj.Programme_Agreed_With_Employer__c}"/> <apex:inputField value="{! ApprenticeObj.Existing_Employee__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End of Apprentice Details Section--> <!--Line Manager Details Section--> <apex:pageBlock title="Line Manager Details"> <apex:pageBlockSection columns="2"> <apex:inputField value="{! ApprenticeObj.Line_Manager__c}"/> <apex:inputField value="{! ApprenticeObj.Line_Manager_Phone__c}"/> <apex:inputField value="{! ApprenticeObj.Line_Manager_Email__c}"/> <apex:inputField value="{! ApprenticeObj.Line_Manager_Mobile__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End ofLine Manager Details Section--> <!--Previous Education & Diagnostics--> <apex:pageBlock title="Previous Education & Diagnostics"> <apex:pageBlockSection columns="2"> <apex:inputField value="{! ApprenticeObj.English_Assessment__c}"/> <apex:inputField value="{! ApprenticeObj.Date_of_Birth__c}"/> <apex:inputField value="{! ApprenticeObj.Maths_Assessment__c}"/> <apex:inputField value="{! ApprenticeObj.Funding_Line__c}"/> <apex:inputField value="{! ApprenticeObj.Highest_Previous_Attainment__c}"/> <apex:inputField value="{! ApprenticeObj.Highest_ICT_Achievement__c}"/> <apex:inputField value="{! ApprenticeObj.Highest_English_Qual__c}"/> <apex:inputField value="{! ApprenticeObj.Prior_Learning_Record_Attached__c}"/> <apex:inputField value="{! ApprenticeObj.Highest_Maths_Qual__c}"/> <apex:inputField value="{! ApprenticeObj.Learning_Difficulties__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End of Education & Diagnostics--> <!--Apprenticeship Programme--> <apex:pageBlock title="Apprenticeship Programme"> <apex:pageBlockSection columns="2" > <apex:inputField value="{! ApprenticeObj.Apprenticeship_Title__c}"/> <apex:inputField value="{! ApprenticeObj.Minimum_Duration__c}"/> <apex:inputField value="{! ApprenticeObj.Apprenticeship_Pathway__c}"/> <apex:inputField value="{! ApprenticeObj.Prefered_Duration__c}"/> <apex:inputField value="{! ApprenticeObj.Apprenticeship_Level__c}"/> <apex:inputField value="{! ApprenticeObj.Development_Coach__c}"/> <apex:inputField value="{! ApprenticeObj.Apprenticeship_Type__c}"/> <apex:inputField value="{! ApprenticeObj.Usual_College_Day__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End of Apprenticeship Programme--> <!--Functional Skills--> <apex:pageBlock title="Functional Skills"> <apex:pageBlockSection columns="2" > <apex:inputField value="{! ApprenticeObj.Functional_Maths__c}"/> <apex:inputField value="{! ApprenticeObj.Maths_Status__c}"/> <apex:inputField value="{! ApprenticeObj.Functional_English__c}"/> <apex:inputField value="{! ApprenticeObj.English_Status__c}"/> <apex:inputField value="{! ApprenticeObj.Functional_ICT__c}"/> <apex:inputField value="{! ApprenticeObj.ICT_Status__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End of Functional Skills--> <!--Existing Employer Details--> <apex:pageBlock title="Existing Employer Details"> <apex:pageBlockSection columns="2" > <apex:inputField value="{! ApprenticeObj.Original_Start_Date__c}"/> <apex:inputField value="{! ApprenticeObj.Additional_Skills_Existing_Employee__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End of Existing Employer Details--> <!--End Point Assessment (EPA)--> <apex:pageBlock title="End Point Assessment (EPA)"> <apex:pageBlockSection columns="2" > <apex:inputField value="{! ApprenticeObj.Functional_Maths__c}"/> <apex:inputField value="{! ApprenticeObj.Maths_Status__c}"/> <apex:inputField value="{! ComponentsObj.Qual_Aim_Text__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End of End Point Assessment (EPA)--> <!--Apprenticeship Components--> <apex:pageBlock title="Apprenticeship Components"> <apex:pageBlockSection columns="1" > <apex:inputField value="{! ComponentsObj.Apprenticeship_Qualifications__c}"/> <apex:inputField value="{! ComponentsObj.Learning_Aim_Code__c}"/> <apex:inputField value="{! ComponentsObj.Awarding_Organisation__c}"/> <apex:inputField value="{! ComponentsObj.Delivery_Location__c}"/> <apex:inputField value="{! ComponentsObj.Start_Date__c}"/> <apex:inputField value="{! ComponentsObj.Planned_End_date__c}"/> <apex:inputField value="{! ComponentsObj.Percentage_of_Aim_to_be_Delivered__c}"/> </apex:pageBlockSection> </apex:pageBlock> <!--End of Apprenticeship Components--> <!--Save/Cancel--> <apex:pageBlock > <apex:commandButton action="{!saveObjects }" value="Save" /> </apex:pageBlock> <!--End of Save/Cancel--> </apex:form> </apex:page>Also my controller :-
public class myController{ public Apprentice__c ApprenticeObj{get;set;} public Apprenticeship_Component__c ComponentsObj{get;set;} public Programme_Area__c ProgramArea {get;set;} public myController(){ ApprenticeObj = new Apprentice__c(); ComponentsObj = new Apprenticeship_Component__c(); ProgramArea = new Programme_Area__c (); } public void saveObjects(){ ProgramArea.PA_Code__c = 'P12'; insert ProgramArea; ApprenticeObj.Programme_area__c = ProgramArea.Id; ApprenticeObj.ULN__c = '56464646'; insert ApprenticeObj; ComponentsObj.Apprentice__c = ApprenticeObj.Id; insert ComponentsObj; } }
Thankyou
To resolve your issue, you need to change first line of visualforce page code like this
In your apex class, you'll have to update constructor like this:
After saving this. Refresh the create new button. you'll see the vf page in the list.
Please mark this as BEST ANSWER, if this solves your problem
All Answers
To resolve your issue, you need to change first line of visualforce page code like this
In your apex class, you'll have to update constructor like this:
After saving this. Refresh the create new button. you'll see the vf page in the list.
Please mark this as BEST ANSWER, if this solves your problem
3. Change Standard Controller to Custom Controller