-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
8Questions
-
12Replies
Help. I need rewrite this trigger for many new objects. Not for 1
trigger checktime on Appointment__c (before insert, before update) { Time startDate; Datetime endDate; String Name; List<Appointment__c> events = [ SELECT Id FROM Appointment__c WHERE Appointment_Data__c <= :TRIGGER.new[0].Appointment_Data_End__c and Appointment_Data_End__c>=: TRIGGER.new[0].Appointment_Data__c and Doctor__c =:TRIGGER.new[0].Doctor__c ]; if(events.isEmpty()==false){ Trigger.new[0].addError('Error GMAK'); } }
- Siarhei balantsevich
- June 01, 2021
- Like
- 1
how to overwrite a method ApexPages.StandardSetController throught ApexPages.StandardSetController which has apex:actionSupport
i dont'know how to rewrite this
public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select ID,NAme,Doctor__r.Name,patient__r.Name,Duration_in_minutes__c ,Appointment_Data__c FROM Appointment__c where Doctor__r.ID =: selectedDoctor ])); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; } set; }
- Siarhei balantsevich
- May 30, 2021
- Like
- 0
How to make it so that when you select a value in the doctor field, the table is redrawn only with the values of the selected doctor
Apex code
Visualforce
public with sharing class app_test_1 { public Appointment__c appt {get; set;} public string Doc_name {get;set;} public string Patient_name {get;set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public List<Appointment__c> appList {get;set;} public string str_1 {get;set;} Public Integer size{get;set;} Public Integer noOfRecords{get; set;} public List<SelectOption> paginationSizeOptions{get;set;} public app_test_1(){ SelectreDdoc(); str_1='gmak'; appt=new Appointment__c(); // getApp(); doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } size=10; paginationSizeOptions = new List<SelectOption>(); paginationSizeOptions.add(new SelectOption('5','5')); paginationSizeOptions.add(new SelectOption('10','10')); paginationSizeOptions.add(new SelectOption('20','20')); paginationSizeOptions.add(new SelectOption('50','50')); paginationSizeOptions.add(new SelectOption('100','100')); } public PageReference save() { return null; } public PageReference saveandnew() { appt.Doctor__c=selectedDoctor; appt.patient__c=selectedPatient; insert appt; appt.clear(); PageReference pr = new PageReference('/apex/vs_g_t_01'); pr.setRedirect(true); return pr; } public list<Doctor__c> getDoc() { return [Select Name, working_hours_start__c,Working_Hours_End__c From Doctor__c where Name Like :selectedDoctor]; } public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select ID,NAme,Doctor__r.Name,patient__r.Name,Duration_in_minutes__c ,Appointment_Data__c FROM Appointment__c ])); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; } set; } //Changes the size of pagination public PageReference refreshPageSize() { setCon.setPageSize(size); return null; } // Initialize setCon and return a list of record public List<Appointment__c> getApp() { return (List<Appointment__c>) setCon.getRecords(); } public PageReference SelectreDdoc() { selectedDoctor =this.selectedDoctor; return null; } public PageReference SelectrePatient() { selectedPatient =this.selectedPatient; return null; } public PageReference RedirDoctor(){ PageReference pr = new PageReference('/lightning/o/Doctor__c/home'); pr.setRedirect(true); return pr; } public PageReference RedirPatient(){ PageReference pr = new PageReference('/lightning/o/Patient__c/home'); pr.setRedirect(true); return pr; } }
Visualforce
<apex:page controller="app_test_1"> <apex:form > <apex:pageBlock title="appointment"> <!-- Select a doctor <apex:pageBlockSection > Select a doctor: <apex:selectList size="1" multiselect="false" value="{!selectedDoctor}" onchange="SelectreDdoc();"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" reRender="selected"/> </apex:selectList> </apex:pageBlockSection> --> <apex:pageBlock > <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.Working_Hours_End__c}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlockSection > Select a doctor: <apex:outputPanel id="selectedDoctor">{!selectedDoctor}</apex:outputPanel> <apex:selectList size="1" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" reRender="selected"/> </apex:selectList> </apex:pageBlockSection> <!-- Select a patient --> <apex:pageBlockSection > Select a patient: <apex:selectList size="1" multiselect="false" value="{!selectedPatient}" onchange="SelectrePatient();"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="false"/> </apex:pageBlockSection> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton reRender="pbId" value="Add new appointment" action="{!saveandnew}" /> <apex:commandButton reRender="pbId" value="Add new doctor" action="{!RedirDoctor}" /> <apex:commandButton reRender="pbId" value="Add new Patient" action="{!RedirPatient}" /> </apex:pageBlockButtons> </apex:pageBlock> <script type="text/javascript"> console.log('{!selectedDoctor}'); </script> <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="pbId"/> <apex:pageBlock id="pbId"> <apex:pageBlockSection title="All Opportunities" collapsible="false" columns="1"> <apex:pageBlockTable value="{!App}" var="oppObj"> <apex:column headerValue="Action"> <apex:outputLink value="{!URLFOR('/' + oppObj.Id)}"> View </apex:outputLink> </apex:column> <apex:column headerValue="Doctor Name"> <apex:outputField value="{!oppObj.Doctor__r.Name}"/> </apex:column> <apex:column headerValue="Patient Name"> <apex:outputField value="{!oppObj.patient__r.Name}"/> </apex:column> <apex:column headerValue="Appointment Data"> <apex:outputField value="{!oppObj.Appointment_Data__c}"/> </apex:column> <apex:column headerValue="Appointment Duration"> <apex:outputField value="{!oppObj.Duration_in_minutes__c}"/> </apex:column> </apex:pageBlockTable> <apex:panelGrid columns="8"> <apex:selectList value="{!size}" multiselect="false" size="1" onchange="refreshPageSize();"> <apex:selectOptions value="{!paginationSizeOptions}"/> </apex:selectList> <apex:commandButton status="fetchStatus" reRender="pbId" value="First" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Previous" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Next" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Last" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords, (setCon.pageNumber * size))} of {!noOfRecords} </apex:outputText> <apex:outputPanel > <apex:actionStatus id="fetchStatus" > <apex:facet name="start" > <img src="/img/loading.gif" /> </apex:facet> </apex:actionStatus> </apex:outputPanel> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- Siarhei balantsevich
- May 30, 2021
- Like
- 0
how to save the selected value from select list to a variable each time
i have the selectlist
I need to overwrite the variable every time I selecе.because my choice is based on this value
apex
vsforce
<!-- Select a doctor --> <apex:pageBlockSection > Select a doctor: <apex:selectList size="1" multiselect="false" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/>
I need to overwrite the variable every time I selecе.because my choice is based on this value
apex
public with sharing class app_test_1 { public Appointment__c appt {get; set;} public string Doc_name {get;set;} public string Patient_name {get;set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public List<Appointment__c> appList {get;set;} public string str_1 {get;set;} Public Integer size{get;set;} Public Integer noOfRecords{get; set;} public List<SelectOption> paginationSizeOptions{get;set;} public app_test_1(){ str_1='gmak'; Patient_name = 'a015g00000KIFvGAAX'; appt=new Appointment__c(); // getApp(); doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } size=10; paginationSizeOptions = new List<SelectOption>(); paginationSizeOptions.add(new SelectOption('5','5')); paginationSizeOptions.add(new SelectOption('10','10')); paginationSizeOptions.add(new SelectOption('20','20')); paginationSizeOptions.add(new SelectOption('50','50')); paginationSizeOptions.add(new SelectOption('100','100')); } public PageReference save() { return null; } public PageReference saveandnew() { Doc_name = selectedDoctor; appt.Doctor__c=selectedDoctor; appt.patient__c=Patient_name; insert appt; PageReference PageRef = new PageReference('/apex/vs_g_t_01'); appt.clear(); return PageRef; } public list<Doctor__c> getDoc() { return [Select Name, working_hours_start__c,Working_Hours_End__c From Doctor__c where Name Like :str_1]; } public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select ID,NAme,Doctor__r.Name,patient__r.Name,Duration_in_minutes__c ,Appointment_Data__c FROM Appointment__c ])); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; } set; } //Changes the size of pagination public PageReference refreshPageSize() { setCon.setPageSize(size); return null; } // Initialize setCon and return a list of record public List<Appointment__c> getApp() { return (List<Appointment__c>) setCon.getRecords(); } }
vsforce
<apex:page controller="app_test_1"> <apex:form > <apex:pageBlock title="appointment"> <!-- Select a doctor --> <apex:pageBlockSection > Select a doctor: <apex:selectList size="1" multiselect="false" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlock > <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.Working_Hours_End__c}"/> </apex:pageBlockTable> </apex:pageBlock> <!-- Select a patient --> <apex:pageBlockSection > Select a patient: <apex:selectList size="1" value="{!selectedPatient}"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="false"/> </apex:pageBlockSection> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton reRender="pbId" value="Add new appointment" action="{!saveandnew}" /> </apex:pageBlockButtons> </apex:pageBlock> <script type="text/javascript"> console.log('{!selectedDoctor}'); </script> <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="pbId"/> <apex:pageBlock id="pbId"> <apex:pageBlockSection title="All Opportunities" collapsible="false" columns="1"> <apex:pageBlockTable value="{!App}" var="oppObj"> <apex:column headerValue="Action"> <apex:outputLink value="{!URLFOR('/' + oppObj.Id)}"> View </apex:outputLink> </apex:column> <apex:column headerValue="Doctor Name"> <apex:outputField value="{!oppObj.Doctor__r.Name}"/> </apex:column> <apex:column headerValue="Patient Name"> <apex:outputField value="{!oppObj.patient__r.Name}"/> </apex:column> <apex:column headerValue="Appointment Data"> <apex:outputField value="{!oppObj.Appointment_Data__c}"/> </apex:column> <apex:column headerValue="Appointment Duration"> <apex:outputField value="{!oppObj.Duration_in_minutes__c}"/> </apex:column> </apex:pageBlockTable> <apex:panelGrid columns="8"> <apex:selectList value="{!size}" multiselect="false" size="1" onchange="refreshPageSize();"> <apex:selectOptions value="{!paginationSizeOptions}"/> </apex:selectList> <apex:commandButton status="fetchStatus" reRender="pbId" value="First" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Previous" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Next" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Last" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords, (setCon.pageNumber * size))} of {!noOfRecords} </apex:outputText> <apex:outputPanel > <apex:actionStatus id="fetchStatus" > <apex:facet name="start" > <img src="/img/loading.gif" /> </apex:facet> </apex:actionStatus> </apex:outputPanel> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> <a class="btn" onclick="checkDoubleSubmit(this)" target="_top">Update Opportunity</a> <script> function lod(isReLoad) { if(isReLoad == true) { } } </script> <script> var isClicked = false; function checkDoubleSubmit(obj){ if (isClicked) { alert('{!size}');//For testing message only. return false; } else { isClicked = true; alert('{!size}'); updateOpportunity(); return false; } } </script> </apex:form> </apex:page>
- Siarhei balantsevich
- May 30, 2021
- Like
- 0
My paginator doesen't work Help
apex
vsf
public with sharing class app_test_1 { public Appointment__c appt {get; set;} public string Doc_name {get;set;} public string Patient_name {get;set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public List<Appointment__c> appList {get;set;} public string str_1 {get;set;} Public Integer size{get;set;} Public Integer noOfRecords{get; set;} public List<SelectOption> paginationSizeOptions{get;set;} public app_test_1(){ str_1='kukla'; Patient_name = 'a015g00000KIFvGAAX'; appt=new Appointment__c(); // getApp(); doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } size=10; paginationSizeOptions = new List<SelectOption>(); paginationSizeOptions.add(new SelectOption('5','5')); paginationSizeOptions.add(new SelectOption('10','10')); paginationSizeOptions.add(new SelectOption('20','20')); paginationSizeOptions.add(new SelectOption('50','50')); paginationSizeOptions.add(new SelectOption('100','100')); } public PageReference save() { return null; } public PageReference saveandnew() { Doc_name = selectedDoctor; appt.Doctor__c=selectedDoctor; appt.patient__c=Patient_name; insert appt; PageReference PageRef = new PageReference('/apex/vs_g_t_01'); appt.clear(); return PageRef; } public list<Doctor__c> getDoc() { return [Select Name, working_hours_start__c,Working_Hours_End__c From Doctor__c where Name Like :str_1]; } public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select ID,NAme,Doctor__r.Name,patient__r.Name,Duration_in_minutes__c ,Appointment_Data__c FROM Appointment__c])); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; } set; } //Changes the size of pagination public PageReference refreshPageSize() { setCon.setPageSize(size); return null; } // Initialize setCon and return a list of record public List<Appointment__c> getOpportunities() { return (List<Appointment__c>) setCon.getRecords(); } }
vsf
<apex:page controller="app_test_1"> <apex:form > <apex:pageBlock title="appointment"> <!-- Select a doctor --> <apex:pageBlockSection > Select a doctor: <apex:selectList size="1" multiselect="false" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlock> <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.Working_Hours_End__c}"/> </apex:pageBlockTable> </apex:pageBlock> <!-- Select a patient --> <apex:pageBlockSection > Select a patient: <apex:selectList size="1" value="{!selectedPatient}"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="true"/> </apex:pageBlockSection> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" /> <apex:commandButton value="Save & New" action="{!saveandnew}" /> <apex:commandButton value="Cancel" action="/apex/Registration" immediate="true" /> </apex:pageBlockButtons> </apex:pageBlock> <script type="text/javascript"> console.log('{!selectedDoctor}'); </script> <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="pbId"/> <apex:pageBlock id="pbId"> <apex:pageBlockSection title="All Opportunities" collapsible="false" columns="1"> <apex:pageBlockTable value="{!Opportunities}" var="oppObj"> <apex:column headerValue="Opportunity Name"> <apex:outputField value="{!oppObj.Name}"/> </apex:column> <apex:column headerValue="Account Name"> <apex:outputField value="{!oppObj.Doctor__r.Name}"/> </apex:column> <apex:column headerValue="Amount"> <apex:outputField value="{!oppObj.patient__r.Name}"/> </apex:column> <apex:column headerValue="Close Date"> <apex:outputField value="{!oppObj.Appointment_Data__c}"/> </apex:column> </apex:pageBlockTable> <apex:panelGrid columns="8"> <apex:selectList value="{!size}" multiselect="false" size="1" onchange="refreshPageSize();"> <apex:selectOptions value="{!paginationSizeOptions}"/> </apex:selectList> <apex:commandButton status="fetchStatus" reRender="pbId" value="First" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Previous" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Next" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Last" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords, (setCon.pageNumber * size))} of {!noOfRecords} </apex:outputText> <apex:outputPanel > <apex:actionStatus id="fetchStatus" > <apex:facet name="start" > <img src="/img/loading.gif" /> </apex:facet> </apex:actionStatus> </apex:outputPanel> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- Siarhei balantsevich
- May 29, 2021
- Like
- 0
how i can get selected id in selectlist
how i can get selected id in selectlist? I need to save a new object based on this value
value don't help me
<apex:pageBlockSection > Select a doctor: <apex:selectList size="1" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" action="console.log('{!selectedPatient}')" reRender="app_list1, app_list2, app_list3"/> </apex:selectList> </apex:pageBlockSection>
value don't help me
- Siarhei balantsevich
- May 29, 2021
- Like
- 0
how to write a new object of class appointment__c with input fields
controller
visual force
public class HospitalController { public Appointment__c appt {get; set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public Integer duration {get; set;} public List<appointment__c> tableAppointments{get; set;} public Time TimeStart {get;set;} // public PageReference addNewAppt() { // return null; //} public Integer PageNumber {get; set;} Public Integer PageSize {get;set;} Public Integer ResultSize {get;set;} public PageReference addNewAppt() { this.appt.Doctor__c = selectedDoctor; this.appt.Patient__c = selectedPatient; //Duration and Appointment Date will be populated by VF page insert this.appt; } public list<Doctor__c> getDoc() { return [Select working_hours_start__c From Doctor__c]; } public PageReference redirectToMyVF(Id accId) { PageReference myVFPage = new PageReference('/apex/myVFPage'); myVFPage.setRedirect(true); myVFPage.getParameters().put('myId', accId); return myVFPage; } public HospitalController() { this.appt = new Appointment__c(); this.selectedDoctor = ''; this.selectedPatient = ''; this.appDate = System.now(); this.duration = 30; doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } } }i trying this function public PageReference addNewAppt() but id doesen't work.
visual force
<apex:page docType="html-5.0" controller="HospitalController" showHeader="false" sidebar="false"> <apex:form > <apex:pageBlock title="Appointmets Table"> <!-- Select a doctor --> <apex:pageBlockSection> Select a doctor: <apex:selectList size="1" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" reRender="app_list1, app_list2, app_list3"/> </apex:selectList> </apex:pageBlockSection> <!-- Select a patient --> <apex:pageBlockSection> Select a patient: <apex:selectList size="1" value="{!selectedPatient}"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <!-- <apex:pageBlock> <apex:pageBlockTable value="{!doctorList}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> </apex:pageBlock> --> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection > <apex:commandButton immediate="false" reRender="app_list3" action="{!addNewAppt}" value="Add New Appointment" /> </apex:pageBlockSection> <!-- Pagination --> <table style="width: 100%"><tr> <td> Page: <apex:outputText value="{!PageNumber} of {!CEILING(ResultSize / PageSize)}"/> </td> <td align="center"> <!-- Previous page --> <!-- active --> <!-- Next page --> <!-- active --> </td> <td align="right"> <!-- Records per page --> Records per page: <apex:selectList value="{!PageSize}" size="1"> <apex:selectOption itemValue="5" itemLabel="5"/> <apex:selectOption itemValue="20" itemLabel="20"/> <apex:actionSupport event="onchange" reRender="contacts_list"/> </apex:selectList> </td> </tr></table> </apex:pageBlock> </apex:form> </apex:page>
- Siarhei balantsevich
- May 28, 2021
- Like
- 0
In my visualForce page i write custom controller and i get error: Unknown property 'HospitalController.Doc'
public class HospitalController { public Appointment__c appt {get; set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public Integer duration {get; set;} public List<appointment__c> tableAppointments{get; set;} public Time TimeStart {get;set;} public PageReference addNewAppt() { return null; } public Integer PageNumber {get; set;} Public Integer PageSize {get;set;} Public Integer ResultSize {get;set;} public list<Doctor__c> getDoc() { return [Select working_hours_start__c From Doctor__c]; } public PageReference redirectToMyVF(Id accId) { PageReference myVFPage = new PageReference('/apex/myVFPage'); myVFPage.setRedirect(true); myVFPage.getParameters().put('myId', accId); return myVFPage; } public HospitalController() { this.appt = new Appointment__c(); this.selectedDoctor = ''; this.selectedPatient = ''; this.appDate = System.now(); this.duration = 30; doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } } }and visualforce page
<apex:page docType="html-5.0" controller="HospitalController" showHeader="false" sidebar="false"> <apex:form > <apex:pageBlock title="Appointmets Table"> <!-- Select a doctor --> <apex:pageBlockSection> Select a doctor: <apex:selectList size="1" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" reRender="app_list1, app_list2, app_list3"/> </apex:selectList> </apex:pageBlockSection> <!-- Select a patient --> <apex:pageBlockSection> Select a patient: <apex:selectList size="1"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlock> <apex:pageBlockTable value="{!Doc}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlockSection > <apex:commandButton immediate="false" reRender="app_list3" action="{!addNewAppt}" value="Add New Appointment" /> </apex:pageBlockSection> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="false"/> </apex:pageBlockSection> <!-- Pagination --> <table style="width: 100%"><tr> <td> Page: <apex:outputText value="{!PageNumber} of {!CEILING(ResultSize / PageSize)}"/> </td> <td align="center"> <!-- Previous page --> <!-- active --> <!-- Next page --> <!-- active --> </td> <td align="right"> <!-- Records per page --> Records per page: <apex:selectList value="{!PageSize}" size="1"> <apex:selectOption itemValue="5" itemLabel="5"/> <apex:selectOption itemValue="20" itemLabel="20"/> <apex:actionSupport event="onchange" reRender="contacts_list"/> </apex:selectList> </td> </tr></table> </apex:pageBlock> </apex:form> </apex:page>
- Siarhei balantsevich
- May 28, 2021
- Like
- 0
Help. I need rewrite this trigger for many new objects. Not for 1
trigger checktime on Appointment__c (before insert, before update) { Time startDate; Datetime endDate; String Name; List<Appointment__c> events = [ SELECT Id FROM Appointment__c WHERE Appointment_Data__c <= :TRIGGER.new[0].Appointment_Data_End__c and Appointment_Data_End__c>=: TRIGGER.new[0].Appointment_Data__c and Doctor__c =:TRIGGER.new[0].Doctor__c ]; if(events.isEmpty()==false){ Trigger.new[0].addError('Error GMAK'); } }
- Siarhei balantsevich
- June 01, 2021
- Like
- 1
how to overwrite a method ApexPages.StandardSetController throught ApexPages.StandardSetController which has apex:actionSupport
i dont'know how to rewrite this
public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select ID,NAme,Doctor__r.Name,patient__r.Name,Duration_in_minutes__c ,Appointment_Data__c FROM Appointment__c where Doctor__r.ID =: selectedDoctor ])); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; } set; }
- Siarhei balantsevich
- May 30, 2021
- Like
- 0
My paginator doesen't work Help
apex
vsf
public with sharing class app_test_1 { public Appointment__c appt {get; set;} public string Doc_name {get;set;} public string Patient_name {get;set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public List<Appointment__c> appList {get;set;} public string str_1 {get;set;} Public Integer size{get;set;} Public Integer noOfRecords{get; set;} public List<SelectOption> paginationSizeOptions{get;set;} public app_test_1(){ str_1='kukla'; Patient_name = 'a015g00000KIFvGAAX'; appt=new Appointment__c(); // getApp(); doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } size=10; paginationSizeOptions = new List<SelectOption>(); paginationSizeOptions.add(new SelectOption('5','5')); paginationSizeOptions.add(new SelectOption('10','10')); paginationSizeOptions.add(new SelectOption('20','20')); paginationSizeOptions.add(new SelectOption('50','50')); paginationSizeOptions.add(new SelectOption('100','100')); } public PageReference save() { return null; } public PageReference saveandnew() { Doc_name = selectedDoctor; appt.Doctor__c=selectedDoctor; appt.patient__c=Patient_name; insert appt; PageReference PageRef = new PageReference('/apex/vs_g_t_01'); appt.clear(); return PageRef; } public list<Doctor__c> getDoc() { return [Select Name, working_hours_start__c,Working_Hours_End__c From Doctor__c where Name Like :str_1]; } public ApexPages.StandardSetController setCon { get { if(setCon == null) { setCon = new ApexPages.StandardSetController(Database.getQueryLocator( [select ID,NAme,Doctor__r.Name,patient__r.Name,Duration_in_minutes__c ,Appointment_Data__c FROM Appointment__c])); setCon.setPageSize(size); noOfRecords = setCon.getResultSize(); } return setCon; } set; } //Changes the size of pagination public PageReference refreshPageSize() { setCon.setPageSize(size); return null; } // Initialize setCon and return a list of record public List<Appointment__c> getOpportunities() { return (List<Appointment__c>) setCon.getRecords(); } }
vsf
<apex:page controller="app_test_1"> <apex:form > <apex:pageBlock title="appointment"> <!-- Select a doctor --> <apex:pageBlockSection > Select a doctor: <apex:selectList size="1" multiselect="false" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlock> <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> <apex:pageBlockTable value="{!doc}" var="item"> <apex:column value="{!item.Working_Hours_End__c}"/> </apex:pageBlockTable> </apex:pageBlock> <!-- Select a patient --> <apex:pageBlockSection > Select a patient: <apex:selectList size="1" value="{!selectedPatient}"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="true"/> </apex:pageBlockSection> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="true"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}" /> <apex:commandButton value="Save & New" action="{!saveandnew}" /> <apex:commandButton value="Cancel" action="/apex/Registration" immediate="true" /> </apex:pageBlockButtons> </apex:pageBlock> <script type="text/javascript"> console.log('{!selectedDoctor}'); </script> <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="pbId"/> <apex:pageBlock id="pbId"> <apex:pageBlockSection title="All Opportunities" collapsible="false" columns="1"> <apex:pageBlockTable value="{!Opportunities}" var="oppObj"> <apex:column headerValue="Opportunity Name"> <apex:outputField value="{!oppObj.Name}"/> </apex:column> <apex:column headerValue="Account Name"> <apex:outputField value="{!oppObj.Doctor__r.Name}"/> </apex:column> <apex:column headerValue="Amount"> <apex:outputField value="{!oppObj.patient__r.Name}"/> </apex:column> <apex:column headerValue="Close Date"> <apex:outputField value="{!oppObj.Appointment_Data__c}"/> </apex:column> </apex:pageBlockTable> <apex:panelGrid columns="8"> <apex:selectList value="{!size}" multiselect="false" size="1" onchange="refreshPageSize();"> <apex:selectOptions value="{!paginationSizeOptions}"/> </apex:selectList> <apex:commandButton status="fetchStatus" reRender="pbId" value="First" action="{!setCon.first}" disabled="{!!setCon.hasPrevious}" title="First Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Previous" action="{!setCon.previous}" disabled="{!!setCon.hasPrevious}" title="Previous Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Next" action="{!setCon.next}" disabled="{!!setCon.hasNext}" title="Next Page"/> <apex:commandButton status="fetchStatus" reRender="pbId" value="Last" action="{!setCon.last}" disabled="{!!setCon.hasNext}" title="Last Page"/> <apex:outputText >{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords, (setCon.pageNumber * size))} of {!noOfRecords} </apex:outputText> <apex:outputPanel > <apex:actionStatus id="fetchStatus" > <apex:facet name="start" > <img src="/img/loading.gif" /> </apex:facet> </apex:actionStatus> </apex:outputPanel> </apex:panelGrid> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
- Siarhei balantsevich
- May 29, 2021
- Like
- 0
how i can get selected id in selectlist
how i can get selected id in selectlist? I need to save a new object based on this value
value don't help me
<apex:pageBlockSection > Select a doctor: <apex:selectList size="1" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" action="console.log('{!selectedPatient}')" reRender="app_list1, app_list2, app_list3"/> </apex:selectList> </apex:pageBlockSection>
value don't help me
- Siarhei balantsevich
- May 29, 2021
- Like
- 0
how to write a new object of class appointment__c with input fields
controller
visual force
public class HospitalController { public Appointment__c appt {get; set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public Integer duration {get; set;} public List<appointment__c> tableAppointments{get; set;} public Time TimeStart {get;set;} // public PageReference addNewAppt() { // return null; //} public Integer PageNumber {get; set;} Public Integer PageSize {get;set;} Public Integer ResultSize {get;set;} public PageReference addNewAppt() { this.appt.Doctor__c = selectedDoctor; this.appt.Patient__c = selectedPatient; //Duration and Appointment Date will be populated by VF page insert this.appt; } public list<Doctor__c> getDoc() { return [Select working_hours_start__c From Doctor__c]; } public PageReference redirectToMyVF(Id accId) { PageReference myVFPage = new PageReference('/apex/myVFPage'); myVFPage.setRedirect(true); myVFPage.getParameters().put('myId', accId); return myVFPage; } public HospitalController() { this.appt = new Appointment__c(); this.selectedDoctor = ''; this.selectedPatient = ''; this.appDate = System.now(); this.duration = 30; doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } } }i trying this function public PageReference addNewAppt() but id doesen't work.
visual force
<apex:page docType="html-5.0" controller="HospitalController" showHeader="false" sidebar="false"> <apex:form > <apex:pageBlock title="Appointmets Table"> <!-- Select a doctor --> <apex:pageBlockSection> Select a doctor: <apex:selectList size="1" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" reRender="app_list1, app_list2, app_list3"/> </apex:selectList> </apex:pageBlockSection> <!-- Select a patient --> <apex:pageBlockSection> Select a patient: <apex:selectList size="1" value="{!selectedPatient}"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <!-- <apex:pageBlock> <apex:pageBlockTable value="{!doctorList}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> </apex:pageBlock> --> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection > <apex:commandButton immediate="false" reRender="app_list3" action="{!addNewAppt}" value="Add New Appointment" /> </apex:pageBlockSection> <!-- Pagination --> <table style="width: 100%"><tr> <td> Page: <apex:outputText value="{!PageNumber} of {!CEILING(ResultSize / PageSize)}"/> </td> <td align="center"> <!-- Previous page --> <!-- active --> <!-- Next page --> <!-- active --> </td> <td align="right"> <!-- Records per page --> Records per page: <apex:selectList value="{!PageSize}" size="1"> <apex:selectOption itemValue="5" itemLabel="5"/> <apex:selectOption itemValue="20" itemLabel="20"/> <apex:actionSupport event="onchange" reRender="contacts_list"/> </apex:selectList> </td> </tr></table> </apex:pageBlock> </apex:form> </apex:page>
- Siarhei balantsevich
- May 28, 2021
- Like
- 0
In my visualForce page i write custom controller and i get error: Unknown property 'HospitalController.Doc'
public class HospitalController { public Appointment__c appt {get; set;} public List<Doctor__c> doclists{set;get;} public String selectedDoctor {get; set;} public String selectedPatient {get; set;} public Datetime appDate {get; set;} public List<Doctor__c> DoctorList {get;set;} public List<SelectOption> doctorSelectOptionList {get;set;} public List<Patient__c> PatientList {get;set;} public List<SelectOption> patientSelectOptionList {get;set;} public Integer duration {get; set;} public List<appointment__c> tableAppointments{get; set;} public Time TimeStart {get;set;} public PageReference addNewAppt() { return null; } public Integer PageNumber {get; set;} Public Integer PageSize {get;set;} Public Integer ResultSize {get;set;} public list<Doctor__c> getDoc() { return [Select working_hours_start__c From Doctor__c]; } public PageReference redirectToMyVF(Id accId) { PageReference myVFPage = new PageReference('/apex/myVFPage'); myVFPage.setRedirect(true); myVFPage.getParameters().put('myId', accId); return myVFPage; } public HospitalController() { this.appt = new Appointment__c(); this.selectedDoctor = ''; this.selectedPatient = ''; this.appDate = System.now(); this.duration = 30; doctorSelectOptionList = new List<SelectOption>(); patientSelectOptionList = new List<SelectOption>(); DoctorList = [SELECT iD, Name,working_hours_start__c FROM Doctor__c]; //TimeStart = DoctorList.working_hours_start__c; for (Doctor__c doc : DoctorList){ doctorSelectOptionList.add(new SelectOption(doc.Id, doc.Name)); } PatientList = [SELECT Id, Name FROM Patient__c]; for (Patient__c patient : PatientList){ patientSelectOptionList.add(new SelectOption(patient.Id, patient.Name)); } } }and visualforce page
<apex:page docType="html-5.0" controller="HospitalController" showHeader="false" sidebar="false"> <apex:form > <apex:pageBlock title="Appointmets Table"> <!-- Select a doctor --> <apex:pageBlockSection> Select a doctor: <apex:selectList size="1" value="{!selectedDoctor}"> <apex:selectOptions value="{!doctorSelectOptionList}"/> <apex:actionSupport event="onchange" reRender="app_list1, app_list2, app_list3"/> </apex:selectList> </apex:pageBlockSection> <!-- Select a patient --> <apex:pageBlockSection> Select a patient: <apex:selectList size="1"> <apex:selectOptions value="{!patientSelectOptionList}"/> </apex:selectList> </apex:pageBlockSection> <apex:pageBlock> <apex:pageBlockTable value="{!Doc}" var="item"> <apex:column value="{!item.working_hours_start__c}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlockSection > <apex:commandButton immediate="false" reRender="app_list3" action="{!addNewAppt}" value="Add New Appointment" /> </apex:pageBlockSection> <!-- Appointment date --> <apex:pageBlockSection > <apex:inputField label="Appointment date" value="{!appt.Appointment_Data__c}" required="false"/> </apex:pageBlockSection> <apex:pageBlockSection > <apex:inputField label="Duration in minutes" value="{!appt.Duration_in_minutes__c}" required="false"/> </apex:pageBlockSection> <!-- Pagination --> <table style="width: 100%"><tr> <td> Page: <apex:outputText value="{!PageNumber} of {!CEILING(ResultSize / PageSize)}"/> </td> <td align="center"> <!-- Previous page --> <!-- active --> <!-- Next page --> <!-- active --> </td> <td align="right"> <!-- Records per page --> Records per page: <apex:selectList value="{!PageSize}" size="1"> <apex:selectOption itemValue="5" itemLabel="5"/> <apex:selectOption itemValue="20" itemLabel="20"/> <apex:actionSupport event="onchange" reRender="contacts_list"/> </apex:selectList> </td> </tr></table> </apex:pageBlock> </apex:form> </apex:page>
- Siarhei balantsevich
- May 28, 2021
- Like
- 0