-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
57Questions
-
49Replies
Account Validation Rule
Hello,
I want validation rule on account object. Its a professional edition. When lead converts into account I am checking Client__c field.
I want validation rule on account so that if that account is created by lead conversion and client is equal to true then account address is manadatory. I am getting validation error on lead conversion page rather than account page.
AND( ISBLANK(BillingAddress), NOT(ISNEW()), Client__c = TRUE)
I want validation rule on account object. Its a professional edition. When lead converts into account I am checking Client__c field.
I want validation rule on account so that if that account is created by lead conversion and client is equal to true then account address is manadatory. I am getting validation error on lead conversion page rather than account page.
AND( ISBLANK(BillingAddress), NOT(ISNEW()), Client__c = TRUE)
- satakshi
- April 18, 2018
- Like
- 0
Emaill View on Omni Channel
Hello,
We are using omni channel for case management. In sandbox, when case appear, email body is visible in omni channel. But in production Email body doesn't appear.
Is this part of omni channel setting?
Thanks,
Utkarsha
We are using omni channel for case management. In sandbox, when case appear, email body is visible in omni channel. But in production Email body doesn't appear.
Is this part of omni channel setting?
Thanks,
Utkarsha
- satakshi
- March 16, 2018
- Like
- 0
javascript to check whether checkbox are checked or not
Hello,
I am writing a code where if checkbox is checked then mail will send to desired user otherwise it will show an error "Please select checkbox". Can i get javascript for this?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table"">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
I am writing a code where if checkbox is checked then mail will send to desired user otherwise it will show an error "Please select checkbox". Can i get javascript for this?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table"">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
- satakshi
- December 07, 2016
- Like
- 0
Throw an error if checkbox is not checked in vf page
I want functionality where if checkbox is checked then only email will send to desired user otherwise it will throw an error "Please select atleast one contact". How it is possible?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" >
<apex:column colspan="2">
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/> </apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
- satakshi
- December 01, 2016
- Like
- 0
clear value in the lookup box after saving the question bank
Hello,
I want to clear this value after saving the record field. but when i want to newly add any question bank then prevoiusly added question bank number appears in the textbox. i have tried to relaod window page using window.location.relaod() in javascript but its not working.
- satakshi
- November 30, 2016
- Like
- 0
Soql query to check duplicate name
Hello,
I am wriring soql query where i want to check duplicate survey name.
If survey with name "Test" is already exist then survey with " Test Survey" name will save successfully. It will show error msg if we try to save using these names "T", "Te" , "Tes", "Test". I want to change my soql query (Like) so it will check for duplicate properly.
public class QuestionRepositorySave{
public Question_Repository__c ques;
public string qname{get;set;}
public string msg{get;set;}
public string description{get;set;}
public QuestionRepositorySave(ApexPages.StandardController controller){
ques = new Question_Repository__c();
}
public PageReference SaveAndRedirect(){
//List<Question_Repository__c> qList = [select id, name from Question_Repository__c where Repository_Name__c like:qname];
String query = 'select id, name from Question_Repository__c where Repository_Name__c like \'%' + qname+ '%\'';
System.debug('************************************+query+*****************************************************'+query);
List<Question_Repository__c> qList= Database.query(query);
System.debug('************************************+qList +*****************************************************'+qList);
if(qList.isEmpty())
{
ques.Repository_Name__c = qname;
ques.Description__c = description;
System.debug('************************************+BS+*****************************************************'+qname);
insert ques;
System.debug('**##################***********+aS+*************##############**********'+qname);
PageReference pr = new PageReference('/apex/SBDemoMainQB');
pr.setRedirect(true);
return pr;
}
else {
System.debug('**##################***********+aS+*************##############**********');
// msg ='This record is already exists';
// return null;
PageReference es= new PageReference('/apex/SurveyNamePage');
es.setRedirect(true);
return es;
}
return null;
}
public PageReference Cancel()
{
PageReference pr1 = new PageReference('/apex/SBQuestionBank');
pr1.setRedirect(true);
return pr1;
}
}
Thanks & Regards,
Satakshi
I am wriring soql query where i want to check duplicate survey name.
If survey with name "Test" is already exist then survey with " Test Survey" name will save successfully. It will show error msg if we try to save using these names "T", "Te" , "Tes", "Test". I want to change my soql query (Like) so it will check for duplicate properly.
public class QuestionRepositorySave{
public Question_Repository__c ques;
public string qname{get;set;}
public string msg{get;set;}
public string description{get;set;}
public QuestionRepositorySave(ApexPages.StandardController controller){
ques = new Question_Repository__c();
}
public PageReference SaveAndRedirect(){
//List<Question_Repository__c> qList = [select id, name from Question_Repository__c where Repository_Name__c like:qname];
String query = 'select id, name from Question_Repository__c where Repository_Name__c like \'%' + qname+ '%\'';
System.debug('************************************+query+*****************************************************'+query);
List<Question_Repository__c> qList= Database.query(query);
System.debug('************************************+qList +*****************************************************'+qList);
if(qList.isEmpty())
{
ques.Repository_Name__c = qname;
ques.Description__c = description;
System.debug('************************************+BS+*****************************************************'+qname);
insert ques;
System.debug('**##################***********+aS+*************##############**********'+qname);
PageReference pr = new PageReference('/apex/SBDemoMainQB');
pr.setRedirect(true);
return pr;
}
else {
System.debug('**##################***********+aS+*************##############**********');
// msg ='This record is already exists';
// return null;
PageReference es= new PageReference('/apex/SurveyNamePage');
es.setRedirect(true);
return es;
}
return null;
}
public PageReference Cancel()
{
PageReference pr1 = new PageReference('/apex/SBQuestionBank');
pr1.setRedirect(true);
return pr1;
}
}
Thanks & Regards,
Satakshi
- satakshi
- November 30, 2016
- Like
- 0
If no logo is uploaded while creating a survey, then how to add default image to the survey
Hello,
I am uploading the logo. but when logo is not selected i want to upload default image to the survey. How is it possible?
Apex:
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
insert d;
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
Vf:
<div class="formFeild"> <label>Upload Logo (5 MB Max. size)</label> <div class="feild"> <apex:inputfile value="{!file}" ></apex:inputfile> <!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> --> </div>
Thanks & Regards,
Satakshi
I am uploading the logo. but when logo is not selected i want to upload default image to the survey. How is it possible?
Apex:
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
insert d;
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
Vf:
<div class="formFeild"> <label>Upload Logo (5 MB Max. size)</label> <div class="feild"> <apex:inputfile value="{!file}" ></apex:inputfile> <!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> --> </div>
Thanks & Regards,
Satakshi
- satakshi
- November 28, 2016
- Like
- 0
Clear value on lookup field
hello i want to clear this value. it comes by default. i dont know how to clear this value. can you please help me to solve this?
- satakshi
- November 16, 2016
- Like
- 0
Back button is not working on visualforce page
Hello,
I am writing a code whre i want to come back on previous page. but in my case back button is not working. can anyone please help me?
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBAddQuestionPage' );
pr1.setRedirect(true);
return pr1;
}
<apex:commandButton value="Back" action="{!CancelAction}" styleClass="red-btn" style="margin-left: 113% !important; margin-top: -2% !important; font-weight: bold;"/>
Thanks & Regards,
Satakshi
I am writing a code whre i want to come back on previous page. but in my case back button is not working. can anyone please help me?
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBAddQuestionPage' );
pr1.setRedirect(true);
return pr1;
}
<apex:commandButton value="Back" action="{!CancelAction}" styleClass="red-btn" style="margin-left: 113% !important; margin-top: -2% !important; font-weight: bold;"/>
Thanks & Regards,
Satakshi
- satakshi
- November 16, 2016
- Like
- 0
Refresh page after picklist value is change
Hello,
I am writing code ehre i e=want to refresh page after picklist value is change. not when it is save. please help me to achieve this.
<apex:page controller="QBsampleCon" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<div class="formFeildreport formFeild">
<div class="feild formFeild">
<!--<h2 style="color:black; "> Question Type:</h2> class="questionlabel"-->
<label class="questionlabel" id="picvalchange">Question Type</label>
<apex:selectList value="{!pickval}" multiselect="false" size="1" id="PickVal" styleClass="Picklist" label="Question Type:" ><br />
<apex:actionSupport event="onchange" action="{!pickvalselect}" />
<apex:selectOptions value="{!SelectedOptions}"/>
</apex:selectList><br /><br />
</div>
Thanks & Regards,
Satakshi
I am writing code ehre i e=want to refresh page after picklist value is change. not when it is save. please help me to achieve this.
<apex:page controller="QBsampleCon" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<div class="formFeildreport formFeild">
<div class="feild formFeild">
<!--<h2 style="color:black; "> Question Type:</h2> class="questionlabel"-->
<label class="questionlabel" id="picvalchange">Question Type</label>
<apex:selectList value="{!pickval}" multiselect="false" size="1" id="PickVal" styleClass="Picklist" label="Question Type:" ><br />
<apex:actionSupport event="onchange" action="{!pickvalselect}" />
<apex:selectOptions value="{!SelectedOptions}"/>
</apex:selectList><br /><br />
</div>
Thanks & Regards,
Satakshi
- satakshi
- November 15, 2016
- Like
- 0
validation on contact while sending a mail
Hello,
I am writing a code where i want functionality where if contact are not selected then it will throw error otherwise it will proceed further. i tried a lot. but its not working..
My code is:
public with sharing class ContactSelectClassController
{
public String beforeblob1{get;set;}
//public String conid{get;set;}
public String emailEncoded { get; set; }
public String email { get; set; }
public String phoneEncoded { get; set; }
public String con_number { get; set; }
public String fullname{get;set;}
public String emailName{get;set;}
public String fullnameEncoded{get;set;}
@TestVisible public List<wrapAccount> wrapAccountList {get; set;}
//-----added----
public List<Contact> selectedAccounts{get;set;}
public String feedid;
private List<Id> contactids=new list<Id>();
public List<Contact> cont{get;set;}
public List<Feedback_Contacts__c> feedcon{get;set;}
// ---------for search-------
public List<wrapAccount> searchResults {get;set;}
public List<String> selectP = new List<String>();
//--------------searchText--------------
public string searchText {
get {
if (searchText == null) searchText = ''; // prefill the serach box for ease of use
return searchText;
}
set;
}
//--------------ContactSelectClassController()--------------
public ContactSelectClassController()
{
feedid= (ApexPages.currentPage().getParameters().get('fid'));
emailName= (ApexPages.currentPage().getParameters().get('emailName'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
emailEncoded = ApexPages.currentPage().getParameters().get('email');
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
//-------added--------
if(searchResults == null)
{
searchResults = new List<wrapAccount>(); // init the list if it is null
}
else
{
wrapAccountList.clear(); // clear out the current results if they exist
}
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
for(Contact c : Database.query(qry))
{
wrapAccount wa = new wrapAccount(c);
searchResults.add(wa);
}
//-------added--------
}
//--------------search()--------------
public PageReference search() {
searchResults = new List<wrapAccount>();
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
List<Contact> contactList = Database.query(qry);
if(contactList.size()<1)
{
String htmlText = 'Oops...Contact not found, Sorry !';
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, htmlText));
}
for(Contact c : Database.query(qry)) {
wrapAccount cw = new wrapAccount(c);
searchResults.add(cw);
}
return null;
}
//--------------CancelAction()--------------
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBSendSurvey');
pr1.setRedirect(true);
return pr1;
}
//--------------processSelected()--------------
@TestVisible public void processSelected()
{
try
{
feedid= (ApexPages.currentPage().getParameters().get('id'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
if(fullnameEncoded !=null || fullnameEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(fullnameEncoded );
fullname = bodyBlob1.toString();
}
else
{
fullname = ApexPages.currentPage().getParameters().get('fullname');
}
emailEncoded = ApexPages.currentPage().getParameters().get('email');
if(emailEncoded !=null || emailEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(emailEncoded );
email = bodyBlob1.toString();
}
else
{
email = ApexPages.currentPage().getParameters().get('email');
}
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
if(phoneEncoded !=null )
{
Blob bodyBlob2 =EncodingUtil.base64Decode(phoneEncoded );
con_number =bodyBlob2.toString();
}
else
{
con_number=ApexPages.currentPage().getParameters().get('con_number');
}
selectedAccounts = new List<Contact>();
for(wrapAccount wrapAccountObj : searchResults)
{
if(wrapAccountObj.selected == true)
{
selectedAccounts.add(wrapAccountObj.acc);
}
}
for(Contact cont : selectedAccounts)
{
contactids.add(cont.Id);
}
feedcon = new List<Feedback_Contacts__c>();
cont = new List<Contact>();
cont = [Select firstname,lastname,email,id,name,MobilePhone from Contact where id in :selectedAccounts];
for(Contact c :cont)
{
string fullname = c.firstname + ' ' + c.lastname;
Blob beforeblob = Blob.valueOf(fullname);
EncodingUtil.urlEncode(fullname,'UTF-8');
string email = c.email;
Blob beforeblob1 = Blob.valueOf(email);
EncodingUtil.urlEncode(email,'UTF-8');
string con_number = c.MobilePhone;
Blob beforeblob2 = Blob.valueOf(con_number);
EncodingUtil.urlEncode(con_number,'UTF-8');
Feedback_Contacts__c fc = new Feedback_Contacts__c();
fc.FeedbackContactName__c= c.Id;
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.FeedbackContactName__c);
fc.FeedBackNo__c = feedid;
// system.debug('++++++++++ConNumber__c++++++++++'+fc.FeedBackNo__c);
fc.test__c = EncodingUtil.base64Encode(beforeblob );
fc.Email__c = EncodingUtil.base64Encode(beforeblob1 );
fc.ConNumber__c= EncodingUtil.base64Encode(beforeblob2 );
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.ConNumber__c+'**'+fc.FeedBackNo__c);
feedcon.add(fc);
//system.debug('++++++++++feedcon++++++++++'+feedcon);
}
insert feedcon;
// system.debug('++++++++++INSERT++++++++++'+feedcon);
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(contactids);
if(!Test.isRunningTest())
{
EmailTemplate templateId = [Select id from EmailTemplate where name = 'SurveyFeedback'];
// system.debug('+++++++++++++++++++++++TEMPLATE ID++++++++++++++++++++++++++++++'+templateId.id);
mail.setTemplateId(templateId.id); //00X55000000E1LO
Messaging.sendEmail(new Messaging.MassEmailMessage[] {mail});
}
String msg1 = 'Mail Sent!';
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.INFO,msg1));
}
catch(Exception e) {
// System.debug('Oops ! Email limit exceeded...Sorry');
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.Error,'Message not sent'));
System.debug('*********************Oops ! Email limit exceeded...Sorry******************************');
}
}
//--------------class wrapAccount--------------
@TestVisible public class wrapAccount {
public Contact acc {get; set;}
public Boolean selected {get; set;}
public wrapAccount(Contact a) {
acc = a;
selected = false;
}
}
//--------------Redirect()--------------
public PageReference Redirect(){
PageReference ref = new PageReference('/apex/SBEmailTemplate');
ref.setRedirect(true);
return ref;
}
public PageReference RedirectCon(){
PageReference ref = new PageReference('/apex/ContactPage');
ref.setRedirect(true);
return ref;
}
}
Thanks & regards,
Satakshi
I am writing a code where i want functionality where if contact are not selected then it will throw error otherwise it will proceed further. i tried a lot. but its not working..
My code is:
public with sharing class ContactSelectClassController
{
public String beforeblob1{get;set;}
//public String conid{get;set;}
public String emailEncoded { get; set; }
public String email { get; set; }
public String phoneEncoded { get; set; }
public String con_number { get; set; }
public String fullname{get;set;}
public String emailName{get;set;}
public String fullnameEncoded{get;set;}
@TestVisible public List<wrapAccount> wrapAccountList {get; set;}
//-----added----
public List<Contact> selectedAccounts{get;set;}
public String feedid;
private List<Id> contactids=new list<Id>();
public List<Contact> cont{get;set;}
public List<Feedback_Contacts__c> feedcon{get;set;}
// ---------for search-------
public List<wrapAccount> searchResults {get;set;}
public List<String> selectP = new List<String>();
//--------------searchText--------------
public string searchText {
get {
if (searchText == null) searchText = ''; // prefill the serach box for ease of use
return searchText;
}
set;
}
//--------------ContactSelectClassController()--------------
public ContactSelectClassController()
{
feedid= (ApexPages.currentPage().getParameters().get('fid'));
emailName= (ApexPages.currentPage().getParameters().get('emailName'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
emailEncoded = ApexPages.currentPage().getParameters().get('email');
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
//-------added--------
if(searchResults == null)
{
searchResults = new List<wrapAccount>(); // init the list if it is null
}
else
{
wrapAccountList.clear(); // clear out the current results if they exist
}
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
for(Contact c : Database.query(qry))
{
wrapAccount wa = new wrapAccount(c);
searchResults.add(wa);
}
//-------added--------
}
//--------------search()--------------
public PageReference search() {
searchResults = new List<wrapAccount>();
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
List<Contact> contactList = Database.query(qry);
if(contactList.size()<1)
{
String htmlText = 'Oops...Contact not found, Sorry !';
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, htmlText));
}
for(Contact c : Database.query(qry)) {
wrapAccount cw = new wrapAccount(c);
searchResults.add(cw);
}
return null;
}
//--------------CancelAction()--------------
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBSendSurvey');
pr1.setRedirect(true);
return pr1;
}
//--------------processSelected()--------------
@TestVisible public void processSelected()
{
try
{
feedid= (ApexPages.currentPage().getParameters().get('id'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
if(fullnameEncoded !=null || fullnameEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(fullnameEncoded );
fullname = bodyBlob1.toString();
}
else
{
fullname = ApexPages.currentPage().getParameters().get('fullname');
}
emailEncoded = ApexPages.currentPage().getParameters().get('email');
if(emailEncoded !=null || emailEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(emailEncoded );
email = bodyBlob1.toString();
}
else
{
email = ApexPages.currentPage().getParameters().get('email');
}
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
if(phoneEncoded !=null )
{
Blob bodyBlob2 =EncodingUtil.base64Decode(phoneEncoded );
con_number =bodyBlob2.toString();
}
else
{
con_number=ApexPages.currentPage().getParameters().get('con_number');
}
selectedAccounts = new List<Contact>();
for(wrapAccount wrapAccountObj : searchResults)
{
if(wrapAccountObj.selected == true)
{
selectedAccounts.add(wrapAccountObj.acc);
}
}
for(Contact cont : selectedAccounts)
{
contactids.add(cont.Id);
}
feedcon = new List<Feedback_Contacts__c>();
cont = new List<Contact>();
cont = [Select firstname,lastname,email,id,name,MobilePhone from Contact where id in :selectedAccounts];
for(Contact c :cont)
{
string fullname = c.firstname + ' ' + c.lastname;
Blob beforeblob = Blob.valueOf(fullname);
EncodingUtil.urlEncode(fullname,'UTF-8');
string email = c.email;
Blob beforeblob1 = Blob.valueOf(email);
EncodingUtil.urlEncode(email,'UTF-8');
string con_number = c.MobilePhone;
Blob beforeblob2 = Blob.valueOf(con_number);
EncodingUtil.urlEncode(con_number,'UTF-8');
Feedback_Contacts__c fc = new Feedback_Contacts__c();
fc.FeedbackContactName__c= c.Id;
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.FeedbackContactName__c);
fc.FeedBackNo__c = feedid;
// system.debug('++++++++++ConNumber__c++++++++++'+fc.FeedBackNo__c);
fc.test__c = EncodingUtil.base64Encode(beforeblob );
fc.Email__c = EncodingUtil.base64Encode(beforeblob1 );
fc.ConNumber__c= EncodingUtil.base64Encode(beforeblob2 );
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.ConNumber__c+'**'+fc.FeedBackNo__c);
feedcon.add(fc);
//system.debug('++++++++++feedcon++++++++++'+feedcon);
}
insert feedcon;
// system.debug('++++++++++INSERT++++++++++'+feedcon);
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(contactids);
if(!Test.isRunningTest())
{
EmailTemplate templateId = [Select id from EmailTemplate where name = 'SurveyFeedback'];
// system.debug('+++++++++++++++++++++++TEMPLATE ID++++++++++++++++++++++++++++++'+templateId.id);
mail.setTemplateId(templateId.id); //00X55000000E1LO
Messaging.sendEmail(new Messaging.MassEmailMessage[] {mail});
}
String msg1 = 'Mail Sent!';
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.INFO,msg1));
}
catch(Exception e) {
// System.debug('Oops ! Email limit exceeded...Sorry');
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.Error,'Message not sent'));
System.debug('*********************Oops ! Email limit exceeded...Sorry******************************');
}
}
//--------------class wrapAccount--------------
@TestVisible public class wrapAccount {
public Contact acc {get; set;}
public Boolean selected {get; set;}
public wrapAccount(Contact a) {
acc = a;
selected = false;
}
}
//--------------Redirect()--------------
public PageReference Redirect(){
PageReference ref = new PageReference('/apex/SBEmailTemplate');
ref.setRedirect(true);
return ref;
}
public PageReference RedirectCon(){
PageReference ref = new PageReference('/apex/ContactPage');
ref.setRedirect(true);
return ref;
}
}
Thanks & regards,
Satakshi
- satakshi
- November 14, 2016
- Like
- 0
how to add default logo if logo is not selected
Hello,
I want functionality where if logo is not selected then it should display default image by system. Is this possible?
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
insert d;
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
I want functionality where if logo is not selected then it should display default image by system. Is this possible?
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
insert d;
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
- satakshi
- November 10, 2016
- Like
- 0
link to contact(User) in vf page
Hello, I am writing a code where i want to show contact name as a link. so after clicking on the name i will go into org and edit delete the record. I want this on this line. <apex:column colspan="5" value="{!accWrap.acc.Name}" /> Can anyone help me to achiev this?
<apex:page controller="ContactSelectClassController" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Send Mail</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function ShowHide(){
document.GetElementById('field1').display='block';
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.SearchField{
background: #F6F6F6;
height: 36px;
border-radius: 6px;
border: 1px solid #E1E1E1;
padding: 0 15px;
width: 20%;
font-family: 'Roboto', sans-serif;
font-size: 16px;
font-weight: 400;
}
</style>
<script type="text/javascript">
function selectAllCheckboxes(obj,receivedInputID){
var inputCheckBox = document.getElementsByTagName("input");
for(var i=0; i<inputCheckBox.length; i++){
if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
inputCheckBox[i].checked = obj.checked;
}
}
}
</script>
<script type="text/javascript">
function doSearch() {
searchServer(
document.getElementById("name").value
);
}
</script>
<script type="text/javascript">
function validate() {
{
alert ( "Survey has been sent successfully" );
}
}
</script>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li class="active"><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/00O50000004d9Np">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>All Contacts</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<apex:form >
<!--<apex:commandButton value="Add Contact" action="{!RedirectCon}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-left: 12px !important; margin-bottom: 20px; float: right;"/>-->
<!--<apex:commandButton value="Edit Template" action="{!Redirect}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-bottom: 20px; float: right;"/>-->
<!-- For search -->
<apex:outputLabel for="searchText">Search Contact</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" styleClass="SearchField" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" styleClass="green-btn" style="font-weight: bold;"/>
</apex:panelGroup>
<!-- For search -->
<apex:pageBlock >
<apex:messages style="color:red;font-size:15px;" /><br />
<div style="overflow: scroll; width:100%; height:300px;">
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="overflow:scroll;">
<apex:column colspan="2">
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
</apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
</div>
<!--<apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="margin-top:20px;">
<apex:column colspan="4" value="{!c.Id}" headerValue="Contact"/>
<apex:column colspan="4" value="{!c.Name}" headerValue="Contact Name"/>
<apex:column colspan="4" value="{!c.Email}" headerValue="Email"/>
<apex:column colspan="4" value="{!c.Phone}" headerValue="Phone"/>
</apex:pageBlockTable>-->
</apex:pageBlock>
<div class="feild buttons">
<apex:commandButton value="Send Survey" onclick="validate()" action="{!processSelected}" styleClass="green-btn" rerender="table2" style="margin-top: 20px;font-weight: bold;"/>
<apex:commandButton value="Cancel" action="{!CancelAction}" styleClass="red-btn" style="font-weight: bold;"/>
</div>
</apex:form>
</div>
</section>
<footer class="main-footer">
<ul>
<li> <a href="#">Privacy Policy</a> </li>
<li><a href="#">Terms of Services</a></li>
</ul>
<div class="copyright">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:page>
<apex:page controller="ContactSelectClassController" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Send Mail</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function ShowHide(){
document.GetElementById('field1').display='block';
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.SearchField{
background: #F6F6F6;
height: 36px;
border-radius: 6px;
border: 1px solid #E1E1E1;
padding: 0 15px;
width: 20%;
font-family: 'Roboto', sans-serif;
font-size: 16px;
font-weight: 400;
}
</style>
<script type="text/javascript">
function selectAllCheckboxes(obj,receivedInputID){
var inputCheckBox = document.getElementsByTagName("input");
for(var i=0; i<inputCheckBox.length; i++){
if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
inputCheckBox[i].checked = obj.checked;
}
}
}
</script>
<script type="text/javascript">
function doSearch() {
searchServer(
document.getElementById("name").value
);
}
</script>
<script type="text/javascript">
function validate() {
{
alert ( "Survey has been sent successfully" );
}
}
</script>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li class="active"><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/00O50000004d9Np">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>All Contacts</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<apex:form >
<!--<apex:commandButton value="Add Contact" action="{!RedirectCon}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-left: 12px !important; margin-bottom: 20px; float: right;"/>-->
<!--<apex:commandButton value="Edit Template" action="{!Redirect}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-bottom: 20px; float: right;"/>-->
<!-- For search -->
<apex:outputLabel for="searchText">Search Contact</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" styleClass="SearchField" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" styleClass="green-btn" style="font-weight: bold;"/>
</apex:panelGroup>
<!-- For search -->
<apex:pageBlock >
<apex:messages style="color:red;font-size:15px;" /><br />
<div style="overflow: scroll; width:100%; height:300px;">
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="overflow:scroll;">
<apex:column colspan="2">
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
</apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
</div>
<!--<apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="margin-top:20px;">
<apex:column colspan="4" value="{!c.Id}" headerValue="Contact"/>
<apex:column colspan="4" value="{!c.Name}" headerValue="Contact Name"/>
<apex:column colspan="4" value="{!c.Email}" headerValue="Email"/>
<apex:column colspan="4" value="{!c.Phone}" headerValue="Phone"/>
</apex:pageBlockTable>-->
</apex:pageBlock>
<div class="feild buttons">
<apex:commandButton value="Send Survey" onclick="validate()" action="{!processSelected}" styleClass="green-btn" rerender="table2" style="margin-top: 20px;font-weight: bold;"/>
<apex:commandButton value="Cancel" action="{!CancelAction}" styleClass="red-btn" style="font-weight: bold;"/>
</div>
</apex:form>
</div>
</section>
<footer class="main-footer">
<ul>
<li> <a href="#">Privacy Policy</a> </li>
<li><a href="#">Terms of Services</a></li>
</ul>
<div class="copyright">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:page>
- satakshi
- November 07, 2016
- Like
- 0
Throw error pop up message when upload file limit exceeded than 5MB
Hello,
I am writing a code. where i am uploading a logo. Now my issue is when my image size is more than 5 mb then it shows error message seperated like this "Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 156.812KB". I want that it should throw eeror pop up message on the same window
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
try{
insert d;
}
catch (DMLException e) {
// catch (System.LimitException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'File Size is more than 5MB'));
return null;
}
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
VF Page:
<apex:page controller="DocumentController" sidebar="false" showHeader="false" standardStylesheets="true" docType="html-5.0">
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Create Survey</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
<!--$(document).ready(function(){
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
return false;
});
});
$(document).ready(function(){
$(".NextTwo").click(function(){
$(".HeaderFooterDiv").hide();
$(".ContactDiv").show();
return false;
});
});-->
function CheckFbName(ReceiveInputID){
var inputValue = document.getElementById(ReceiveInputID).value;
if(inputValue.length==0 || inputValue == ''){
alert("Please enter Survey Name.");
$(".NextOne").click(function(){
$(".NameDiv").show();
$(".HeaderFooterDiv").hide();
$(".ContactDiv").hide();
return false;
});
}
else
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
$(".ContactDiv").hide();
return false;
});
}
function myFunction() {
window.open("https://cs41.salesforce.com/apex/AddQuestionPage");
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
@import url(http://fonts.googleapis.com/css?family=Nunito:300);
body { font-family: "Nunito", sans-serif; font-size: 24px; }
a { text-decoration: none; }
p { text-align: center; }
sup { font-size: 36px; font-weight: 100; line-height: 55px; }
.button
{
text-transform: none;
letter-spacing: 0px;
text-align: center;
color: #0C5;
font-size: 20px;
font-family: "Nunito", sans-serif;
font-weight: 300;
position: absolute;
top: 11px;
right: 0;
bottom: 0;
left: 56.6%;
padding: 10px 0;
width: 236px;
height: 43px;
background: #00a1e1;
border: 1px solid #00a1e1;
color: #FFF;
overflow: hidden;
transition: all 0.5s;
float: right !important;
border-radius: 20px;
}
.button:hover, .button:active
{
text-decoration: none;
color: #00a1e1;/*#0C5*/
border-color: #00a1e1;
background: #FFF;
}
.button span
{
display: inline-block;
position: relative;
padding-right: 0;
transition: padding-right 0.5s;
}
.button span:after
{
content: ' ';
position: absolute;
top: 0;
right: -18px;
opacity: 0;
width: 10px;
height: 10px;
margin-top: -10px;
background: rgba(0, 0, 0, 0);
border: 3px solid #FFF;
border-top: none;
border-right: none;
transition: opacity 0.5s, top 0.5s, right 0.5s;
transform: rotate(-135deg);
}
.button:hover span, .button:active span
{
padding-right: 30px;
}
.button:hover span:after, .button:active span:after
{
transition: opacity 0.5s, top 0.5s, right 0.5s;
opacity: 1;
border-color: #00a1e1;
right: 10px;
top: 70%;
}
</style>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li class="active"><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/apex/SBREPORT">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>Create Survey</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<div class="white-box">
<div class="mainForm">
<!--<apex:commandButton value="View Existing Surveys" action="{!Manage}" styleClass="green-btn" style="float:right !important;"/>-->
<a href="/apex/SBAddQuestionPage" class="button"><span>View Existing Surveys</span></a>
<hr />
<div class="formFeild">
<label>Please enter the name for survey:</label>
<div class="feild">
<apex:inputText value="{!feedbackmain.Feedback_Name__c}" html-placeholder="Enter name for the survey" id="FbName" required="true" rendered="true"/>
</div>
</div>
<div class="formFeild">
<label>Upload Logo (5 MB Max. size):</label>
<div class="feild">
<apex:inputfile value="{!file}" ></apex:inputfile>
<!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> -->
</div>
</div>
<div class="formFeild">
<label>Header Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Header_Text__c}" html-placeholder="Header Text"/>
</div>
</div>
<div class="formFeild">
<label>Footer Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Footer_text__c}" html-placeholder="Footer Text"/>
</div>
</div>
<div class="formFeild">
<label>Survey Owner:</label>
<div class="feild">
<apex:inputField value="{!feedbackmain.Feedback_Taken_by_Contact__c}" required="true"/>
<!--<div class="outside-btn">
<a href="" class="survey-btn"><img src="assets/images/survey-view-btn.png" alt=""/></a>
</div>-->
</div>
</div>
<div class="formFeild">
<label> </label>
<div class="feild">
<apex:commandButton value="Save" action="{!saveAndRedirect}" style="display: inline-block !important; padding:3px 15px !important; line-height:35px !important; color:#fff !important; font-size:15px !important; background:#75C181 !important; border-radius:35px !important; margin-bottom:15px !important; min-width:125px !important; text-align:center !important;"/>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="main-footer">
<ul>
<li><a href="#" style="font-size: 17px;">Privacy Policy</a></li>
<li><a href="#" style="font-size: 17px;">Terms of Services</a></li>
</ul>
<div class="copyright" style="font-size: 17px;">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:form>
</apex:page>
I am writing a code. where i am uploading a logo. Now my issue is when my image size is more than 5 mb then it shows error message seperated like this "Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 156.812KB". I want that it should throw eeror pop up message on the same window
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
try{
insert d;
}
catch (DMLException e) {
// catch (System.LimitException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'File Size is more than 5MB'));
return null;
}
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
VF Page:
<apex:page controller="DocumentController" sidebar="false" showHeader="false" standardStylesheets="true" docType="html-5.0">
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Create Survey</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
<!--$(document).ready(function(){
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
return false;
});
});
$(document).ready(function(){
$(".NextTwo").click(function(){
$(".HeaderFooterDiv").hide();
$(".ContactDiv").show();
return false;
});
});-->
function CheckFbName(ReceiveInputID){
var inputValue = document.getElementById(ReceiveInputID).value;
if(inputValue.length==0 || inputValue == ''){
alert("Please enter Survey Name.");
$(".NextOne").click(function(){
$(".NameDiv").show();
$(".HeaderFooterDiv").hide();
$(".ContactDiv").hide();
return false;
});
}
else
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
$(".ContactDiv").hide();
return false;
});
}
function myFunction() {
window.open("https://cs41.salesforce.com/apex/AddQuestionPage");
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
@import url(http://fonts.googleapis.com/css?family=Nunito:300);
body { font-family: "Nunito", sans-serif; font-size: 24px; }
a { text-decoration: none; }
p { text-align: center; }
sup { font-size: 36px; font-weight: 100; line-height: 55px; }
.button
{
text-transform: none;
letter-spacing: 0px;
text-align: center;
color: #0C5;
font-size: 20px;
font-family: "Nunito", sans-serif;
font-weight: 300;
position: absolute;
top: 11px;
right: 0;
bottom: 0;
left: 56.6%;
padding: 10px 0;
width: 236px;
height: 43px;
background: #00a1e1;
border: 1px solid #00a1e1;
color: #FFF;
overflow: hidden;
transition: all 0.5s;
float: right !important;
border-radius: 20px;
}
.button:hover, .button:active
{
text-decoration: none;
color: #00a1e1;/*#0C5*/
border-color: #00a1e1;
background: #FFF;
}
.button span
{
display: inline-block;
position: relative;
padding-right: 0;
transition: padding-right 0.5s;
}
.button span:after
{
content: ' ';
position: absolute;
top: 0;
right: -18px;
opacity: 0;
width: 10px;
height: 10px;
margin-top: -10px;
background: rgba(0, 0, 0, 0);
border: 3px solid #FFF;
border-top: none;
border-right: none;
transition: opacity 0.5s, top 0.5s, right 0.5s;
transform: rotate(-135deg);
}
.button:hover span, .button:active span
{
padding-right: 30px;
}
.button:hover span:after, .button:active span:after
{
transition: opacity 0.5s, top 0.5s, right 0.5s;
opacity: 1;
border-color: #00a1e1;
right: 10px;
top: 70%;
}
</style>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li class="active"><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/apex/SBREPORT">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>Create Survey</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<div class="white-box">
<div class="mainForm">
<!--<apex:commandButton value="View Existing Surveys" action="{!Manage}" styleClass="green-btn" style="float:right !important;"/>-->
<a href="/apex/SBAddQuestionPage" class="button"><span>View Existing Surveys</span></a>
<hr />
<div class="formFeild">
<label>Please enter the name for survey:</label>
<div class="feild">
<apex:inputText value="{!feedbackmain.Feedback_Name__c}" html-placeholder="Enter name for the survey" id="FbName" required="true" rendered="true"/>
</div>
</div>
<div class="formFeild">
<label>Upload Logo (5 MB Max. size):</label>
<div class="feild">
<apex:inputfile value="{!file}" ></apex:inputfile>
<!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> -->
</div>
</div>
<div class="formFeild">
<label>Header Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Header_Text__c}" html-placeholder="Header Text"/>
</div>
</div>
<div class="formFeild">
<label>Footer Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Footer_text__c}" html-placeholder="Footer Text"/>
</div>
</div>
<div class="formFeild">
<label>Survey Owner:</label>
<div class="feild">
<apex:inputField value="{!feedbackmain.Feedback_Taken_by_Contact__c}" required="true"/>
<!--<div class="outside-btn">
<a href="" class="survey-btn"><img src="assets/images/survey-view-btn.png" alt=""/></a>
</div>-->
</div>
</div>
<div class="formFeild">
<label> </label>
<div class="feild">
<apex:commandButton value="Save" action="{!saveAndRedirect}" style="display: inline-block !important; padding:3px 15px !important; line-height:35px !important; color:#fff !important; font-size:15px !important; background:#75C181 !important; border-radius:35px !important; margin-bottom:15px !important; min-width:125px !important; text-align:center !important;"/>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="main-footer">
<ul>
<li><a href="#" style="font-size: 17px;">Privacy Policy</a></li>
<li><a href="#" style="font-size: 17px;">Terms of Services</a></li>
</ul>
<div class="copyright" style="font-size: 17px;">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:form>
</apex:page>
- satakshi
- October 06, 2016
- Like
- 1
How to add alert message if record is already present in the object?
Heelo,
I want functionality where if already records are present in the object then it should through error message that record are already created and does not create any record. I am writing this code on custom button. And on click of custom button reords get created. My code is as below
Controller:
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
private ApexPages.StandardController controller;
public Calender(ApexPages.StandardController controller)
{
this.controller = controller;
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public PageReference saveAndReturn()
{
PageReference cancel = controller.cancel();
controller.save();
return cancel;
}
public Decimal dy;
public date myDate;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
/* myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day); */
/* myDate = date.newInstance(integer.valueOf(obj.Year__c), integer.valueOf(obj.Month__c), 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day);*/
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
}
insert newdtp;
return null;
}
}
VF PAge:
<!--<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>-->
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
<apex:form >
<html>
<style type="text/css">
.myButton {
-moz-box-shadow: 3px -3px 5px -2px #899599;
-webkit-box-shadow: 3px -3px 5px -2px #899599;
box-shadow: 3px -3px 5px -2px #899599;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #bab1ba));
background:-moz-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:-webkit-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:-o-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:-ms-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#bab1ba',GradientType=0);
background-color:#ededed !Important;
-moz-border-radius:24px !Important;
-webkit-border-radius:24px !Important;
border-radius:24px !Important;
border:2px solid #d6bcd6 !Important;
display:inline-block !Important;
cursor:pointer !Important;
color:#3a8a9e !Important;
font-family:Arial !Important;
font-size:18px !Important;
font-weight:bold !Important;
padding:2px 36px !Important;
text-decoration:none !Important;
text-shadow:0px 0px 0px #e1e2ed !Important;
margin: 10px 10px 10px 10px !Important;
}
.myButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #bab1ba), color-stop(1, #ededed));
background:-moz-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:-webkit-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:-o-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:-ms-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bab1ba', endColorstr='#ededed',GradientType=0);
background-color:#bab1ba;
}
.myButton:active {
position:relative;
top:1px;
}
</style>
<center>
<h1 style="font-size: 300%;"> Records Created Successfully </h1>
<br />
<br />
<br />
<apex:commandButton styleClass="myButton" action="{!cancel}" value="Close"/>
<!--<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column >
<apex:facet name="header"> Name</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Visit Date</apex:facet>
<apex:outputText value="{!item.Date__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Visit Type</apex:facet>
<apex:outputText value="{!item.Visit_type__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Food Expenses</apex:facet>
<apex:outputText value="{!item.Food_Expenses__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>-->
</center>
</html>
</apex:form>
</apex:page>
I want functionality where if already records are present in the object then it should through error message that record are already created and does not create any record. I am writing this code on custom button. And on click of custom button reords get created. My code is as below
Controller:
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
private ApexPages.StandardController controller;
public Calender(ApexPages.StandardController controller)
{
this.controller = controller;
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public PageReference saveAndReturn()
{
PageReference cancel = controller.cancel();
controller.save();
return cancel;
}
public Decimal dy;
public date myDate;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
/* myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day); */
/* myDate = date.newInstance(integer.valueOf(obj.Year__c), integer.valueOf(obj.Month__c), 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day);*/
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
}
insert newdtp;
return null;
}
}
VF PAge:
<!--<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>-->
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
<apex:form >
<html>
<style type="text/css">
.myButton {
-moz-box-shadow: 3px -3px 5px -2px #899599;
-webkit-box-shadow: 3px -3px 5px -2px #899599;
box-shadow: 3px -3px 5px -2px #899599;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #bab1ba));
background:-moz-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:-webkit-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:-o-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:-ms-linear-gradient(top, #ededed 5%, #bab1ba 100%);
background:linear-gradient(to bottom, #ededed 5%, #bab1ba 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#bab1ba',GradientType=0);
background-color:#ededed !Important;
-moz-border-radius:24px !Important;
-webkit-border-radius:24px !Important;
border-radius:24px !Important;
border:2px solid #d6bcd6 !Important;
display:inline-block !Important;
cursor:pointer !Important;
color:#3a8a9e !Important;
font-family:Arial !Important;
font-size:18px !Important;
font-weight:bold !Important;
padding:2px 36px !Important;
text-decoration:none !Important;
text-shadow:0px 0px 0px #e1e2ed !Important;
margin: 10px 10px 10px 10px !Important;
}
.myButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #bab1ba), color-stop(1, #ededed));
background:-moz-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:-webkit-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:-o-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:-ms-linear-gradient(top, #bab1ba 5%, #ededed 100%);
background:linear-gradient(to bottom, #bab1ba 5%, #ededed 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bab1ba', endColorstr='#ededed',GradientType=0);
background-color:#bab1ba;
}
.myButton:active {
position:relative;
top:1px;
}
</style>
<center>
<h1 style="font-size: 300%;"> Records Created Successfully </h1>
<br />
<br />
<br />
<apex:commandButton styleClass="myButton" action="{!cancel}" value="Close"/>
<!--<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column >
<apex:facet name="header"> Name</apex:facet>
<apex:outputText value="{!item.Name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Visit Date</apex:facet>
<apex:outputText value="{!item.Date__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Visit Type</apex:facet>
<apex:outputText value="{!item.Visit_type__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Food Expenses</apex:facet>
<apex:outputText value="{!item.Food_Expenses__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>-->
</center>
</html>
</apex:form>
</apex:page>
- satakshi
- September 21, 2016
- Like
- 0
Variable does not exist: date
Hello,
I am writing a code where when i will create record date should be automatically create into visualforce. i am getting error in this line date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Can anyone please help me to solve this?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public date myDate;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day);
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Thanks & Regards,
Satakshi
I am writing a code where when i will create record date should be automatically create into visualforce. i am getting error in this line date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Can anyone please help me to solve this?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public date myDate;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day);
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Thanks & Regards,
Satakshi
- satakshi
- September 21, 2016
- Like
- 0
How can we add date automatically in the records?
Hi,
I want functionality where according to month and year date will automatically added into record. How can we achive it?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Regards,
Satakshi
I want functionality where according to month and year date will automatically added into record. How can we achive it?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Regards,
Satakshi
- satakshi
- September 20, 2016
- Like
- 0
How to display record from custom object on VF Page?
Hello,
I am inserting some records when i click on custom button. Button is on parent object. I am creating child records of that parent object. I want to show all this records on visualforce page. I have written the code. But nothing is displaing. Can anyone please help me?
VF SHOWDTP
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=============================================
Controller
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Regards,
Satakshi
I am inserting some records when i click on custom button. Button is on parent object. I am creating child records of that parent object. I want to show all this records on visualforce page. I have written the code. But nothing is displaing. Can anyone please help me?
VF SHOWDTP
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=============================================
Controller
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Regards,
Satakshi
- satakshi
- September 20, 2016
- Like
- 0
Records are not displayed
Hello,
I am creating a visualforce page. Where i want to show records. Here MTP is parent object and DTP is child object. I have created code where i am inserting records. I want to show those inserted records on visualforce pages.I have written the code. But records are not displaying.Can anyone please help me with this?
Controller:
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Visualforce Page:
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I am creating a visualforce page. Where i want to show records. Here MTP is parent object and DTP is child object. I have created code where i am inserting records. I want to show those inserted records on visualforce pages.I have written the code. But records are not displaying.Can anyone please help me with this?
Controller:
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Visualforce Page:
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
- satakshi
- September 19, 2016
- Like
- 0
Record size is not as required
Hello,
I am writing a code where i have created two formula field which gives me number of days for particular month like this
Formula field= Febrary: To check number of days in febrary
IF( ISPICKVAL( Month__c , 'February') , TEXT(IF( OR((ISPICKVAL(Year__c, '2016')),(ISPICKVAL(Year__c,'2020')), ((ISPICKVAL(Year__c, '2024')))) , 29, 28)), null)
Formula field= NumberOfDays
VALUE(
CASE(Month__c,
"January","31",
"March","31",
"April","30",
"May","31",
"June","30",
"July","31",
"August","31",
"September","30",
"October","31",
"November","30",
"December","31",
""))
My query is i am writing a code where i can create records for those particular days of particular month but by my code i am able to create only 30 records. I want that in picklist field if month is jan then it should create 31 records, if month is feb then accordingly leap year it should create 29/28 days. and if month is of 30 days then it should create 30 records. Now with my code i am able to create only 30 records for any month. In debug statement System.debug('***************dy size******************'+dy); I am getting size 30. Can anyone please help me with this??
Controller:
public with sharing class Calender {
public List<DTP__c> mydtpList {set;get;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
List<MTP__c> obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c];
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
}
}
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
VF PAge:
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
</apex:page>
Thanks & Regards,
Satakshi
I am writing a code where i have created two formula field which gives me number of days for particular month like this
Formula field= Febrary: To check number of days in febrary
IF( ISPICKVAL( Month__c , 'February') , TEXT(IF( OR((ISPICKVAL(Year__c, '2016')),(ISPICKVAL(Year__c,'2020')), ((ISPICKVAL(Year__c, '2024')))) , 29, 28)), null)
Formula field= NumberOfDays
VALUE(
CASE(Month__c,
"January","31",
"March","31",
"April","30",
"May","31",
"June","30",
"July","31",
"August","31",
"September","30",
"October","31",
"November","30",
"December","31",
""))
My query is i am writing a code where i can create records for those particular days of particular month but by my code i am able to create only 30 records. I want that in picklist field if month is jan then it should create 31 records, if month is feb then accordingly leap year it should create 29/28 days. and if month is of 30 days then it should create 30 records. Now with my code i am able to create only 30 records for any month. In debug statement System.debug('***************dy size******************'+dy); I am getting size 30. Can anyone please help me with this??
Controller:
public with sharing class Calender {
public List<DTP__c> mydtpList {set;get;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
List<MTP__c> obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c];
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
}
}
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
VF PAge:
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
</apex:page>
Thanks & Regards,
Satakshi
- satakshi
- September 19, 2016
- Like
- 0
Throw error pop up message when upload file limit exceeded than 5MB
Hello,
I am writing a code. where i am uploading a logo. Now my issue is when my image size is more than 5 mb then it shows error message seperated like this "Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 156.812KB". I want that it should throw eeror pop up message on the same window
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
try{
insert d;
}
catch (DMLException e) {
// catch (System.LimitException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'File Size is more than 5MB'));
return null;
}
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
VF Page:
<apex:page controller="DocumentController" sidebar="false" showHeader="false" standardStylesheets="true" docType="html-5.0">
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Create Survey</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
<!--$(document).ready(function(){
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
return false;
});
});
$(document).ready(function(){
$(".NextTwo").click(function(){
$(".HeaderFooterDiv").hide();
$(".ContactDiv").show();
return false;
});
});-->
function CheckFbName(ReceiveInputID){
var inputValue = document.getElementById(ReceiveInputID).value;
if(inputValue.length==0 || inputValue == ''){
alert("Please enter Survey Name.");
$(".NextOne").click(function(){
$(".NameDiv").show();
$(".HeaderFooterDiv").hide();
$(".ContactDiv").hide();
return false;
});
}
else
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
$(".ContactDiv").hide();
return false;
});
}
function myFunction() {
window.open("https://cs41.salesforce.com/apex/AddQuestionPage");
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
@import url(http://fonts.googleapis.com/css?family=Nunito:300);
body { font-family: "Nunito", sans-serif; font-size: 24px; }
a { text-decoration: none; }
p { text-align: center; }
sup { font-size: 36px; font-weight: 100; line-height: 55px; }
.button
{
text-transform: none;
letter-spacing: 0px;
text-align: center;
color: #0C5;
font-size: 20px;
font-family: "Nunito", sans-serif;
font-weight: 300;
position: absolute;
top: 11px;
right: 0;
bottom: 0;
left: 56.6%;
padding: 10px 0;
width: 236px;
height: 43px;
background: #00a1e1;
border: 1px solid #00a1e1;
color: #FFF;
overflow: hidden;
transition: all 0.5s;
float: right !important;
border-radius: 20px;
}
.button:hover, .button:active
{
text-decoration: none;
color: #00a1e1;/*#0C5*/
border-color: #00a1e1;
background: #FFF;
}
.button span
{
display: inline-block;
position: relative;
padding-right: 0;
transition: padding-right 0.5s;
}
.button span:after
{
content: ' ';
position: absolute;
top: 0;
right: -18px;
opacity: 0;
width: 10px;
height: 10px;
margin-top: -10px;
background: rgba(0, 0, 0, 0);
border: 3px solid #FFF;
border-top: none;
border-right: none;
transition: opacity 0.5s, top 0.5s, right 0.5s;
transform: rotate(-135deg);
}
.button:hover span, .button:active span
{
padding-right: 30px;
}
.button:hover span:after, .button:active span:after
{
transition: opacity 0.5s, top 0.5s, right 0.5s;
opacity: 1;
border-color: #00a1e1;
right: 10px;
top: 70%;
}
</style>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li class="active"><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/apex/SBREPORT">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>Create Survey</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<div class="white-box">
<div class="mainForm">
<!--<apex:commandButton value="View Existing Surveys" action="{!Manage}" styleClass="green-btn" style="float:right !important;"/>-->
<a href="/apex/SBAddQuestionPage" class="button"><span>View Existing Surveys</span></a>
<hr />
<div class="formFeild">
<label>Please enter the name for survey:</label>
<div class="feild">
<apex:inputText value="{!feedbackmain.Feedback_Name__c}" html-placeholder="Enter name for the survey" id="FbName" required="true" rendered="true"/>
</div>
</div>
<div class="formFeild">
<label>Upload Logo (5 MB Max. size):</label>
<div class="feild">
<apex:inputfile value="{!file}" ></apex:inputfile>
<!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> -->
</div>
</div>
<div class="formFeild">
<label>Header Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Header_Text__c}" html-placeholder="Header Text"/>
</div>
</div>
<div class="formFeild">
<label>Footer Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Footer_text__c}" html-placeholder="Footer Text"/>
</div>
</div>
<div class="formFeild">
<label>Survey Owner:</label>
<div class="feild">
<apex:inputField value="{!feedbackmain.Feedback_Taken_by_Contact__c}" required="true"/>
<!--<div class="outside-btn">
<a href="" class="survey-btn"><img src="assets/images/survey-view-btn.png" alt=""/></a>
</div>-->
</div>
</div>
<div class="formFeild">
<label> </label>
<div class="feild">
<apex:commandButton value="Save" action="{!saveAndRedirect}" style="display: inline-block !important; padding:3px 15px !important; line-height:35px !important; color:#fff !important; font-size:15px !important; background:#75C181 !important; border-radius:35px !important; margin-bottom:15px !important; min-width:125px !important; text-align:center !important;"/>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="main-footer">
<ul>
<li><a href="#" style="font-size: 17px;">Privacy Policy</a></li>
<li><a href="#" style="font-size: 17px;">Terms of Services</a></li>
</ul>
<div class="copyright" style="font-size: 17px;">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:form>
</apex:page>
I am writing a code. where i am uploading a logo. Now my issue is when my image size is more than 5 mb then it shows error message seperated like this "Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 156.812KB". I want that it should throw eeror pop up message on the same window
public with sharing class DocumentController {
public Feedback_Main__c feedbackmain{get;set;}
public ID folderid{get;set;}
public Blob file{get;set;}
public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];
//List<String>AcutalBaseUrl =BaseUrl.split('.');
//system.debug('AcutalBaseUrl'+AcutalBaseUrl[0]);
}
public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
pg.setRedirect(true);
return pg;
}
public PageReference saveAndRedirect() {
Id OrgId = UserInfo.getOrganizationId();
Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
Document d= new Document();
d.name = 'LOGO';
d.body=file; // body field in document object which holds the file.
d.IsPublic = true;
d.ContentType ='image/png';
d.Type = 'png';
d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
if (Document.SObjectType.getDescribe().isCreateable())
{
try{
insert d;
}
catch (DMLException e) {
// catch (System.LimitException e) {
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'File Size is more than 5MB'));
return null;
}
}
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
insert feedbackmain; // This takes care of the details for you.
PageReference redirectPage = Page.SBAddQuestionPage;
redirectPage.setRedirect(true);
return redirectPage;
}
}
VF Page:
<apex:page controller="DocumentController" sidebar="false" showHeader="false" standardStylesheets="true" docType="html-5.0">
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Create Survey</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
<!--$(document).ready(function(){
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
return false;
});
});
$(document).ready(function(){
$(".NextTwo").click(function(){
$(".HeaderFooterDiv").hide();
$(".ContactDiv").show();
return false;
});
});-->
function CheckFbName(ReceiveInputID){
var inputValue = document.getElementById(ReceiveInputID).value;
if(inputValue.length==0 || inputValue == ''){
alert("Please enter Survey Name.");
$(".NextOne").click(function(){
$(".NameDiv").show();
$(".HeaderFooterDiv").hide();
$(".ContactDiv").hide();
return false;
});
}
else
$(".NextOne").click(function(){
$(".NameDiv").hide();
$(".HeaderFooterDiv").show();
$(".ContactDiv").hide();
return false;
});
}
function myFunction() {
window.open("https://cs41.salesforce.com/apex/AddQuestionPage");
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
@import url(http://fonts.googleapis.com/css?family=Nunito:300);
body { font-family: "Nunito", sans-serif; font-size: 24px; }
a { text-decoration: none; }
p { text-align: center; }
sup { font-size: 36px; font-weight: 100; line-height: 55px; }
.button
{
text-transform: none;
letter-spacing: 0px;
text-align: center;
color: #0C5;
font-size: 20px;
font-family: "Nunito", sans-serif;
font-weight: 300;
position: absolute;
top: 11px;
right: 0;
bottom: 0;
left: 56.6%;
padding: 10px 0;
width: 236px;
height: 43px;
background: #00a1e1;
border: 1px solid #00a1e1;
color: #FFF;
overflow: hidden;
transition: all 0.5s;
float: right !important;
border-radius: 20px;
}
.button:hover, .button:active
{
text-decoration: none;
color: #00a1e1;/*#0C5*/
border-color: #00a1e1;
background: #FFF;
}
.button span
{
display: inline-block;
position: relative;
padding-right: 0;
transition: padding-right 0.5s;
}
.button span:after
{
content: ' ';
position: absolute;
top: 0;
right: -18px;
opacity: 0;
width: 10px;
height: 10px;
margin-top: -10px;
background: rgba(0, 0, 0, 0);
border: 3px solid #FFF;
border-top: none;
border-right: none;
transition: opacity 0.5s, top 0.5s, right 0.5s;
transform: rotate(-135deg);
}
.button:hover span, .button:active span
{
padding-right: 30px;
}
.button:hover span:after, .button:active span:after
{
transition: opacity 0.5s, top 0.5s, right 0.5s;
opacity: 1;
border-color: #00a1e1;
right: 10px;
top: 70%;
}
</style>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li class="active"><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/apex/SBREPORT">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>Create Survey</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<div class="white-box">
<div class="mainForm">
<!--<apex:commandButton value="View Existing Surveys" action="{!Manage}" styleClass="green-btn" style="float:right !important;"/>-->
<a href="/apex/SBAddQuestionPage" class="button"><span>View Existing Surveys</span></a>
<hr />
<div class="formFeild">
<label>Please enter the name for survey:</label>
<div class="feild">
<apex:inputText value="{!feedbackmain.Feedback_Name__c}" html-placeholder="Enter name for the survey" id="FbName" required="true" rendered="true"/>
</div>
</div>
<div class="formFeild">
<label>Upload Logo (5 MB Max. size):</label>
<div class="feild">
<apex:inputfile value="{!file}" ></apex:inputfile>
<!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> -->
</div>
</div>
<div class="formFeild">
<label>Header Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Header_Text__c}" html-placeholder="Header Text"/>
</div>
</div>
<div class="formFeild">
<label>Footer Text:</label>
<div class="feild">
<apex:inputTextarea value="{!feedbackmain.Footer_text__c}" html-placeholder="Footer Text"/>
</div>
</div>
<div class="formFeild">
<label>Survey Owner:</label>
<div class="feild">
<apex:inputField value="{!feedbackmain.Feedback_Taken_by_Contact__c}" required="true"/>
<!--<div class="outside-btn">
<a href="" class="survey-btn"><img src="assets/images/survey-view-btn.png" alt=""/></a>
</div>-->
</div>
</div>
<div class="formFeild">
<label> </label>
<div class="feild">
<apex:commandButton value="Save" action="{!saveAndRedirect}" style="display: inline-block !important; padding:3px 15px !important; line-height:35px !important; color:#fff !important; font-size:15px !important; background:#75C181 !important; border-radius:35px !important; margin-bottom:15px !important; min-width:125px !important; text-align:center !important;"/>
</div>
</div>
</div>
</div>
</div>
</section>
<footer class="main-footer">
<ul>
<li><a href="#" style="font-size: 17px;">Privacy Policy</a></li>
<li><a href="#" style="font-size: 17px;">Terms of Services</a></li>
</ul>
<div class="copyright" style="font-size: 17px;">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:form>
</apex:page>
- satakshi
- October 06, 2016
- Like
- 1
Account Validation Rule
Hello,
I want validation rule on account object. Its a professional edition. When lead converts into account I am checking Client__c field.
I want validation rule on account so that if that account is created by lead conversion and client is equal to true then account address is manadatory. I am getting validation error on lead conversion page rather than account page.
AND( ISBLANK(BillingAddress), NOT(ISNEW()), Client__c = TRUE)
I want validation rule on account object. Its a professional edition. When lead converts into account I am checking Client__c field.
I want validation rule on account so that if that account is created by lead conversion and client is equal to true then account address is manadatory. I am getting validation error on lead conversion page rather than account page.
AND( ISBLANK(BillingAddress), NOT(ISNEW()), Client__c = TRUE)
- satakshi
- April 18, 2018
- Like
- 0
javascript to check whether checkbox are checked or not
Hello,
I am writing a code where if checkbox is checked then mail will send to desired user otherwise it will show an error "Please select checkbox". Can i get javascript for this?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table"">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
I am writing a code where if checkbox is checked then mail will send to desired user otherwise it will show an error "Please select checkbox". Can i get javascript for this?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table"">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
- satakshi
- December 07, 2016
- Like
- 0
Throw an error if checkbox is not checked in vf page
I want functionality where if checkbox is checked then only email will send to desired user otherwise it will throw an error "Please select atleast one contact". How it is possible?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" >
<apex:column colspan="2">
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/> </apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
- satakshi
- December 01, 2016
- Like
- 0
Back button is not working on visualforce page
Hello,
I am writing a code whre i want to come back on previous page. but in my case back button is not working. can anyone please help me?
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBAddQuestionPage' );
pr1.setRedirect(true);
return pr1;
}
<apex:commandButton value="Back" action="{!CancelAction}" styleClass="red-btn" style="margin-left: 113% !important; margin-top: -2% !important; font-weight: bold;"/>
Thanks & Regards,
Satakshi
I am writing a code whre i want to come back on previous page. but in my case back button is not working. can anyone please help me?
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBAddQuestionPage' );
pr1.setRedirect(true);
return pr1;
}
<apex:commandButton value="Back" action="{!CancelAction}" styleClass="red-btn" style="margin-left: 113% !important; margin-top: -2% !important; font-weight: bold;"/>
Thanks & Regards,
Satakshi
- satakshi
- November 16, 2016
- Like
- 0
Refresh page after picklist value is change
Hello,
I am writing code ehre i e=want to refresh page after picklist value is change. not when it is save. please help me to achieve this.
<apex:page controller="QBsampleCon" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<div class="formFeildreport formFeild">
<div class="feild formFeild">
<!--<h2 style="color:black; "> Question Type:</h2> class="questionlabel"-->
<label class="questionlabel" id="picvalchange">Question Type</label>
<apex:selectList value="{!pickval}" multiselect="false" size="1" id="PickVal" styleClass="Picklist" label="Question Type:" ><br />
<apex:actionSupport event="onchange" action="{!pickvalselect}" />
<apex:selectOptions value="{!SelectedOptions}"/>
</apex:selectList><br /><br />
</div>
Thanks & Regards,
Satakshi
I am writing code ehre i e=want to refresh page after picklist value is change. not when it is save. please help me to achieve this.
<apex:page controller="QBsampleCon" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<div class="formFeildreport formFeild">
<div class="feild formFeild">
<!--<h2 style="color:black; "> Question Type:</h2> class="questionlabel"-->
<label class="questionlabel" id="picvalchange">Question Type</label>
<apex:selectList value="{!pickval}" multiselect="false" size="1" id="PickVal" styleClass="Picklist" label="Question Type:" ><br />
<apex:actionSupport event="onchange" action="{!pickvalselect}" />
<apex:selectOptions value="{!SelectedOptions}"/>
</apex:selectList><br /><br />
</div>
Thanks & Regards,
Satakshi
- satakshi
- November 15, 2016
- Like
- 0
validation on contact while sending a mail
Hello,
I am writing a code where i want functionality where if contact are not selected then it will throw error otherwise it will proceed further. i tried a lot. but its not working..
My code is:
public with sharing class ContactSelectClassController
{
public String beforeblob1{get;set;}
//public String conid{get;set;}
public String emailEncoded { get; set; }
public String email { get; set; }
public String phoneEncoded { get; set; }
public String con_number { get; set; }
public String fullname{get;set;}
public String emailName{get;set;}
public String fullnameEncoded{get;set;}
@TestVisible public List<wrapAccount> wrapAccountList {get; set;}
//-----added----
public List<Contact> selectedAccounts{get;set;}
public String feedid;
private List<Id> contactids=new list<Id>();
public List<Contact> cont{get;set;}
public List<Feedback_Contacts__c> feedcon{get;set;}
// ---------for search-------
public List<wrapAccount> searchResults {get;set;}
public List<String> selectP = new List<String>();
//--------------searchText--------------
public string searchText {
get {
if (searchText == null) searchText = ''; // prefill the serach box for ease of use
return searchText;
}
set;
}
//--------------ContactSelectClassController()--------------
public ContactSelectClassController()
{
feedid= (ApexPages.currentPage().getParameters().get('fid'));
emailName= (ApexPages.currentPage().getParameters().get('emailName'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
emailEncoded = ApexPages.currentPage().getParameters().get('email');
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
//-------added--------
if(searchResults == null)
{
searchResults = new List<wrapAccount>(); // init the list if it is null
}
else
{
wrapAccountList.clear(); // clear out the current results if they exist
}
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
for(Contact c : Database.query(qry))
{
wrapAccount wa = new wrapAccount(c);
searchResults.add(wa);
}
//-------added--------
}
//--------------search()--------------
public PageReference search() {
searchResults = new List<wrapAccount>();
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
List<Contact> contactList = Database.query(qry);
if(contactList.size()<1)
{
String htmlText = 'Oops...Contact not found, Sorry !';
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, htmlText));
}
for(Contact c : Database.query(qry)) {
wrapAccount cw = new wrapAccount(c);
searchResults.add(cw);
}
return null;
}
//--------------CancelAction()--------------
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBSendSurvey');
pr1.setRedirect(true);
return pr1;
}
//--------------processSelected()--------------
@TestVisible public void processSelected()
{
try
{
feedid= (ApexPages.currentPage().getParameters().get('id'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
if(fullnameEncoded !=null || fullnameEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(fullnameEncoded );
fullname = bodyBlob1.toString();
}
else
{
fullname = ApexPages.currentPage().getParameters().get('fullname');
}
emailEncoded = ApexPages.currentPage().getParameters().get('email');
if(emailEncoded !=null || emailEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(emailEncoded );
email = bodyBlob1.toString();
}
else
{
email = ApexPages.currentPage().getParameters().get('email');
}
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
if(phoneEncoded !=null )
{
Blob bodyBlob2 =EncodingUtil.base64Decode(phoneEncoded );
con_number =bodyBlob2.toString();
}
else
{
con_number=ApexPages.currentPage().getParameters().get('con_number');
}
selectedAccounts = new List<Contact>();
for(wrapAccount wrapAccountObj : searchResults)
{
if(wrapAccountObj.selected == true)
{
selectedAccounts.add(wrapAccountObj.acc);
}
}
for(Contact cont : selectedAccounts)
{
contactids.add(cont.Id);
}
feedcon = new List<Feedback_Contacts__c>();
cont = new List<Contact>();
cont = [Select firstname,lastname,email,id,name,MobilePhone from Contact where id in :selectedAccounts];
for(Contact c :cont)
{
string fullname = c.firstname + ' ' + c.lastname;
Blob beforeblob = Blob.valueOf(fullname);
EncodingUtil.urlEncode(fullname,'UTF-8');
string email = c.email;
Blob beforeblob1 = Blob.valueOf(email);
EncodingUtil.urlEncode(email,'UTF-8');
string con_number = c.MobilePhone;
Blob beforeblob2 = Blob.valueOf(con_number);
EncodingUtil.urlEncode(con_number,'UTF-8');
Feedback_Contacts__c fc = new Feedback_Contacts__c();
fc.FeedbackContactName__c= c.Id;
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.FeedbackContactName__c);
fc.FeedBackNo__c = feedid;
// system.debug('++++++++++ConNumber__c++++++++++'+fc.FeedBackNo__c);
fc.test__c = EncodingUtil.base64Encode(beforeblob );
fc.Email__c = EncodingUtil.base64Encode(beforeblob1 );
fc.ConNumber__c= EncodingUtil.base64Encode(beforeblob2 );
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.ConNumber__c+'**'+fc.FeedBackNo__c);
feedcon.add(fc);
//system.debug('++++++++++feedcon++++++++++'+feedcon);
}
insert feedcon;
// system.debug('++++++++++INSERT++++++++++'+feedcon);
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(contactids);
if(!Test.isRunningTest())
{
EmailTemplate templateId = [Select id from EmailTemplate where name = 'SurveyFeedback'];
// system.debug('+++++++++++++++++++++++TEMPLATE ID++++++++++++++++++++++++++++++'+templateId.id);
mail.setTemplateId(templateId.id); //00X55000000E1LO
Messaging.sendEmail(new Messaging.MassEmailMessage[] {mail});
}
String msg1 = 'Mail Sent!';
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.INFO,msg1));
}
catch(Exception e) {
// System.debug('Oops ! Email limit exceeded...Sorry');
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.Error,'Message not sent'));
System.debug('*********************Oops ! Email limit exceeded...Sorry******************************');
}
}
//--------------class wrapAccount--------------
@TestVisible public class wrapAccount {
public Contact acc {get; set;}
public Boolean selected {get; set;}
public wrapAccount(Contact a) {
acc = a;
selected = false;
}
}
//--------------Redirect()--------------
public PageReference Redirect(){
PageReference ref = new PageReference('/apex/SBEmailTemplate');
ref.setRedirect(true);
return ref;
}
public PageReference RedirectCon(){
PageReference ref = new PageReference('/apex/ContactPage');
ref.setRedirect(true);
return ref;
}
}
Thanks & regards,
Satakshi
I am writing a code where i want functionality where if contact are not selected then it will throw error otherwise it will proceed further. i tried a lot. but its not working..
My code is:
public with sharing class ContactSelectClassController
{
public String beforeblob1{get;set;}
//public String conid{get;set;}
public String emailEncoded { get; set; }
public String email { get; set; }
public String phoneEncoded { get; set; }
public String con_number { get; set; }
public String fullname{get;set;}
public String emailName{get;set;}
public String fullnameEncoded{get;set;}
@TestVisible public List<wrapAccount> wrapAccountList {get; set;}
//-----added----
public List<Contact> selectedAccounts{get;set;}
public String feedid;
private List<Id> contactids=new list<Id>();
public List<Contact> cont{get;set;}
public List<Feedback_Contacts__c> feedcon{get;set;}
// ---------for search-------
public List<wrapAccount> searchResults {get;set;}
public List<String> selectP = new List<String>();
//--------------searchText--------------
public string searchText {
get {
if (searchText == null) searchText = ''; // prefill the serach box for ease of use
return searchText;
}
set;
}
//--------------ContactSelectClassController()--------------
public ContactSelectClassController()
{
feedid= (ApexPages.currentPage().getParameters().get('fid'));
emailName= (ApexPages.currentPage().getParameters().get('emailName'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
emailEncoded = ApexPages.currentPage().getParameters().get('email');
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
//-------added--------
if(searchResults == null)
{
searchResults = new List<wrapAccount>(); // init the list if it is null
}
else
{
wrapAccountList.clear(); // clear out the current results if they exist
}
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
for(Contact c : Database.query(qry))
{
wrapAccount wa = new wrapAccount(c);
searchResults.add(wa);
}
//-------added--------
}
//--------------search()--------------
public PageReference search() {
searchResults = new List<wrapAccount>();
String qry = 'select Id,Name,Email,Phone from Contact where firstname LIKE \''+String.escapeSingleQuotes(searchText)+'%\' OR lastname LIKE \''+String.escapeSingleQuotes(searchText)+'%\'';
List<Contact> contactList = Database.query(qry);
if(contactList.size()<1)
{
String htmlText = 'Oops...Contact not found, Sorry !';
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, htmlText));
}
for(Contact c : Database.query(qry)) {
wrapAccount cw = new wrapAccount(c);
searchResults.add(cw);
}
return null;
}
//--------------CancelAction()--------------
public pageReference CancelAction()
{
PageReference pr1 = new PageReference('/apex/SBSendSurvey');
pr1.setRedirect(true);
return pr1;
}
//--------------processSelected()--------------
@TestVisible public void processSelected()
{
try
{
feedid= (ApexPages.currentPage().getParameters().get('id'));
fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
if(fullnameEncoded !=null || fullnameEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(fullnameEncoded );
fullname = bodyBlob1.toString();
}
else
{
fullname = ApexPages.currentPage().getParameters().get('fullname');
}
emailEncoded = ApexPages.currentPage().getParameters().get('email');
if(emailEncoded !=null || emailEncoded =='')
{
Blob bodyBlob1 =EncodingUtil.base64Decode(emailEncoded );
email = bodyBlob1.toString();
}
else
{
email = ApexPages.currentPage().getParameters().get('email');
}
phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
if(phoneEncoded !=null )
{
Blob bodyBlob2 =EncodingUtil.base64Decode(phoneEncoded );
con_number =bodyBlob2.toString();
}
else
{
con_number=ApexPages.currentPage().getParameters().get('con_number');
}
selectedAccounts = new List<Contact>();
for(wrapAccount wrapAccountObj : searchResults)
{
if(wrapAccountObj.selected == true)
{
selectedAccounts.add(wrapAccountObj.acc);
}
}
for(Contact cont : selectedAccounts)
{
contactids.add(cont.Id);
}
feedcon = new List<Feedback_Contacts__c>();
cont = new List<Contact>();
cont = [Select firstname,lastname,email,id,name,MobilePhone from Contact where id in :selectedAccounts];
for(Contact c :cont)
{
string fullname = c.firstname + ' ' + c.lastname;
Blob beforeblob = Blob.valueOf(fullname);
EncodingUtil.urlEncode(fullname,'UTF-8');
string email = c.email;
Blob beforeblob1 = Blob.valueOf(email);
EncodingUtil.urlEncode(email,'UTF-8');
string con_number = c.MobilePhone;
Blob beforeblob2 = Blob.valueOf(con_number);
EncodingUtil.urlEncode(con_number,'UTF-8');
Feedback_Contacts__c fc = new Feedback_Contacts__c();
fc.FeedbackContactName__c= c.Id;
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.FeedbackContactName__c);
fc.FeedBackNo__c = feedid;
// system.debug('++++++++++ConNumber__c++++++++++'+fc.FeedBackNo__c);
fc.test__c = EncodingUtil.base64Encode(beforeblob );
fc.Email__c = EncodingUtil.base64Encode(beforeblob1 );
fc.ConNumber__c= EncodingUtil.base64Encode(beforeblob2 );
//system.debug('++++++++++ConNumber__c++++++++++'+ fc.ConNumber__c+'**'+fc.FeedBackNo__c);
feedcon.add(fc);
//system.debug('++++++++++feedcon++++++++++'+feedcon);
}
insert feedcon;
// system.debug('++++++++++INSERT++++++++++'+feedcon);
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds(contactids);
if(!Test.isRunningTest())
{
EmailTemplate templateId = [Select id from EmailTemplate where name = 'SurveyFeedback'];
// system.debug('+++++++++++++++++++++++TEMPLATE ID++++++++++++++++++++++++++++++'+templateId.id);
mail.setTemplateId(templateId.id); //00X55000000E1LO
Messaging.sendEmail(new Messaging.MassEmailMessage[] {mail});
}
String msg1 = 'Mail Sent!';
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.INFO,msg1));
}
catch(Exception e) {
// System.debug('Oops ! Email limit exceeded...Sorry');
ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.Error,'Message not sent'));
System.debug('*********************Oops ! Email limit exceeded...Sorry******************************');
}
}
//--------------class wrapAccount--------------
@TestVisible public class wrapAccount {
public Contact acc {get; set;}
public Boolean selected {get; set;}
public wrapAccount(Contact a) {
acc = a;
selected = false;
}
}
//--------------Redirect()--------------
public PageReference Redirect(){
PageReference ref = new PageReference('/apex/SBEmailTemplate');
ref.setRedirect(true);
return ref;
}
public PageReference RedirectCon(){
PageReference ref = new PageReference('/apex/ContactPage');
ref.setRedirect(true);
return ref;
}
}
Thanks & regards,
Satakshi
- satakshi
- November 14, 2016
- Like
- 0
link to contact(User) in vf page
Hello, I am writing a code where i want to show contact name as a link. so after clicking on the name i will go into org and edit delete the record. I want this on this line. <apex:column colspan="5" value="{!accWrap.acc.Name}" /> Can anyone help me to achiev this?
<apex:page controller="ContactSelectClassController" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Send Mail</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function ShowHide(){
document.GetElementById('field1').display='block';
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.SearchField{
background: #F6F6F6;
height: 36px;
border-radius: 6px;
border: 1px solid #E1E1E1;
padding: 0 15px;
width: 20%;
font-family: 'Roboto', sans-serif;
font-size: 16px;
font-weight: 400;
}
</style>
<script type="text/javascript">
function selectAllCheckboxes(obj,receivedInputID){
var inputCheckBox = document.getElementsByTagName("input");
for(var i=0; i<inputCheckBox.length; i++){
if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
inputCheckBox[i].checked = obj.checked;
}
}
}
</script>
<script type="text/javascript">
function doSearch() {
searchServer(
document.getElementById("name").value
);
}
</script>
<script type="text/javascript">
function validate() {
{
alert ( "Survey has been sent successfully" );
}
}
</script>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li class="active"><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/00O50000004d9Np">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>All Contacts</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<apex:form >
<!--<apex:commandButton value="Add Contact" action="{!RedirectCon}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-left: 12px !important; margin-bottom: 20px; float: right;"/>-->
<!--<apex:commandButton value="Edit Template" action="{!Redirect}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-bottom: 20px; float: right;"/>-->
<!-- For search -->
<apex:outputLabel for="searchText">Search Contact</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" styleClass="SearchField" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" styleClass="green-btn" style="font-weight: bold;"/>
</apex:panelGroup>
<!-- For search -->
<apex:pageBlock >
<apex:messages style="color:red;font-size:15px;" /><br />
<div style="overflow: scroll; width:100%; height:300px;">
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="overflow:scroll;">
<apex:column colspan="2">
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
</apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
</div>
<!--<apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="margin-top:20px;">
<apex:column colspan="4" value="{!c.Id}" headerValue="Contact"/>
<apex:column colspan="4" value="{!c.Name}" headerValue="Contact Name"/>
<apex:column colspan="4" value="{!c.Email}" headerValue="Email"/>
<apex:column colspan="4" value="{!c.Phone}" headerValue="Phone"/>
</apex:pageBlockTable>-->
</apex:pageBlock>
<div class="feild buttons">
<apex:commandButton value="Send Survey" onclick="validate()" action="{!processSelected}" styleClass="green-btn" rerender="table2" style="margin-top: 20px;font-weight: bold;"/>
<apex:commandButton value="Cancel" action="{!CancelAction}" styleClass="red-btn" style="font-weight: bold;"/>
</div>
</apex:form>
</div>
</section>
<footer class="main-footer">
<ul>
<li> <a href="#">Privacy Policy</a> </li>
<li><a href="#">Terms of Services</a></li>
</ul>
<div class="copyright">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:page>
<apex:page controller="ContactSelectClassController" sidebar="false" showHeader="false" standardStylesheets="false">
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Send Mail</title>
<apex:stylesheet value="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900"/>
<apex:stylesheet value="{!$Resource.SurveyMaster}"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"/ >
<!--<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900" rel="stylesheet" type="text/css">
<link href="assets/css/master.css" rel="stylesheet">-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function ShowHide(){
document.GetElementById('field1').display='block';
}
</script>
<style>
.lookupIcon {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.lookupIconOn {
background-image: url('{!$Resource.LookupIcon}') !important;
height:30px !important;
width:30px !important;
position:absolute !important;
top:6px !important;
right:-25px !important;
}
.SearchField{
background: #F6F6F6;
height: 36px;
border-radius: 6px;
border: 1px solid #E1E1E1;
padding: 0 15px;
width: 20%;
font-family: 'Roboto', sans-serif;
font-size: 16px;
font-weight: 400;
}
</style>
<script type="text/javascript">
function selectAllCheckboxes(obj,receivedInputID){
var inputCheckBox = document.getElementsByTagName("input");
for(var i=0; i<inputCheckBox.length; i++){
if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
inputCheckBox[i].checked = obj.checked;
}
}
}
</script>
<script type="text/javascript">
function doSearch() {
searchServer(
document.getElementById("name").value
);
}
</script>
<script type="text/javascript">
function validate() {
{
alert ( "Survey has been sent successfully" );
}
}
</script>
</head>
<body>
<header class="mainHeader">
<div class="container clear">
<a href="/apex/SBIndex" class="logo"><img src="{!$Resource.MainLogo}" alt=""/></a>
<div class="nav">
<ul>
<li><a href="/apex/SBIndex" class="home"><img src="{!$Resource.HomeIcon}" alt=""/></a></li>
<li><a href="/apex/SBQuestionBank">Question Bank</a></li>
<li><a href="/apex/SBCreateSurvey">Create Survey</a></li>
<li class="active"><a href="/apex/SBSendSurvey">Send Survey</a></li>
<li><a href="/00O50000004d9Np">Report</a></li>
</ul>
</div>
</div>
</header>
<section class="page-name">
<div class="container clear">
<h2>All Contacts</h2>
</div>
</section>
<section class="bodyContainer">
<div class="container clear">
<apex:form >
<!--<apex:commandButton value="Add Contact" action="{!RedirectCon}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-left: 12px !important; margin-bottom: 20px; float: right;"/>-->
<!--<apex:commandButton value="Edit Template" action="{!Redirect}" style="font-weight: bold;display: inline-block !important;padding: 3px 15px !important;line-height: 35px !important;color: #fff !important;font-size: 15px !important;background: #75C181 !important;border-radius: 35px !important; min-width: 125px !important;text-align: center !important; margin-bottom: 20px; float: right;"/>-->
<!-- For search -->
<apex:outputLabel for="searchText">Search Contact</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" styleClass="SearchField" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" styleClass="green-btn" style="font-weight: bold;"/>
</apex:panelGroup>
<!-- For search -->
<apex:pageBlock >
<apex:messages style="color:red;font-size:15px;" /><br />
<div style="overflow: scroll; width:100%; height:300px;">
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="overflow:scroll;">
<apex:column colspan="2">
<apex:facet name="header">
<apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
</apex:facet>
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/>
</apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
</div>
<!--<apex:pageBlockTable value="{!selectedAccounts}" var="c" id="table2" width="100%" cellpadding="0" cellspacing="0" border="0" styleclass="defaultTable addquestionpage" style="margin-top:20px;">
<apex:column colspan="4" value="{!c.Id}" headerValue="Contact"/>
<apex:column colspan="4" value="{!c.Name}" headerValue="Contact Name"/>
<apex:column colspan="4" value="{!c.Email}" headerValue="Email"/>
<apex:column colspan="4" value="{!c.Phone}" headerValue="Phone"/>
</apex:pageBlockTable>-->
</apex:pageBlock>
<div class="feild buttons">
<apex:commandButton value="Send Survey" onclick="validate()" action="{!processSelected}" styleClass="green-btn" rerender="table2" style="margin-top: 20px;font-weight: bold;"/>
<apex:commandButton value="Cancel" action="{!CancelAction}" styleClass="red-btn" style="font-weight: bold;"/>
</div>
</apex:form>
</div>
</section>
<footer class="main-footer">
<ul>
<li> <a href="#">Privacy Policy</a> </li>
<li><a href="#">Terms of Services</a></li>
</ul>
<div class="copyright">© 2016 Survey Builder, All rights reserved. </div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
</apex:page>
- satakshi
- November 07, 2016
- Like
- 0
Variable does not exist: date
Hello,
I am writing a code where when i will create record date should be automatically create into visualforce. i am getting error in this line date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Can anyone please help me to solve this?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public date myDate;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day);
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Thanks & Regards,
Satakshi
I am writing a code where when i will create record date should be automatically create into visualforce. i am getting error in this line date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Can anyone please help me to solve this?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public date myDate;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
date myDate = date.newInstance(obj.Year__c, obj.Month__c, 1);
Integer day = myDate.dayOfYear();
system.assertEquals(294, day);
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Thanks & Regards,
Satakshi
- satakshi
- September 21, 2016
- Like
- 0
How can we add date automatically in the records?
Hi,
I want functionality where according to month and year date will automatically added into record. How can we achive it?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Regards,
Satakshi
I want functionality where according to month and year date will automatically added into record. How can we achive it?
public with sharing class Calender {
public List<DTP__c> mydtpList{get;set;}
public MTP__c obj{get;set;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c where id=:tid ];
dy= obj.NumberOfDays__c;
if(obj.February__c !=null)
{
String str=obj.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= obj.NumberOfDays__c;
dy=str;
}
/*
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(s
System.debug('***************in IF dy size******************'+dy);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
System.debug('***************in else dy size******************'+dy);
}
}*/
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
}
Regards,
Satakshi
- satakshi
- September 20, 2016
- Like
- 0
How to display record from custom object on VF Page?
Hello,
I am inserting some records when i click on custom button. Button is on parent object. I am creating child records of that parent object. I want to show all this records on visualforce page. I have written the code. But nothing is displaing. Can anyone please help me?
VF SHOWDTP
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=============================================
Controller
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Regards,
Satakshi
I am inserting some records when i click on custom button. Button is on parent object. I am creating child records of that parent object. I want to show all this records on visualforce page. I have written the code. But nothing is displaing. Can anyone please help me?
VF SHOWDTP
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=============================================
Controller
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Regards,
Satakshi
- satakshi
- September 20, 2016
- Like
- 0
Records are not displayed
Hello,
I am creating a visualforce page. Where i want to show records. Here MTP is parent object and DTP is child object. I have created code where i am inserting records. I want to show those inserted records on visualforce pages.I have written the code. But records are not displaying.Can anyone please help me with this?
Controller:
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Visualforce Page:
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I am creating a visualforce page. Where i want to show records. Here MTP is parent object and DTP is child object. I have created code where i am inserting records. I want to show those inserted records on visualforce pages.I have written the code. But records are not displaying.Can anyone please help me with this?
Controller:
public class showCalender {
public List<DTP__c> mydtpList {set;get;}
public id tid{get;set;}
public showCalender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
getMydtpList();
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid limit 50];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
Visualforce Page:
<apex:page standardController="MTP__c" extensions="showCalender">
<apex:form >
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
- satakshi
- September 19, 2016
- Like
- 0
Record size is not as required
Hello,
I am writing a code where i have created two formula field which gives me number of days for particular month like this
Formula field= Febrary: To check number of days in febrary
IF( ISPICKVAL( Month__c , 'February') , TEXT(IF( OR((ISPICKVAL(Year__c, '2016')),(ISPICKVAL(Year__c,'2020')), ((ISPICKVAL(Year__c, '2024')))) , 29, 28)), null)
Formula field= NumberOfDays
VALUE(
CASE(Month__c,
"January","31",
"March","31",
"April","30",
"May","31",
"June","30",
"July","31",
"August","31",
"September","30",
"October","31",
"November","30",
"December","31",
""))
My query is i am writing a code where i can create records for those particular days of particular month but by my code i am able to create only 30 records. I want that in picklist field if month is jan then it should create 31 records, if month is feb then accordingly leap year it should create 29/28 days. and if month is of 30 days then it should create 30 records. Now with my code i am able to create only 30 records for any month. In debug statement System.debug('***************dy size******************'+dy); I am getting size 30. Can anyone please help me with this??
Controller:
public with sharing class Calender {
public List<DTP__c> mydtpList {set;get;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
List<MTP__c> obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c];
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
}
}
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
VF PAge:
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
</apex:page>
Thanks & Regards,
Satakshi
I am writing a code where i have created two formula field which gives me number of days for particular month like this
Formula field= Febrary: To check number of days in febrary
IF( ISPICKVAL( Month__c , 'February') , TEXT(IF( OR((ISPICKVAL(Year__c, '2016')),(ISPICKVAL(Year__c,'2020')), ((ISPICKVAL(Year__c, '2024')))) , 29, 28)), null)
Formula field= NumberOfDays
VALUE(
CASE(Month__c,
"January","31",
"March","31",
"April","30",
"May","31",
"June","30",
"July","31",
"August","31",
"September","30",
"October","31",
"November","30",
"December","31",
""))
My query is i am writing a code where i can create records for those particular days of particular month but by my code i am able to create only 30 records. I want that in picklist field if month is jan then it should create 31 records, if month is feb then accordingly leap year it should create 29/28 days. and if month is of 30 days then it should create 30 records. Now with my code i am able to create only 30 records for any month. In debug statement System.debug('***************dy size******************'+dy); I am getting size 30. Can anyone please help me with this??
Controller:
public with sharing class Calender {
public List<DTP__c> mydtpList {set;get;}
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
List<MTP__c> obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c];
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
}
}
List<DTP__c> newdtp= new List<DTP__c>();
System.debug('***************dy size******************'+dy);
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('****************dtp added********************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
public List<DTP__c> getMydtpList(){
List<DTP__c> mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where MTP__c=:tid];
return mydtpList ;
}
//List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
VF PAge:
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
</apex:page>
Thanks & Regards,
Satakshi
- satakshi
- September 19, 2016
- Like
- 0
REQUIRED_FIELD_MISSING error
Hello,
I am writing code to create calender records. I am facing this error.
Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [MTP]: [MTP]
Error is in expression '{!createdtp}' in component <apex:page> in page createdtp: Class.Calender.createdtp: line 40, column 1
An unexpected error has occurred. Your development organization has been notified.
Can anyone please help me to sort it out. MTP is master detail field
My code is:
Controller:
public with sharing class Calender {
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
List<MTP__c> obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c];
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
}
}
List<DTP__c> newdtp= new List<DTP__c>();
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('***************dtp added*******************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
public List<DTP__c> getMydtpList(){
mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where id=:tid];
return mydtpList ;
}
List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
VF Page:
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:page>
Thanks & Regards,
Satakshi
I am writing code to create calender records. I am facing this error.
Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [MTP]: [MTP]
Error is in expression '{!createdtp}' in component <apex:page> in page createdtp: Class.Calender.createdtp: line 40, column 1
An unexpected error has occurred. Your development organization has been notified.
Can anyone please help me to sort it out. MTP is master detail field
My code is:
Controller:
public with sharing class Calender {
public Calender(ApexPages.StandardController controller)
{
tid = ApexPages.currentPage().getParameters().get('id');
System.debug('***************dtp added*******************'+tid);
}
public Decimal dy;
public id tid{get;set;}
public PageReference createdtp() {
System.debug('***************tid tid*******************'+tid);
List<MTP__c> obj = [Select Id, Month__c, Year__c, February__c, NumberOfDays__c from MTP__c];
for(MTP__c mt:obj)
{
if(mt.Month__c=='February')
{
String str=mt.February__c;
dy=Decimal.ValueOf(str);
}
else
{
Decimal str= mt.NumberOfDays__c;
dy=str;
}
}
List<DTP__c> newdtp= new List<DTP__c>();
for(Integer i = 1; i<=dy; i++)
{
DTP__c dt = new DTP__c();
dt.MTP__c=tid;
newdtp.add(dt);
System.debug('***************dtp added*******************'+tid);
//insert newdtp;
}
insert newdtp;
return null;
}
public List<DTP__c> getMydtpList(){
mydtpList =[select Name, Expenses__c, MTP__c, Food_Expenses__c, Date__c, Visit_type__c from DTP__c where id=:tid];
return mydtpList ;
}
List<DTP__c> mydtpList = [select Expenses__c, Name, MTP__c, Food_Expenses__c, Visit_type__c from DTP__c where id=:tid];
}
VF Page:
<apex:page standardController="MTP__c" extensions="Calender" action="{!createdtp}">
<apex:pageBlock title="All Dtp">
<apex:pageblockTable value="{!mydtpList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Date__c}"/>
<apex:column value="{!item.Visit_type__c}"/>
<apex:column value="{!item.Food_Expenses__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:page>
Thanks & Regards,
Satakshi
- satakshi
- September 19, 2016
- Like
- 0
How to create calender on custom button?
Hello,
I am creating a custom button. On this custom button i want calender. Means suppose I want to create events for september 2016 then i will get rows of days in september 2016. If i want create events for october 2016 then i will get rows of days in oct 2016. How is this possible?egards,
Satakshi
I am creating a custom button. On this custom button i want calender. Means suppose I want to create events for september 2016 then i will get rows of days in september 2016. If i want create events for october 2016 then i will get rows of days in oct 2016. How is this possible?egards,
Satakshi
- satakshi
- September 09, 2016
- Like
- 0