-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
7Questions
-
12Replies
VF page in developer console preview and sites --> site url difference
Hi,
When I preview the VF page from developer console the report chart shows correctly on the page but when I acces on setup -- > sites --> site url (click) the VF page do not show the report chart on the page.
I have given the access for reports/dashboards as well. Not sure why it shows difference.
Please help me on this issue.
When I preview the VF page from developer console the report chart shows correctly on the page but when I acces on setup -- > sites --> site url (click) the VF page do not show the report chart on the page.
I have given the access for reports/dashboards as well. Not sure why it shows difference.
Please help me on this issue.
- Ravi Prabhu
- July 11, 2020
- Like
- 0
Check box value not passing to controller from visualforce page
Hi,
This looks to be simple but not able to find the issue.
I have a visualforce page with a pageblock. The page block displays 2 fields. One is date and other field is name from drop down. User should select these 2 fields and then click 'Go' button which will display the records. Later user can select the records and delete it (need to select multiple records using checkbox). The 'Go' button is working and display records but delete button is not working after selecting the records.
Please help.
This looks to be simple but not able to find the issue.
I have a visualforce page with a pageblock. The page block displays 2 fields. One is date and other field is name from drop down. User should select these 2 fields and then click 'Go' button which will display the records. Later user can select the records and delete it (need to select multiple records using checkbox). The 'Go' button is working and display records but delete button is not working after selecting the records.
Please help.
Visualforce page: <apex:form id="formId" styleClass="myFormStyle" > <apex:actionRegion > <apex:pageBlock id="pgblock2" title="Summary" > <apex:pageBlockSection id="pgblocksection2"> <apex:OutputPanel > <apex:panelGrid columns="7"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" >Date </apex:outputLabel> <apex:inputText id="Date" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;" /> <apex:param value="{!SelectedDate}" assignTo="{!selectedDate}" name="p1"/> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Select Assigned Person </apex:outputLabel> <apex:selectList id="selectedlist" value="{!selectedUserId}" size="1" multiselect="false" > <apex:param value="{!selectedUserId}" assignTo="{!selectedUserId}" name="p2"/> <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <apex:commandButton id="Go" action="{!getsummarylist}" value="Go" onclick="validatechk();" rerender="msgsS" /> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <apex:pageBlockButtons location="Bottom" > <apex:commandButton id="deleteit" value="Delete" action="{!delete_now}" reRender="msgsS"/> </apex:pageBlockButtons> <apex:outputPanel id="panelId"> <apex:pageBlockTable value="{!sub}" var="I" id="msgsS" > <apex:column headerValue="Select" > <apex:inputCheckbox value="{!I.checked}" /> <apex:param assignTo="{!I.checked}" value="{!I.checked}" /> </apex:column> <apex:column headervalue="Date" value="{!I.tkt.Date__c}"/> <apex:column headervalue="Ticket Number" value="{!I.tkt.Ticket_Number__c}"/> <apex:column headervalue="Division" value="{!I.tkt.Division__c}"/> <apex:column headervalue="Application" value="{!I.tkt.Application__c}"/> <apex:column headervalue="Responsible" value="{!I.tkt.Responsible__c}"/> <apex:column headervalue="Effort" value="{!I.tkt.Effort__c}"/> </apex:pageBlockTable> </apex:outputPanel> </apex:pageBlock> </apex:actionRegion> </apex:form> </apex:page> Apex controller public with sharing class TestPageBlock2Cont { public String selecteduserId {get;set;} public Date selectedDate {get;set;} List<SelectOption> selectOptions{get;set;} public List<Wrapperclass> sub {get;set;} public TestPageBlock2Cont() { tktRecord = new Ticket_Effort_Category__c(); lstwrapper = new list<wrapper>(); header = 'Date,Division\r\n'; } //after pressing 'Go' button, this method will be called public Pagereference getsummarylist(){ if(selectedDate == null){ system.debug('selectedDate 3 = ' +selectedDate); ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please enter date')); } else{ sub = new List<WrapperClass>(); list<ticket_effort_category__c> fetchList = new list<ticket_effort_category__c>(); fetchList = [select id, Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selectedUserId and Date__c = :selectedDate]; for(Ticket_Effort_Category__c cr : fetchlist){ sub.add(new wrapperClass (cr,false)); } } return null; } //wrapp the records and checkbox public class WrapperClass { public Ticket_effort_category__c tkt {get; set;} public Boolean checked {get; set;} public wrapperClass(Ticket_effort_category__c tkt, Boolean checked){ this.tkt=tkt; this.checked = checked; } } //delete the selected records public void delete_now(){ List<Ticket_Effort_Category__c> del = new list<Ticket_Effort_Category__c>(); for(WrapperClass cc: sub){ system.debug('tktid = ' +tktid); if(cc.checked == true){ del.add(cc.tkt); } } delete del; return null; } //show up the dropdown for user to select the name public List<SelectOption> getListOfUser(){ selectOptions = new List<SelectOption>(); selectOptions.add(new SelectOption( ' ' ,'---Select---')); Schema.DescribeFieldResult describeResult = Ticket_Effort_Category__c.Responsible__c.getDescribe(); List<Schema.PicklistEntry> pickListEntries = describeResult.getPicklistValues(); for( Schema.PicklistEntry eachEntry : pickListEntries) { selectOptions.add(new SelectOption(eachEntry.getLabel(), eachEntry.getValue())); } return selectOptions; } }
- Ravi Prabhu
- July 07, 2020
- Like
- 0
SOQL not executing in Apex custom controller
Hi,
I have a VF page which contains 1 page block. There are 2 fields in page block one is date and another is name. When user select the date and name and click on button, the page has to display records from custom object.
The value of date and name is passed to controller and SOQL query
need to fetch the data from customobject
The name field is a dropdown, dropdown values are fetched from picklist values of name field which is working fine.
The issue here is when i click the button nothing is happening. the debug log shows that SOQL query is not running.
Also after display of records on page user need to select the records and should be able to delete. Please help with this code as well.
I have a VF page which contains 1 page block. There are 2 fields in page block one is date and another is name. When user select the date and name and click on button, the page has to display records from custom object.
The value of date and name is passed to controller and SOQL query
need to fetch the data from customobject
The name field is a dropdown, dropdown values are fetched from picklist values of name field which is working fine.
The issue here is when i click the button nothing is happening. the debug log shows that SOQL query is not running.
Also after display of records on page user need to select the records and should be able to delete. Please help with this code as well.
Visualforce page <apex:page id="pageID" Controller="TestPageBlock2Cont" showHeader="false" tabStyle="Ticket_Effort_Category__c" > <script> document.title = "AMS Reporting"; </script> <script> <!--validate input fields in summary section--> <script> function validatechk(){ var chk2 = document.getElementById("{!$Component.pageId.formId.pgblock2.pgblocksection2.selectedlist}").value; if(chk2 == ' '){ alert("Please select the name") } } </script> <style type="text/css"> .activeTab {background-color: #236FBf; color:white; background-image:none} .inactiveTab { background-color: white; color:black; background-image:none} body{background-color: #F8F8FF;} .bPageBlock {background-color: #778899 ;} .bAlign {text-align:center;} </style> <apex:panelGrid columns="2" width="100%"> <apex:panelGrid columns="1" width="100%"> <img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/> </apex:panelGrid> <apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue;" value="AMS Reporting" /> </apex:panelGrid> <apex:form id="formId" styleClass="myFormStyle" > <apex:actionRegion > <!--Summary section --> <apex:pageBlock id="pgblock2" title="Summary" > <apex:pageBlockSection id="pgblocksection2" > <apex:OutputPanel > <apex:panelGrid columns="5"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Date </apex:outputLabel> <apex:inputField value="{!sumtktRecord.Date__c}" ></apex:inputField> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Select Assigned Person </apex:outputLabel> <apex:selectList id="selectedlist" value="{!sumtktRecord.responsible__c}" size="1" multiselect="false" style="margin-right:10px;" > <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <apex:commandButton action="{!getsummarylist}" value="Go" immediate="true" onclick="validatechk();" rerender="msgsS" > </apex:commandButton> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <!--Summary--> <apex:pageBlockTable value="{!fetchlist}" var="I" id="msgsS" > <apex:column headervalue="Date" > <apex:outputField value="{!I.Date__c}"/> </apex:column> <apex:column headervalue="Ticket Number"> <apex:outputField value="{!I.Ticket_Number__c}"/> </apex:column> <apex:column headervalue="Division" > <apex:outputField value="{!I.Division__c}"/> </apex:column> <apex:column headervalue="Application" > <apex:outputField value="{!I.Application__c}"/> </apex:column> <apex:column headervalue="Responsible" > <apex:outputField value="{!I.Responsible__c}"/> </apex:column> <apex:column headervalue="Effort" > <apex:outputField value="{!I.Effort__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:actionRegion> </apex:form> </apex:page> Apex controller public class TestPageBlock2Cont { public list<Ticket_Effort_Category__c> fetchList{get;set;} public list<Ticket_Effort_Category__c> userList{get;set;} public Ticket_Effort_Category__c sumtktRecord{set;get;} public String selecteduserId {get;set;} public Date selectedDate {get;set;} List<SelectOption> selectOptions{get;set;} public TestPageBlock2Cont() { fetchList = new list<Ticket_Effort_Category__c>(); sumtktRecord = new Ticket_Effort_Category__c(); selecteduserId = sumtktRecord.Responsible__c; selectedDate = sumtktRecord.Date__c; } public void getsummarylist(){ fetchList = [select id, Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selecteduserId and Date__c = :selectedDate]; } public List<SelectOption> getListOfUser(){ selectOptions = new List<SelectOption>(); selectOptions.add(new SelectOption( ' ' ,'---Select---')); Schema.DescribeFieldResult describeResult = Ticket_Effort_Category__c.Responsible__c.getDescribe(); List<Schema.PicklistEntry> pickListEntries = describeResult.getPicklistValues(); for( Schema.PicklistEntry eachEntry : pickListEntries) { selectOptions.add(new SelectOption(eachEntry.getLabel(), eachEntry.getValue())); } return selectOptions; } }
- Ravi Prabhu
- July 04, 2020
- Like
- 0
Visualforce InputText and Date value not passing to controller
Hi,
This looks simple but not able to find the issue.
I have 2 pageblocks in a visualforce page. The 1st page block is for data entry contains date and name columns. The user will input the date and name which will insert in the object. This is working fine.
The 2nd page block is for selecting the date and name (dropdown). Based on the selection of 2 fields display the records in the table.
The problem is when I select the date (from date picker - JS code) and name, the page does not do anything. Also by looking at debug log it shows the SOQL query is returning SQL 100 i.e. no rows for the selected values.
The requirement in 2nd page block
-- display the records
-- once displayed, the user should be able to select the records -- delete the selected records
Please help.
This looks simple but not able to find the issue.
I have 2 pageblocks in a visualforce page. The 1st page block is for data entry contains date and name columns. The user will input the date and name which will insert in the object. This is working fine.
The 2nd page block is for selecting the date and name (dropdown). Based on the selection of 2 fields display the records in the table.
The problem is when I select the date (from date picker - JS code) and name, the page does not do anything. Also by looking at debug log it shows the SOQL query is returning SQL 100 i.e. no rows for the selected values.
The requirement in 2nd page block
-- display the records
-- once displayed, the user should be able to select the records -- delete the selected records
Please help.
//used for data entry for 1st pageblock public Ticket_Effort_Category__c tktRecord{set;get;} //date selected from 2nd pageblock public Date selectedDate {get;set;} //need to send the records to display in visualforce in 2nd pageblock public list<Ticket_Effort_Category__c> fetchList{get;set;} //gives list of users in drop down in 2nd page block public list<Ticket_Effort_Category__c> userList{get;set;} List<SelectOption> selectOptions{get;set;} public void getsummarylist(){ fetchList = [select id, Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selecteduserId and Date__c = :selectedDate]; <apex:actionRegion > <!--Summary section --> <apex:pageBlock id="pgblock2" title="Summary" > <apex:pageBlockSection id="pgblocksection2" > <apex:OutputPanel > <apex:panelGrid columns="5"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Date </apex:outputLabel> <apex:inputText id="Date" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;" /> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Select Assigned Person </apex:outputLabel> <apex:selectList id="selectedlist" value="{!selecteduserId}" size="1" multiselect="false" style="margin-right:10px;" > <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <apex:commandButton action = "{!getsummarylist}" value="Go" immediate="true" onclick="validatechk();" rerender="msgsS" /> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <!--Summary--> <apex:pageBlockTable value="{!fetchlist}" var="I" id="msgsS" > <apex:column headervalue="Date" > <apex:outputField value="{!I.Date__c}"/> </apex:column> <apex:column headervalue="Ticket Number"> <apex:outputField value="{!I.Ticket_Number__c}"/> </apex:column> <apex:column headervalue="Division" > <apex:outputField value="{!I.Division__c}"/> </apex:column> <apex:column headervalue="Application" > <apex:outputField value="{!I.Application__c}"/> </apex:column> <apex:column headervalue="Responsible" > <apex:outputField value="{!I.Responsible__c}"/> </apex:column> <apex:column headervalue="Effort" > <apex:outputField value="{!I.Effort__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:actionRegion>
- Ravi Prabhu
- July 04, 2020
- Like
- 0
Having issues with VF page having 2 page blocks
I have a VF page which contains 2 page blocks. One page block will insert the record in custom object. The 2nd page block conatins 2 fields (date and dropdown) after selecting the fields and click of button the records should show in page block.
All the fileds on the 1st page block are mandatory. The 1st page block works fine with no issues
.
But when I click 'Go' button on 2nd page block an error shows up on the field of 1st page block.
I have used <actionRegion> as well in 2nd page block but still not working. Please help
Screesnhots are below:
All the fileds on the 1st page block are mandatory. The 1st page block works fine with no issues
.
But when I click 'Go' button on 2nd page block an error shows up on the field of 1st page block.
I have used <actionRegion> as well in 2nd page block but still not working. Please help
Screesnhots are below:
Visualforce page <apex:page Controller="AllTicketReporting" showHeader="false" tabStyle="Ticket_Effort_Category__c" docType="html-5.0"> <script> document.title = "XYZ Reporting"; </script> <script> function DynamicDatePicker(d_id) { DatePicker.pickDate(false,d_id.id,false); } </script> <style type="text/css"> .activeTab {background-color: #236FBf; color:white; background-image:none} .inactiveTab { background-color: white; color:black; background-image:none} body{background-color: #F8F8FF;} .bPageBlock {background-color: #778899 ;} .bAlign {text-align:center;} </style> <apex:panelGrid columns="2" width="100%"> <apex:panelGrid columns="1" width="100%"> <img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/> </apex:panelGrid> <apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue;" value="XYZ Reporting" /> </apex:panelGrid> <apex:form styleClass="myFormStyle" > <!-- Incident reporting --> <apex:pageBlock title="Incident / Problem Reporting" tabStyle="Ticket_Effort_Category__c" > <apex:pageBlockTable value="{!tktRecord}" title="Incident Reporting" var="Incident" id="msgsI" > <apex:column headerValue="Date"> <apex:inputField value="{!Incident.Date__c}" required="true"/> </apex:column> <apex:column headerValue="Divsion"> <apex:inputField value="{!Incident.Division__c}" required="true"/> </apex:column> <apex:column headerValue="Application"> <apex:inputField value="{!Incident.Application__c}" required="true"/> </apex:column> <apex:column headerValue="Ticket Number"> <apex:inputField value="{!Incident.Ticket_Number__c}" required="true"/> </apex:column> <apex:column headerValue="Technology"> <apex:inputField value="{!Incident.Technology__c}" required="true"/> </apex:column> <apex:column headerValue="Responsible"> <apex:inputField value="{!Incident.Responsible__c}" required="true" /> </apex:column> <apex:column headerValue="Phase"> <apex:inputField value="{!Incident.Phase__c}" required="true"/> </apex:column> <apex:column headerValue="Effort"> <apex:inputField value="{!Incident.Effort__c}" required="true"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockButtons location="bottom" style="float:centre"> <apex:commandButton value="Save" action="{!saveTicketData}" reRender="msgsI" style="margin-right:20px;"/> <!--apex:commandButton value="Save"> <apex:actionSupport action="{!saveTicketData}" event="onchange" rerender="msgsI" /> </apex:commandButton--> <apex:commandButton value="Cancel" action="{!cancelTicketData}" reRender="msgsI" style="margin-right:30px;" /> <!--apex:commandButton value="Cancel"> <apex:actionSupport action="{!cancelTicketData}" event="onchange" rerender="msgsI" /> </apex:commandButton--> <apex:outputLink value="https://curious-impala-lyabo0-dev-ed--c.visualforce.com/apex/ExcepReportDownload?core.apexpages.request.devconsole=1" id="theLink" style="margin-right:600px;">Export</apex:outputLink> </apex:pageBlockButtons> </apex:pageBlock> <apex:actionRegion > <!--Summary section --> <apex:pageBlock title="Summary" id="msgsS" tabStyle="Ticket_Effort_Category__c" > <apex:pageBlockSection > <apex:OutputPanel > <apex:panelGrid columns="5"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;"> Date </apex:outputLabel> <apex:inputText id="time" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;"/> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;"> Select Assigned Person </apex:outputLabel> <apex:selectList value="{!selecteduserId}" size="1" multiselect="false" style="margin-right:10px;" > <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <!--apex:commandButton value="Go" action="{!showPB}" reRender="msgsS" /--> <apex:commandButton value="Go"> <apex:actionSupport action="{!showPB}" event="onchange" rerender="msgsS" /> </apex:commandButton> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <!--Summary--> <apex:pageBlockTable value="{!fetchlist}" var="I" > <apex:column headervalue="Date" value="{!I.Date__c}"/> <apex:column headervalue="Date" value="{!I.Ticket_Number__c}"/> <apex:column headervalue="Division" value="{!I.Division__c}"/> <apex:column headervalue="Application" value="{!I.Application__c}"/> <apex:column headervalue="Responsible" value="{!I.Responsible__c}"/> <apex:column headervalue="Effort" value="{!I.Effort__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:actionRegion> </apex:form> </apex:page> Apex controller: public class AllTicketReporting { public Ticket_Effort_Category__c tktRecord{set;get;} public list<Ticket_Effort_Category__c> fetchList{get;set;} public list<Ticket_Effort_Category__c> userList{get;set;} public String selecteduserId {set;get;} public Date selectedDate {set;get;} public boolean PBFlag{set;get;} public AllTicketReporting() { tktRecord = new Ticket_Effort_Category__c(); selecteduserId =''; } public Pagereference saveTicketData(){ List<Ticket_Effort_Category__c> ticketExist = new List<Ticket_Effort_Category__c> (); ticketExist = [select id from Ticket_Effort_Category__c where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ; try{ // if(!ticketExist.isEmpty()){ // tktRecord.id = ticketExist[0].id; // upsert tktRecord; // // }else{ insert tktRecord; // } PageReference pr = new PageReference('/apex/TicketReporting?core.apexpages.request.devconsole=1'); pr.setRedirect(true); return pr; } catch(Exception e){ String error = e.getMessage(); ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error)); return null; } } public Pagereference cancelTicketData() { tktRecord = new Ticket_Effort_Category__c(); return null; } public list<Ticket_Effort_Category__c> summarylist(){ fetchList = new list<Ticket_Effort_Category__c>(); if(string.isNotEmpty(selecteduserId) || (system.today() < selectedDate)){ fetchList = [select Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selecteduserId and Date__c = :selectedDate]; PBFlag = false; return fetchlist; }else { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please enter Account phone')); return null; } } public void showPB(){ PBFlag=true; } public List<SelectOption> getListOfUser(){ List<SelectOption> selectOptions = new List<SelectOption>(); selectOptions.add(new SelectOption( ' ' ,'---Select---')); Schema.DescribeFieldResult describeResult = Ticket_Effort_Category__c.Responsible__c.getDescribe(); List<Schema.PicklistEntry> pickListEntries = describeResult.getPicklistValues(); for( Schema.PicklistEntry eachEntry : pickListEntries) { selectOptions.add(new SelectOption(eachEntry.getLabel(), eachEntry.getValue())); } return selectOptions; } }
- Ravi Prabhu
- July 03, 2020
- Like
- 0
The date filed does not show up on VF page
The date field does not show on VF page when the page is accessed from setup -- > sites -- > click on site url
where as
the closed date shows up correctly on VF page when we do preview from developer console. How to fix this and why the difference ?
where as
the closed date shows up correctly on VF page when we do preview from developer console. How to fix this and why the difference ?
- Ravi Prabhu
- July 02, 2020
- Like
- 0
I want to create records for 2 unrelated custom object using 2 save buttons in a single VF page
I have 2 unrelated custom objects. I need to save (insert/upsert) records seperatly with 2 save buttons in 2 custom objects. I have written below controller and VF page but when I click on 'save' button nothing happens even the debug log doesnt show any errors. The save button is not performing any function.
Please help and thanks in advance!!
Apex controller:
public class ValidateFields {
List<Ticket_Effort_Category__c> ticketExist{set;get;}
List<problem_ticket__c> ticketExistp{set;get;}
public Ticket_Effort_Category__c tktRecord{set;get;}
public Problem_Ticket__c prbRecord{set;get;}
public ValidateFields() {
tktRecord = new Ticket_Effort_Category__c();
prbRecord = new Problem_Ticket__c();
}
public Pagereference saveTicketData(){
try{
ticketExist = [select id from Ticket_Effort_Category__c
where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ;
if(!ticketExist.isEmpty()){
tktRecord.id = ticketExist[0].id;
upsert tktRecord;
}else{
insert tktRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelTicketData() {
tktRecord = new Ticket_Effort_Category__c();
return null;
}
public Pagereference saveproblemTicket(){
try{
ticketExistp = [select id from problem_ticket__c
where problem_Ticket__C = :prbRecord.problem_ticket__c ] ;
if(!ticketExistp.isEmpty()){
prbRecord.id = ticketExistp[0].id;
upsert prbRecord;
}else{
insert prbRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelprbTicketData() {
prbRecord = new Problem_Ticket__c();
return null;
}
}
VF page:
<apex:page Controller="ValidateFields" showHeader="false" tabStyle="Ticket_Effort_Category__c" extensions="ValidateFields">
<script>
document.title = "XYZ Reporting";
</script>
<style type="text/css">
.activeTab {background-color: #236FBf; color:white; background-image:none}
.inactiveTab { background-color: white; color:black; background-image:none}
body{background-color: #F8F8FF;}
.bPageBlock {background-color: #778899 ;}
.bAlign {text-align:center;}
</style>
<apex:panelGrid columns="2" width="100%">
<apex:panelGrid columns="1" width="100%">
<img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/>
</apex:panelGrid>
<apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue"
value="AMS Reporting" />
</apex:panelGrid>
<apex:form styleClass="myFormStyle" >
<apex:pageBlock title="Incident Reporting" tabStyle="Ticket_Effort_Category__c" >
<apex:pageBlockTable value="{!tktRecord}" title="Incident Reporting" var="Incident" id="msgsI" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!Incident.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!Incident.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!Incident.Ticket_Number__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!Incident.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!Incident.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Category">
<apex:inputField value="{!Incident.Category__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!Incident.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveTicketData}" reRender="msgsI" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelTicketData}" reRender="msgsI" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Problem Ticket Reporting" tabStyle="Problem_Ticket__c" >
<apex:pageBlockTable value="{!prbRecord}" title="Problem Ticket Reporting" var="problem" id="msgsP" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!problem.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!problem.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!problem.Problem_Ticket__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!problem.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!problem.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Closed Date">
<apex:inputField value="{!problem.Completed_Date__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!problem.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveproblemTicket}" reRender="msgsP" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelprbTicketData}" reRender="msgsP" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Please help and thanks in advance!!
Apex controller:
public class ValidateFields {
List<Ticket_Effort_Category__c> ticketExist{set;get;}
List<problem_ticket__c> ticketExistp{set;get;}
public Ticket_Effort_Category__c tktRecord{set;get;}
public Problem_Ticket__c prbRecord{set;get;}
public ValidateFields() {
tktRecord = new Ticket_Effort_Category__c();
prbRecord = new Problem_Ticket__c();
}
public Pagereference saveTicketData(){
try{
ticketExist = [select id from Ticket_Effort_Category__c
where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ;
if(!ticketExist.isEmpty()){
tktRecord.id = ticketExist[0].id;
upsert tktRecord;
}else{
insert tktRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelTicketData() {
tktRecord = new Ticket_Effort_Category__c();
return null;
}
public Pagereference saveproblemTicket(){
try{
ticketExistp = [select id from problem_ticket__c
where problem_Ticket__C = :prbRecord.problem_ticket__c ] ;
if(!ticketExistp.isEmpty()){
prbRecord.id = ticketExistp[0].id;
upsert prbRecord;
}else{
insert prbRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelprbTicketData() {
prbRecord = new Problem_Ticket__c();
return null;
}
}
VF page:
<apex:page Controller="ValidateFields" showHeader="false" tabStyle="Ticket_Effort_Category__c" extensions="ValidateFields">
<script>
document.title = "XYZ Reporting";
</script>
<style type="text/css">
.activeTab {background-color: #236FBf; color:white; background-image:none}
.inactiveTab { background-color: white; color:black; background-image:none}
body{background-color: #F8F8FF;}
.bPageBlock {background-color: #778899 ;}
.bAlign {text-align:center;}
</style>
<apex:panelGrid columns="2" width="100%">
<apex:panelGrid columns="1" width="100%">
<img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/>
</apex:panelGrid>
<apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue"
value="AMS Reporting" />
</apex:panelGrid>
<apex:form styleClass="myFormStyle" >
<apex:pageBlock title="Incident Reporting" tabStyle="Ticket_Effort_Category__c" >
<apex:pageBlockTable value="{!tktRecord}" title="Incident Reporting" var="Incident" id="msgsI" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!Incident.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!Incident.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!Incident.Ticket_Number__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!Incident.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!Incident.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Category">
<apex:inputField value="{!Incident.Category__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!Incident.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveTicketData}" reRender="msgsI" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelTicketData}" reRender="msgsI" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Problem Ticket Reporting" tabStyle="Problem_Ticket__c" >
<apex:pageBlockTable value="{!prbRecord}" title="Problem Ticket Reporting" var="problem" id="msgsP" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!problem.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!problem.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!problem.Problem_Ticket__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!problem.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!problem.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Closed Date">
<apex:inputField value="{!problem.Completed_Date__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!problem.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveproblemTicket}" reRender="msgsP" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelprbTicketData}" reRender="msgsP" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
- Ravi Prabhu
- July 02, 2020
- Like
- 0
VF page in developer console preview and sites --> site url difference
Hi,
When I preview the VF page from developer console the report chart shows correctly on the page but when I acces on setup -- > sites --> site url (click) the VF page do not show the report chart on the page.
I have given the access for reports/dashboards as well. Not sure why it shows difference.
Please help me on this issue.
When I preview the VF page from developer console the report chart shows correctly on the page but when I acces on setup -- > sites --> site url (click) the VF page do not show the report chart on the page.
I have given the access for reports/dashboards as well. Not sure why it shows difference.
Please help me on this issue.
- Ravi Prabhu
- July 11, 2020
- Like
- 0
Check box value not passing to controller from visualforce page
Hi,
This looks to be simple but not able to find the issue.
I have a visualforce page with a pageblock. The page block displays 2 fields. One is date and other field is name from drop down. User should select these 2 fields and then click 'Go' button which will display the records. Later user can select the records and delete it (need to select multiple records using checkbox). The 'Go' button is working and display records but delete button is not working after selecting the records.
Please help.
This looks to be simple but not able to find the issue.
I have a visualforce page with a pageblock. The page block displays 2 fields. One is date and other field is name from drop down. User should select these 2 fields and then click 'Go' button which will display the records. Later user can select the records and delete it (need to select multiple records using checkbox). The 'Go' button is working and display records but delete button is not working after selecting the records.
Please help.
Visualforce page: <apex:form id="formId" styleClass="myFormStyle" > <apex:actionRegion > <apex:pageBlock id="pgblock2" title="Summary" > <apex:pageBlockSection id="pgblocksection2"> <apex:OutputPanel > <apex:panelGrid columns="7"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" >Date </apex:outputLabel> <apex:inputText id="Date" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;" /> <apex:param value="{!SelectedDate}" assignTo="{!selectedDate}" name="p1"/> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Select Assigned Person </apex:outputLabel> <apex:selectList id="selectedlist" value="{!selectedUserId}" size="1" multiselect="false" > <apex:param value="{!selectedUserId}" assignTo="{!selectedUserId}" name="p2"/> <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <apex:commandButton id="Go" action="{!getsummarylist}" value="Go" onclick="validatechk();" rerender="msgsS" /> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <apex:pageBlockButtons location="Bottom" > <apex:commandButton id="deleteit" value="Delete" action="{!delete_now}" reRender="msgsS"/> </apex:pageBlockButtons> <apex:outputPanel id="panelId"> <apex:pageBlockTable value="{!sub}" var="I" id="msgsS" > <apex:column headerValue="Select" > <apex:inputCheckbox value="{!I.checked}" /> <apex:param assignTo="{!I.checked}" value="{!I.checked}" /> </apex:column> <apex:column headervalue="Date" value="{!I.tkt.Date__c}"/> <apex:column headervalue="Ticket Number" value="{!I.tkt.Ticket_Number__c}"/> <apex:column headervalue="Division" value="{!I.tkt.Division__c}"/> <apex:column headervalue="Application" value="{!I.tkt.Application__c}"/> <apex:column headervalue="Responsible" value="{!I.tkt.Responsible__c}"/> <apex:column headervalue="Effort" value="{!I.tkt.Effort__c}"/> </apex:pageBlockTable> </apex:outputPanel> </apex:pageBlock> </apex:actionRegion> </apex:form> </apex:page> Apex controller public with sharing class TestPageBlock2Cont { public String selecteduserId {get;set;} public Date selectedDate {get;set;} List<SelectOption> selectOptions{get;set;} public List<Wrapperclass> sub {get;set;} public TestPageBlock2Cont() { tktRecord = new Ticket_Effort_Category__c(); lstwrapper = new list<wrapper>(); header = 'Date,Division\r\n'; } //after pressing 'Go' button, this method will be called public Pagereference getsummarylist(){ if(selectedDate == null){ system.debug('selectedDate 3 = ' +selectedDate); ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please enter date')); } else{ sub = new List<WrapperClass>(); list<ticket_effort_category__c> fetchList = new list<ticket_effort_category__c>(); fetchList = [select id, Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selectedUserId and Date__c = :selectedDate]; for(Ticket_Effort_Category__c cr : fetchlist){ sub.add(new wrapperClass (cr,false)); } } return null; } //wrapp the records and checkbox public class WrapperClass { public Ticket_effort_category__c tkt {get; set;} public Boolean checked {get; set;} public wrapperClass(Ticket_effort_category__c tkt, Boolean checked){ this.tkt=tkt; this.checked = checked; } } //delete the selected records public void delete_now(){ List<Ticket_Effort_Category__c> del = new list<Ticket_Effort_Category__c>(); for(WrapperClass cc: sub){ system.debug('tktid = ' +tktid); if(cc.checked == true){ del.add(cc.tkt); } } delete del; return null; } //show up the dropdown for user to select the name public List<SelectOption> getListOfUser(){ selectOptions = new List<SelectOption>(); selectOptions.add(new SelectOption( ' ' ,'---Select---')); Schema.DescribeFieldResult describeResult = Ticket_Effort_Category__c.Responsible__c.getDescribe(); List<Schema.PicklistEntry> pickListEntries = describeResult.getPicklistValues(); for( Schema.PicklistEntry eachEntry : pickListEntries) { selectOptions.add(new SelectOption(eachEntry.getLabel(), eachEntry.getValue())); } return selectOptions; } }
- Ravi Prabhu
- July 07, 2020
- Like
- 0
Visualforce InputText and Date value not passing to controller
Hi,
This looks simple but not able to find the issue.
I have 2 pageblocks in a visualforce page. The 1st page block is for data entry contains date and name columns. The user will input the date and name which will insert in the object. This is working fine.
The 2nd page block is for selecting the date and name (dropdown). Based on the selection of 2 fields display the records in the table.
The problem is when I select the date (from date picker - JS code) and name, the page does not do anything. Also by looking at debug log it shows the SOQL query is returning SQL 100 i.e. no rows for the selected values.
The requirement in 2nd page block
-- display the records
-- once displayed, the user should be able to select the records -- delete the selected records
Please help.
This looks simple but not able to find the issue.
I have 2 pageblocks in a visualforce page. The 1st page block is for data entry contains date and name columns. The user will input the date and name which will insert in the object. This is working fine.
The 2nd page block is for selecting the date and name (dropdown). Based on the selection of 2 fields display the records in the table.
The problem is when I select the date (from date picker - JS code) and name, the page does not do anything. Also by looking at debug log it shows the SOQL query is returning SQL 100 i.e. no rows for the selected values.
The requirement in 2nd page block
-- display the records
-- once displayed, the user should be able to select the records -- delete the selected records
Please help.
//used for data entry for 1st pageblock public Ticket_Effort_Category__c tktRecord{set;get;} //date selected from 2nd pageblock public Date selectedDate {get;set;} //need to send the records to display in visualforce in 2nd pageblock public list<Ticket_Effort_Category__c> fetchList{get;set;} //gives list of users in drop down in 2nd page block public list<Ticket_Effort_Category__c> userList{get;set;} List<SelectOption> selectOptions{get;set;} public void getsummarylist(){ fetchList = [select id, Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selecteduserId and Date__c = :selectedDate]; <apex:actionRegion > <!--Summary section --> <apex:pageBlock id="pgblock2" title="Summary" > <apex:pageBlockSection id="pgblocksection2" > <apex:OutputPanel > <apex:panelGrid columns="5"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Date </apex:outputLabel> <apex:inputText id="Date" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;" /> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;" > Select Assigned Person </apex:outputLabel> <apex:selectList id="selectedlist" value="{!selecteduserId}" size="1" multiselect="false" style="margin-right:10px;" > <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <apex:commandButton action = "{!getsummarylist}" value="Go" immediate="true" onclick="validatechk();" rerender="msgsS" /> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <!--Summary--> <apex:pageBlockTable value="{!fetchlist}" var="I" id="msgsS" > <apex:column headervalue="Date" > <apex:outputField value="{!I.Date__c}"/> </apex:column> <apex:column headervalue="Ticket Number"> <apex:outputField value="{!I.Ticket_Number__c}"/> </apex:column> <apex:column headervalue="Division" > <apex:outputField value="{!I.Division__c}"/> </apex:column> <apex:column headervalue="Application" > <apex:outputField value="{!I.Application__c}"/> </apex:column> <apex:column headervalue="Responsible" > <apex:outputField value="{!I.Responsible__c}"/> </apex:column> <apex:column headervalue="Effort" > <apex:outputField value="{!I.Effort__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:actionRegion>
- Ravi Prabhu
- July 04, 2020
- Like
- 0
Having issues with VF page having 2 page blocks
I have a VF page which contains 2 page blocks. One page block will insert the record in custom object. The 2nd page block conatins 2 fields (date and dropdown) after selecting the fields and click of button the records should show in page block.
All the fileds on the 1st page block are mandatory. The 1st page block works fine with no issues
.
But when I click 'Go' button on 2nd page block an error shows up on the field of 1st page block.
I have used <actionRegion> as well in 2nd page block but still not working. Please help
Screesnhots are below:
All the fileds on the 1st page block are mandatory. The 1st page block works fine with no issues
.
But when I click 'Go' button on 2nd page block an error shows up on the field of 1st page block.
I have used <actionRegion> as well in 2nd page block but still not working. Please help
Screesnhots are below:
Visualforce page <apex:page Controller="AllTicketReporting" showHeader="false" tabStyle="Ticket_Effort_Category__c" docType="html-5.0"> <script> document.title = "XYZ Reporting"; </script> <script> function DynamicDatePicker(d_id) { DatePicker.pickDate(false,d_id.id,false); } </script> <style type="text/css"> .activeTab {background-color: #236FBf; color:white; background-image:none} .inactiveTab { background-color: white; color:black; background-image:none} body{background-color: #F8F8FF;} .bPageBlock {background-color: #778899 ;} .bAlign {text-align:center;} </style> <apex:panelGrid columns="2" width="100%"> <apex:panelGrid columns="1" width="100%"> <img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/> </apex:panelGrid> <apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue;" value="XYZ Reporting" /> </apex:panelGrid> <apex:form styleClass="myFormStyle" > <!-- Incident reporting --> <apex:pageBlock title="Incident / Problem Reporting" tabStyle="Ticket_Effort_Category__c" > <apex:pageBlockTable value="{!tktRecord}" title="Incident Reporting" var="Incident" id="msgsI" > <apex:column headerValue="Date"> <apex:inputField value="{!Incident.Date__c}" required="true"/> </apex:column> <apex:column headerValue="Divsion"> <apex:inputField value="{!Incident.Division__c}" required="true"/> </apex:column> <apex:column headerValue="Application"> <apex:inputField value="{!Incident.Application__c}" required="true"/> </apex:column> <apex:column headerValue="Ticket Number"> <apex:inputField value="{!Incident.Ticket_Number__c}" required="true"/> </apex:column> <apex:column headerValue="Technology"> <apex:inputField value="{!Incident.Technology__c}" required="true"/> </apex:column> <apex:column headerValue="Responsible"> <apex:inputField value="{!Incident.Responsible__c}" required="true" /> </apex:column> <apex:column headerValue="Phase"> <apex:inputField value="{!Incident.Phase__c}" required="true"/> </apex:column> <apex:column headerValue="Effort"> <apex:inputField value="{!Incident.Effort__c}" required="true"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockButtons location="bottom" style="float:centre"> <apex:commandButton value="Save" action="{!saveTicketData}" reRender="msgsI" style="margin-right:20px;"/> <!--apex:commandButton value="Save"> <apex:actionSupport action="{!saveTicketData}" event="onchange" rerender="msgsI" /> </apex:commandButton--> <apex:commandButton value="Cancel" action="{!cancelTicketData}" reRender="msgsI" style="margin-right:30px;" /> <!--apex:commandButton value="Cancel"> <apex:actionSupport action="{!cancelTicketData}" event="onchange" rerender="msgsI" /> </apex:commandButton--> <apex:outputLink value="https://curious-impala-lyabo0-dev-ed--c.visualforce.com/apex/ExcepReportDownload?core.apexpages.request.devconsole=1" id="theLink" style="margin-right:600px;">Export</apex:outputLink> </apex:pageBlockButtons> </apex:pageBlock> <apex:actionRegion > <!--Summary section --> <apex:pageBlock title="Summary" id="msgsS" tabStyle="Ticket_Effort_Category__c" > <apex:pageBlockSection > <apex:OutputPanel > <apex:panelGrid columns="5"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;"> Date </apex:outputLabel> <apex:inputText id="time" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;"/> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;"> Select Assigned Person </apex:outputLabel> <apex:selectList value="{!selecteduserId}" size="1" multiselect="false" style="margin-right:10px;" > <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <!--apex:commandButton value="Go" action="{!showPB}" reRender="msgsS" /--> <apex:commandButton value="Go"> <apex:actionSupport action="{!showPB}" event="onchange" rerender="msgsS" /> </apex:commandButton> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <!--Summary--> <apex:pageBlockTable value="{!fetchlist}" var="I" > <apex:column headervalue="Date" value="{!I.Date__c}"/> <apex:column headervalue="Date" value="{!I.Ticket_Number__c}"/> <apex:column headervalue="Division" value="{!I.Division__c}"/> <apex:column headervalue="Application" value="{!I.Application__c}"/> <apex:column headervalue="Responsible" value="{!I.Responsible__c}"/> <apex:column headervalue="Effort" value="{!I.Effort__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:actionRegion> </apex:form> </apex:page> Apex controller: public class AllTicketReporting { public Ticket_Effort_Category__c tktRecord{set;get;} public list<Ticket_Effort_Category__c> fetchList{get;set;} public list<Ticket_Effort_Category__c> userList{get;set;} public String selecteduserId {set;get;} public Date selectedDate {set;get;} public boolean PBFlag{set;get;} public AllTicketReporting() { tktRecord = new Ticket_Effort_Category__c(); selecteduserId =''; } public Pagereference saveTicketData(){ List<Ticket_Effort_Category__c> ticketExist = new List<Ticket_Effort_Category__c> (); ticketExist = [select id from Ticket_Effort_Category__c where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ; try{ // if(!ticketExist.isEmpty()){ // tktRecord.id = ticketExist[0].id; // upsert tktRecord; // // }else{ insert tktRecord; // } PageReference pr = new PageReference('/apex/TicketReporting?core.apexpages.request.devconsole=1'); pr.setRedirect(true); return pr; } catch(Exception e){ String error = e.getMessage(); ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error)); return null; } } public Pagereference cancelTicketData() { tktRecord = new Ticket_Effort_Category__c(); return null; } public list<Ticket_Effort_Category__c> summarylist(){ fetchList = new list<Ticket_Effort_Category__c>(); if(string.isNotEmpty(selecteduserId) || (system.today() < selectedDate)){ fetchList = [select Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selecteduserId and Date__c = :selectedDate]; PBFlag = false; return fetchlist; }else { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please enter Account phone')); return null; } } public void showPB(){ PBFlag=true; } public List<SelectOption> getListOfUser(){ List<SelectOption> selectOptions = new List<SelectOption>(); selectOptions.add(new SelectOption( ' ' ,'---Select---')); Schema.DescribeFieldResult describeResult = Ticket_Effort_Category__c.Responsible__c.getDescribe(); List<Schema.PicklistEntry> pickListEntries = describeResult.getPicklistValues(); for( Schema.PicklistEntry eachEntry : pickListEntries) { selectOptions.add(new SelectOption(eachEntry.getLabel(), eachEntry.getValue())); } return selectOptions; } }
- Ravi Prabhu
- July 03, 2020
- Like
- 0
The date filed does not show up on VF page
The date field does not show on VF page when the page is accessed from setup -- > sites -- > click on site url
where as
the closed date shows up correctly on VF page when we do preview from developer console. How to fix this and why the difference ?
where as
the closed date shows up correctly on VF page when we do preview from developer console. How to fix this and why the difference ?
- Ravi Prabhu
- July 02, 2020
- Like
- 0
I want to create records for 2 unrelated custom object using 2 save buttons in a single VF page
I have 2 unrelated custom objects. I need to save (insert/upsert) records seperatly with 2 save buttons in 2 custom objects. I have written below controller and VF page but when I click on 'save' button nothing happens even the debug log doesnt show any errors. The save button is not performing any function.
Please help and thanks in advance!!
Apex controller:
public class ValidateFields {
List<Ticket_Effort_Category__c> ticketExist{set;get;}
List<problem_ticket__c> ticketExistp{set;get;}
public Ticket_Effort_Category__c tktRecord{set;get;}
public Problem_Ticket__c prbRecord{set;get;}
public ValidateFields() {
tktRecord = new Ticket_Effort_Category__c();
prbRecord = new Problem_Ticket__c();
}
public Pagereference saveTicketData(){
try{
ticketExist = [select id from Ticket_Effort_Category__c
where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ;
if(!ticketExist.isEmpty()){
tktRecord.id = ticketExist[0].id;
upsert tktRecord;
}else{
insert tktRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelTicketData() {
tktRecord = new Ticket_Effort_Category__c();
return null;
}
public Pagereference saveproblemTicket(){
try{
ticketExistp = [select id from problem_ticket__c
where problem_Ticket__C = :prbRecord.problem_ticket__c ] ;
if(!ticketExistp.isEmpty()){
prbRecord.id = ticketExistp[0].id;
upsert prbRecord;
}else{
insert prbRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelprbTicketData() {
prbRecord = new Problem_Ticket__c();
return null;
}
}
VF page:
<apex:page Controller="ValidateFields" showHeader="false" tabStyle="Ticket_Effort_Category__c" extensions="ValidateFields">
<script>
document.title = "XYZ Reporting";
</script>
<style type="text/css">
.activeTab {background-color: #236FBf; color:white; background-image:none}
.inactiveTab { background-color: white; color:black; background-image:none}
body{background-color: #F8F8FF;}
.bPageBlock {background-color: #778899 ;}
.bAlign {text-align:center;}
</style>
<apex:panelGrid columns="2" width="100%">
<apex:panelGrid columns="1" width="100%">
<img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/>
</apex:panelGrid>
<apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue"
value="AMS Reporting" />
</apex:panelGrid>
<apex:form styleClass="myFormStyle" >
<apex:pageBlock title="Incident Reporting" tabStyle="Ticket_Effort_Category__c" >
<apex:pageBlockTable value="{!tktRecord}" title="Incident Reporting" var="Incident" id="msgsI" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!Incident.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!Incident.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!Incident.Ticket_Number__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!Incident.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!Incident.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Category">
<apex:inputField value="{!Incident.Category__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!Incident.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveTicketData}" reRender="msgsI" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelTicketData}" reRender="msgsI" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Problem Ticket Reporting" tabStyle="Problem_Ticket__c" >
<apex:pageBlockTable value="{!prbRecord}" title="Problem Ticket Reporting" var="problem" id="msgsP" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!problem.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!problem.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!problem.Problem_Ticket__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!problem.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!problem.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Closed Date">
<apex:inputField value="{!problem.Completed_Date__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!problem.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveproblemTicket}" reRender="msgsP" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelprbTicketData}" reRender="msgsP" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Please help and thanks in advance!!
Apex controller:
public class ValidateFields {
List<Ticket_Effort_Category__c> ticketExist{set;get;}
List<problem_ticket__c> ticketExistp{set;get;}
public Ticket_Effort_Category__c tktRecord{set;get;}
public Problem_Ticket__c prbRecord{set;get;}
public ValidateFields() {
tktRecord = new Ticket_Effort_Category__c();
prbRecord = new Problem_Ticket__c();
}
public Pagereference saveTicketData(){
try{
ticketExist = [select id from Ticket_Effort_Category__c
where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ;
if(!ticketExist.isEmpty()){
tktRecord.id = ticketExist[0].id;
upsert tktRecord;
}else{
insert tktRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelTicketData() {
tktRecord = new Ticket_Effort_Category__c();
return null;
}
public Pagereference saveproblemTicket(){
try{
ticketExistp = [select id from problem_ticket__c
where problem_Ticket__C = :prbRecord.problem_ticket__c ] ;
if(!ticketExistp.isEmpty()){
prbRecord.id = ticketExistp[0].id;
upsert prbRecord;
}else{
insert prbRecord;
}
PageReference pr = new PageReference('/apex/ticketdataCapature?core.apexpages.request.devconsole=1');
pr.setRedirect(true);
return pr;
}
catch(Exception e){
String error = e.getMessage();
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error));
return null;
}
}
public Pagereference cancelprbTicketData() {
prbRecord = new Problem_Ticket__c();
return null;
}
}
VF page:
<apex:page Controller="ValidateFields" showHeader="false" tabStyle="Ticket_Effort_Category__c" extensions="ValidateFields">
<script>
document.title = "XYZ Reporting";
</script>
<style type="text/css">
.activeTab {background-color: #236FBf; color:white; background-image:none}
.inactiveTab { background-color: white; color:black; background-image:none}
body{background-color: #F8F8FF;}
.bPageBlock {background-color: #778899 ;}
.bAlign {text-align:center;}
</style>
<apex:panelGrid columns="2" width="100%">
<apex:panelGrid columns="1" width="100%">
<img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/>
</apex:panelGrid>
<apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue"
value="AMS Reporting" />
</apex:panelGrid>
<apex:form styleClass="myFormStyle" >
<apex:pageBlock title="Incident Reporting" tabStyle="Ticket_Effort_Category__c" >
<apex:pageBlockTable value="{!tktRecord}" title="Incident Reporting" var="Incident" id="msgsI" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!Incident.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!Incident.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!Incident.Ticket_Number__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!Incident.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!Incident.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Category">
<apex:inputField value="{!Incident.Category__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!Incident.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveTicketData}" reRender="msgsI" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelTicketData}" reRender="msgsI" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Problem Ticket Reporting" tabStyle="Problem_Ticket__c" >
<apex:pageBlockTable value="{!prbRecord}" title="Problem Ticket Reporting" var="problem" id="msgsP" style="float:centre">
<apex:column headerValue="Divsion">
<apex:inputField value="{!problem.Division__c}"/>
</apex:column>
<apex:column headerValue="Application">
<apex:inputField value="{!problem.Application__c}"/>
</apex:column>
<apex:column headerValue="Ticket Number">
<apex:inputField value="{!problem.Problem_Ticket__c}"/>
</apex:column>
<apex:column headerValue="Technology">
<apex:inputField value="{!problem.Technology__c}"/>
</apex:column>
<apex:column headerValue="Responsible">
<apex:inputField value="{!problem.Responsible__c}"/>
</apex:column>
<apex:column headerValue="Closed Date">
<apex:inputField value="{!problem.Completed_Date__c}"/>
</apex:column>
<apex:column headerValue="Effort">
<apex:inputField value="{!problem.Effort__c}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="bottom" style="float:centre">
<apex:commandButton value="Save" action="{!saveproblemTicket}" reRender="msgsP" onclick = "Record Saved"/>
<apex:commandButton value="Cancel" action="{!cancelprbTicketData}" reRender="msgsP" onclick="Cancelled" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
- Ravi Prabhu
- July 02, 2020
- Like
- 0
how to properly format table in VisualForce
Hi Guru's,
Can you please suggest me in bringing up this below table in proper format.
<apex:page controller="TestForValues">
<apex:form >
<apex:pageBlock title="Core Categories">
<div styleClass="labelCol vfLabelColTextWrap">
<table border="1px" width="100%" height="80%" style="page-break-inside:auto;">
<tr>
<th>Core Categories</th>
<th>Guideline</th>
<th>Monday</th>
<th>Tueday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
</tr>
<tr>
<th>Pre-Vet Reviews</th>
<th>180 Mins</th>
<td><apex:inputText value="{!preVetReviews}"/></td>
<td><apex:inputText value="{!preVetReviews_Tue}"/></td>
<td><apex:inputText value="{!preVetReviews_Wed}"/></td>
<td><apex:inputText value="{!preVetReviews_Thur}"/></td>
<td><apex:inputText value="{!preVetReviews_Fri}"/></td>
</tr>
<tr>
<th>Pre-Vet Reviews</th>
<th>180 Mins</th>
<apex:outputText value="{!preVetReviews}"/>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
</tr>
</table>
</div>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!saveDetails}"/>
<apex:commandButton value="Save All" action="{!saveAllDetails}"/>
<apex:commandButton value="Submit" action="{!submitDetails}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
I need the table to be properly aligned, like all the inputText aligned to coloumns.
Can you please suggest me in bringing up this below table in proper format.
<apex:page controller="TestForValues">
<apex:form >
<apex:pageBlock title="Core Categories">
<div styleClass="labelCol vfLabelColTextWrap">
<table border="1px" width="100%" height="80%" style="page-break-inside:auto;">
<tr>
<th>Core Categories</th>
<th>Guideline</th>
<th>Monday</th>
<th>Tueday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
</tr>
<tr>
<th>Pre-Vet Reviews</th>
<th>180 Mins</th>
<td><apex:inputText value="{!preVetReviews}"/></td>
<td><apex:inputText value="{!preVetReviews_Tue}"/></td>
<td><apex:inputText value="{!preVetReviews_Wed}"/></td>
<td><apex:inputText value="{!preVetReviews_Thur}"/></td>
<td><apex:inputText value="{!preVetReviews_Fri}"/></td>
</tr>
<tr>
<th>Pre-Vet Reviews</th>
<th>180 Mins</th>
<apex:outputText value="{!preVetReviews}"/>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
<td><apex:inputText /></td>
</tr>
</table>
</div>
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!saveDetails}"/>
<apex:commandButton value="Save All" action="{!saveAllDetails}"/>
<apex:commandButton value="Submit" action="{!submitDetails}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
I need the table to be properly aligned, like all the inputText aligned to coloumns.
- karthic sankar 9
- June 26, 2020
- Like
- 0
I need to skip all the validations on save command button but html-novalidate="true" html-novalidate=”novalidate” at form level or button level does not work. Also, immediate="true" at command button level is not working.
Hi, sorry if this is a stupid/repetitive question, but I am unable to find appropriate solution for this.
I need to skip all the validations on save command button but
html-novalidate="true"
html-novalidate=”novalidate” at form level or button level does not work.
Also, immediate="true" at command button level is not working.
I also referred to - Nothing works :(
https://wdcigroup.net/salesforce-visualforce-commandbutton-to-bypass-validationrequired-fields/
https://www.biswajeetsamal.com/blog/immediate-true-is-not-working-on-custom-buttons-with-html5-doctype-in-visualforce-page/
<apex:page standardController="opportunityLineItem" extensions="opportunityassetcontroller" id="page1" tabstyle="opportunitylineitem" sidebar="TRUE" lightningStylesheets="true" docType="html-5.0">
<apex:slds />
<body class = "slds-scope">
<apex:form html-novalidate="novalidate" >
<apex:pageMessages />
<apex:pageBlock id="block0" rendered="{!if(NoSubstituteOLIAvail,true,false)}">
<div align="center" draggable="false">
<apex:commandButton value="Close" styleclass="slds-button slds-button--brand" action="{!Close}" immediate="true"/>
</div>
</apex:pageBlock>
<apex:pageBlock id="block1" title="Details" rendered="{!if(NoSubstituteOLIAvail,false,true)}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Close" styleclass="slds-button slds-button--brand" action="{!Close}" />
<apex:commandButton value="Search" styleclass="slds-button slds-button--brand" action="{!getOliDetails}" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" id="sec1" title="Opportunity Information" collapsible="false">
<apex:inputField value="{!newopptyLineItem.opportunityid}" />
</apex:pageBlockSection>
</apex:pageBlock>
<br/>
<br/>
<apex:pageBlock id="block2" title="Opportunity Product Details" rendered="{!getolidetails}" >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" styleclass="slds-button slds-button--brand" action="{!doSave}" />
<apex:commandButton value="Cancel" styleclass="slds-button slds-button--brand" action="{!Close}" immediate="true"/>
</apex:pageBlockButtons>
<apex:pageblockTable value="{!wrapperSelectedOli}" var="wrap" rendered="{!getolidetails}" id="alloli" >
<apex:variable value="{!0}" var="cnt"/>
<apex:column headerValue="Select">
<apex:outputPanel rendered="{!wrap.isSelected}">
<input type="radio" checked="true"/>
</apex:outputPanel>
<apex:outputPanel rendered="{!NOT(wrap.isSelected)}" >
<apex:actionSupport action="{!selectOli}" event="onclick" reRender="alloli" >
<input type ="radio"/>
<apex:param name="index" value="{!cnt}"/>
<apex:param name="olid" value="{!wrap.Oliselect.id}"/>
</apex:actionSupport>
</apex:outputPanel>
<apex:variable var="cnt" value="{!cnt+1}"/>
</apex:column>
<apex:column value="{!wrap.Oliselect.name}"/>
<apex:column value="{!wrap.Oliselect.Ready_For_Service_Date__c}"/>
<apex:column value="{!wrap.Oliselect.End_Contract_Date__c}"/>
<apex:column value="{!wrap.Oliselect.UnitPrice}"/>
<apex:column value="{!wrap.Oliselect.Initial_Cost__c}"/>
<apex:column value="{!wrap.Oliselect.Opportunity.account.name}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</body>
</apex:page>
I need to skip all the validations on save command button but
html-novalidate="true"
html-novalidate=”novalidate” at form level or button level does not work.
Also, immediate="true" at command button level is not working.
I also referred to - Nothing works :(
https://wdcigroup.net/salesforce-visualforce-commandbutton-to-bypass-validationrequired-fields/
https://www.biswajeetsamal.com/blog/immediate-true-is-not-working-on-custom-buttons-with-html5-doctype-in-visualforce-page/
<apex:page standardController="opportunityLineItem" extensions="opportunityassetcontroller" id="page1" tabstyle="opportunitylineitem" sidebar="TRUE" lightningStylesheets="true" docType="html-5.0">
<apex:slds />
<body class = "slds-scope">
<apex:form html-novalidate="novalidate" >
<apex:pageMessages />
<apex:pageBlock id="block0" rendered="{!if(NoSubstituteOLIAvail,true,false)}">
<div align="center" draggable="false">
<apex:commandButton value="Close" styleclass="slds-button slds-button--brand" action="{!Close}" immediate="true"/>
</div>
</apex:pageBlock>
<apex:pageBlock id="block1" title="Details" rendered="{!if(NoSubstituteOLIAvail,false,true)}">
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Close" styleclass="slds-button slds-button--brand" action="{!Close}" />
<apex:commandButton value="Search" styleclass="slds-button slds-button--brand" action="{!getOliDetails}" />
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2" id="sec1" title="Opportunity Information" collapsible="false">
<apex:inputField value="{!newopptyLineItem.opportunityid}" />
</apex:pageBlockSection>
</apex:pageBlock>
<br/>
<br/>
<apex:pageBlock id="block2" title="Opportunity Product Details" rendered="{!getolidetails}" >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" styleclass="slds-button slds-button--brand" action="{!doSave}" />
<apex:commandButton value="Cancel" styleclass="slds-button slds-button--brand" action="{!Close}" immediate="true"/>
</apex:pageBlockButtons>
<apex:pageblockTable value="{!wrapperSelectedOli}" var="wrap" rendered="{!getolidetails}" id="alloli" >
<apex:variable value="{!0}" var="cnt"/>
<apex:column headerValue="Select">
<apex:outputPanel rendered="{!wrap.isSelected}">
<input type="radio" checked="true"/>
</apex:outputPanel>
<apex:outputPanel rendered="{!NOT(wrap.isSelected)}" >
<apex:actionSupport action="{!selectOli}" event="onclick" reRender="alloli" >
<input type ="radio"/>
<apex:param name="index" value="{!cnt}"/>
<apex:param name="olid" value="{!wrap.Oliselect.id}"/>
</apex:actionSupport>
</apex:outputPanel>
<apex:variable var="cnt" value="{!cnt+1}"/>
</apex:column>
<apex:column value="{!wrap.Oliselect.name}"/>
<apex:column value="{!wrap.Oliselect.Ready_For_Service_Date__c}"/>
<apex:column value="{!wrap.Oliselect.End_Contract_Date__c}"/>
<apex:column value="{!wrap.Oliselect.UnitPrice}"/>
<apex:column value="{!wrap.Oliselect.Initial_Cost__c}"/>
<apex:column value="{!wrap.Oliselect.Opportunity.account.name}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</body>
</apex:page>
- sweta singh 58
- April 07, 2020
- Like
- 0
Issue in passing date parameter to soql in controller class
Hi
i need help in a issue where i am not able to fetch records based on a date parameter passed to a soql query in a controller class for a VF page.
The issue is with the line 10 in the VF page code where it takes date as an input, and passes it to the controller class and used in the soql in line 14, which return no records even though its there. If i hardcode any date in the soql query as in line 15 then records are returned.
can anybody help me to correct this as i am not getting any error in the code written but it does not seems to work.
VF page
=================================================================
<apex:page sidebar="false" showHeader="false" standardController="Ticket_transaction__c" extensions="MovieController">
<apex:form >
<apex:sectionHeader title="Ticket Booking Page"/>
<apex:pageblock title="Movie Preference">
<apex:pageblockSection title="Movie Language Preference" collapsible="false">
<apex:inputField value="{!Ticket_transaction__c.Language_preference__c}"/>
</apex:pageblockSection>
<apex:pageblockSection title="Movie Date" collapsible="false">
<apex:inputfield value="{!Ticket_transaction__c.Movie_Date__c}" id="MovieDate"/>
<br/><br/>
<apex:commandButton value="Display Movies.." action="{!MovieList}"/>
<br/><br/>
<apex:pageBlockTable value="{!Mlist}" var="M">
<apex:column value="{!M.Movie__c}"/>
<apex:column value="{!M.Theater__c}"/>
<apex:column value="{!M.Show_TIme__c}"/>
<apex:column value="{!M.Movie_Language__c}"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
===========================================================================
Controller
============================================================================
public class MovieController {
public MovieController(ApexPages.StandardController controller) {
}
public list<Movie_at_Theater__c> Mlist{get;set;}
public string Language{get;set;}
public Date MovieDate{get;set;}
//public string query{get;set;}
public Ticket_transaction__c tc {get;set;}
public void MovieList()
{
if(Language==null)
{
Mlist=database.query('Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c from Movie_at_Theater__c where Movie_Date__c=:MovieDate');
//Mlist=database.query('Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c,Movie_Date__c from Movie_at_Theater__c where Movie_Date__c=2016-08-28' );
//query='Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c,Movie_Date__c from Movie_at_Theater__c';
}
else
{
list<Movie_at_Theater__c>Templist=database.query('Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c from Movie_at_Theater__c where Movie_Date__c='+MovieDate);
for( Movie_at_Theater__c Ml : Templist)
{
If(Language==Ml.Movie_Language__c)
{
Mlist.add(Ml);
}
Else{}
}
}
}
}
i need help in a issue where i am not able to fetch records based on a date parameter passed to a soql query in a controller class for a VF page.
The issue is with the line 10 in the VF page code where it takes date as an input, and passes it to the controller class and used in the soql in line 14, which return no records even though its there. If i hardcode any date in the soql query as in line 15 then records are returned.
can anybody help me to correct this as i am not getting any error in the code written but it does not seems to work.
VF page
=================================================================
<apex:page sidebar="false" showHeader="false" standardController="Ticket_transaction__c" extensions="MovieController">
<apex:form >
<apex:sectionHeader title="Ticket Booking Page"/>
<apex:pageblock title="Movie Preference">
<apex:pageblockSection title="Movie Language Preference" collapsible="false">
<apex:inputField value="{!Ticket_transaction__c.Language_preference__c}"/>
</apex:pageblockSection>
<apex:pageblockSection title="Movie Date" collapsible="false">
<apex:inputfield value="{!Ticket_transaction__c.Movie_Date__c}" id="MovieDate"/>
<br/><br/>
<apex:commandButton value="Display Movies.." action="{!MovieList}"/>
<br/><br/>
<apex:pageBlockTable value="{!Mlist}" var="M">
<apex:column value="{!M.Movie__c}"/>
<apex:column value="{!M.Theater__c}"/>
<apex:column value="{!M.Show_TIme__c}"/>
<apex:column value="{!M.Movie_Language__c}"/>
</apex:pageBlockTable>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>
===========================================================================
Controller
============================================================================
public class MovieController {
public MovieController(ApexPages.StandardController controller) {
}
public list<Movie_at_Theater__c> Mlist{get;set;}
public string Language{get;set;}
public Date MovieDate{get;set;}
//public string query{get;set;}
public Ticket_transaction__c tc {get;set;}
public void MovieList()
{
if(Language==null)
{
Mlist=database.query('Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c from Movie_at_Theater__c where Movie_Date__c=:MovieDate');
//Mlist=database.query('Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c,Movie_Date__c from Movie_at_Theater__c where Movie_Date__c=2016-08-28' );
//query='Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c,Movie_Date__c from Movie_at_Theater__c';
}
else
{
list<Movie_at_Theater__c>Templist=database.query('Select Movie__c, Theater__c, Show_TIme__c, Movie_Language__c from Movie_at_Theater__c where Movie_Date__c='+MovieDate);
for( Movie_at_Theater__c Ml : Templist)
{
If(Language==Ml.Movie_Language__c)
{
Mlist.add(Ml);
}
Else{}
}
}
}
}
- soumyodeep Guha 6
- August 28, 2016
- Like
- 0