-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
29Questions
-
14Replies
MS Doc attachement not working on save operation
I am getting an error on VF page. An error is System.VisualforceException: Subscript is invalid because list is empty which is occurred in saveCAR method on Blob docBlob = docPage.getContent(); I have created two VF page one for saving record and another VF page is generate a ms doc file (it's work fine when I pass the accountId and carId in URL or when I define static accountID and carId in saveCAR Method).
<apex:page standardController="CAR__c" extensions="CAReportDocAE" contentType="application/msWord#CAReport.doc" cache="true" standardStylesheets="false" showheader="false"> <html> <head> <style> @page Section1{ size:8.5in 11in; mso-page-orientation:portrait; margin:.5in .5in .5in .5in ; mso-header-margin:1.0in; mso-footer-margin:.5in; } body { font-family: "Segoe UI",Arial,sans-serif; } .heading{ background-color:#2c5ea2; color:#fff; padding: 10px 5px 10px 5px; } .tableBorder{ border:1px solid black;border-collapse:collapse; width:100%; } .textAlign{ text-align:justify; } .pagebreak { display:block; page-break-after:always; margin-top:50px; } </style> </head> <div> <div> <p class="heading">INSTRUCTION</p> <ol> <li>Fill out CA, current Date, and Assignee Name.</li> <li>Fill out event description and client involved. Additional comments should be included as necessary to aid in the resolution of the issue.</li> </ol> </div> <div style="background-color:#ccc;"> <table class="tableBorder"> <tr class="tableBorder"> <td>CAPA #: {!newCarList[0].CA__c}</td> </tr> <tr class="tableBorder"> <td>Date: {!newCarList[0].Date__c}</td> </tr> <tr class="tableBorder"> <td>Assignee Name:{!newCarList[0].Assignee_Name__c}</td> </tr> <tr> <td> <tr><td>Event Description: </td></tr> <tr><td>What Found:{!newCarList[0].WFound__c}</td></tr> <tr><td>When {!newCarList[0].When__c}</td></tr> <tr><td>Found: Who {!newCarList[0].FWho__c}</td></tr> </td> </tr> </table> </div> <div> <p class="heading">INSTRUCTION</p> <ol> <li><p class="textAlign">Complete containment actions within 24 hours of receipt of this CAR.</p></li> </ol> </div> <br clear="all" style="mso-special-character:line-break;page-break-before:always;"/> <div class="pagebreak"> <table class="tableBorder"> <tr> <td> <tr> <td> Assigned Team Members: </td> </tr> </td> </tr> <tr class="tableBorder"> <td>Additional Comments:</td> </tr> </table> </div> <div style="margin-top:50px;"> <table class="tableBorder" style="margin-bottom: -1px;"> <tr class="tableBorder" style="background-color:#ccc;"> <td><i >*The following are approved changes incorporated into the revision numbers indicated </i></td> </tr> </table> <table class="tableBorder"> <tr class="tableBorder"> <td class="tableBorder" style="width:10%;"><b>Revision</b></td> <td class="tableBorder"><b>Description of Change</b></td> </tr> <tr class="tableBorder"> <td class="tableBorder" style="width:10%;">HI</td> <td class="tableBorder" >Hi</td> </tr> <tr class="tableBorder"> <td class="tableBorder" style="width:10%;">HI</td> <td class="tableBorder">HI</td> </tr> </table> </div> </div> </html> </apex:page>
public with sharing class CAReportDocAE{ public List<CAR__c> newCarList {get;set;} public String accountId {get;set;} public String carId {get;set;} public CAReportDocAE(ApexPages.StandardController controller) { newCarList = new List<CAR__c>(); accountId = ApexPages.currentPage().getParameters().get('aid'); carId = ApexPages.currentPage().getParameters().get('cid'); Initalization(); } public void Initalization(){ newCarList = [Select CA__c,Date__c,Assignee_Name__c,WFound__c,When__c,FWho__c from CAR__c where id=:carId and Account__c=:accountId limit 1]; } }
<apex:page standardController="CAR__c" extensions="CAReportAE" > <apex:form id="IdFrm" > <apex:sectionHeader title="CAR Edit" subtitle="New CAR"/> <apex:panelGroup ><apex:pageMessages id="error"/></apex:panelGroup> <apex:pageBlock id="IdPBlock" title="CAR Edit" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!saveCAR}"/> <apex:commandButton value="Cancel" action="{!cancelMetod}" immediate="true" /> </apex:pageBlockButtons> <apex:pageBlockSection id="IdPBSection" title="Information" columns="1"> <apex:pageBlockSectionItem > <apex:outputText value="Account"/> <apex:inputField value="{!newCar.Account__c}" required="true"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="CAPA #"/> <apex:inputField value="{!newCar.CA__c}" required="true"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="Date"/> <apex:inputField value="{!newCar.Date__c}" required="true"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="Assignee Name"/> <apex:inputField value="{!newCar.Assignee_Name__c}" required="true"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Event Description"> <apex:pageBlockSectionItem > <apex:outputText value="What Found"/> <apex:inputField value="{!newCar.WFound__c}" style="width:80%;"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="When"/> <apex:inputField value="{!newCar.When__c}" style="width:80%;"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="Found Who"/> <apex:inputField value="{!newCar.FWho__c}" style="width:80%;"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
public with sharing class CAReportAE { public CAR__c newCar {get;set;} public String accountId {get;set;} public String carId {get;set;} public CAReportAE(ApexPages.StandardController controller) { newCar = new CAR__c(); accountId = ApexPages.currentPage().getParameters().get('aid'); newCar.Account__c=accountId; } public PageReference saveCAR(){ if(accountId!=null){ try{ insert newCar; carId = newCar.Id; attachDOC(); return new PageReference('/' + accountId); }catch(DMLException e){ ApexPages.addMessages(e); ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Due to miscellaneous reasons the save operation failed.'); ApexPages.addMessage(msg); return null; } }else{ ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Warning, 'Please select at Account.'); ApexPages.addMessage(msg); } return null; } public PageReference cancelMetod() { return new PageReference('/' + accountId); } public void attachDOC(){ PageReference docPage = Page.CAReportDoc; docPage.getParameters().put('cid',carId); docPage.getParameters().put('aid',accountId); Blob docBlob = docPage.getContent(); Attachment attachDoc = new Attachment(parentId = accountId, Name = 'CAR.doc', body = docBlob); insert attachDoc; } }
<apex:page standardController="CAR__c" extensions="CAReportDocAE" contentType="application/msWord#CAReport.doc" cache="true" standardStylesheets="false" showheader="false"> <html> <head> <style> @page Section1{ size:8.5in 11in; mso-page-orientation:portrait; margin:.5in .5in .5in .5in ; mso-header-margin:1.0in; mso-footer-margin:.5in; } body { font-family: "Segoe UI",Arial,sans-serif; } .heading{ background-color:#2c5ea2; color:#fff; padding: 10px 5px 10px 5px; } .tableBorder{ border:1px solid black;border-collapse:collapse; width:100%; } .textAlign{ text-align:justify; } .pagebreak { display:block; page-break-after:always; margin-top:50px; } </style> </head> <div> <div> <p class="heading">INSTRUCTION</p> <ol> <li>Fill out CA, current Date, and Assignee Name.</li> <li>Fill out event description and client involved. Additional comments should be included as necessary to aid in the resolution of the issue.</li> </ol> </div> <div style="background-color:#ccc;"> <table class="tableBorder"> <tr class="tableBorder"> <td>CAPA #: {!newCarList[0].CA__c}</td> </tr> <tr class="tableBorder"> <td>Date: {!newCarList[0].Date__c}</td> </tr> <tr class="tableBorder"> <td>Assignee Name:{!newCarList[0].Assignee_Name__c}</td> </tr> <tr> <td> <tr><td>Event Description: </td></tr> <tr><td>What Found:{!newCarList[0].WFound__c}</td></tr> <tr><td>When {!newCarList[0].When__c}</td></tr> <tr><td>Found: Who {!newCarList[0].FWho__c}</td></tr> </td> </tr> </table> </div> <div> <p class="heading">INSTRUCTION</p> <ol> <li><p class="textAlign">Complete containment actions within 24 hours of receipt of this CAR.</p></li> </ol> </div> <br clear="all" style="mso-special-character:line-break;page-break-before:always;"/> <div class="pagebreak"> <table class="tableBorder"> <tr> <td> <tr> <td> Assigned Team Members: </td> </tr> </td> </tr> <tr class="tableBorder"> <td>Additional Comments:</td> </tr> </table> </div> <div style="margin-top:50px;"> <table class="tableBorder" style="margin-bottom: -1px;"> <tr class="tableBorder" style="background-color:#ccc;"> <td><i >*The following are approved changes incorporated into the revision numbers indicated </i></td> </tr> </table> <table class="tableBorder"> <tr class="tableBorder"> <td class="tableBorder" style="width:10%;"><b>Revision</b></td> <td class="tableBorder"><b>Description of Change</b></td> </tr> <tr class="tableBorder"> <td class="tableBorder" style="width:10%;">HI</td> <td class="tableBorder" >Hi</td> </tr> <tr class="tableBorder"> <td class="tableBorder" style="width:10%;">HI</td> <td class="tableBorder">HI</td> </tr> </table> </div> </div> </html> </apex:page>
public with sharing class CAReportDocAE{ public List<CAR__c> newCarList {get;set;} public String accountId {get;set;} public String carId {get;set;} public CAReportDocAE(ApexPages.StandardController controller) { newCarList = new List<CAR__c>(); accountId = ApexPages.currentPage().getParameters().get('aid'); carId = ApexPages.currentPage().getParameters().get('cid'); Initalization(); } public void Initalization(){ newCarList = [Select CA__c,Date__c,Assignee_Name__c,WFound__c,When__c,FWho__c from CAR__c where id=:carId and Account__c=:accountId limit 1]; } }
<apex:page standardController="CAR__c" extensions="CAReportAE" > <apex:form id="IdFrm" > <apex:sectionHeader title="CAR Edit" subtitle="New CAR"/> <apex:panelGroup ><apex:pageMessages id="error"/></apex:panelGroup> <apex:pageBlock id="IdPBlock" title="CAR Edit" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!saveCAR}"/> <apex:commandButton value="Cancel" action="{!cancelMetod}" immediate="true" /> </apex:pageBlockButtons> <apex:pageBlockSection id="IdPBSection" title="Information" columns="1"> <apex:pageBlockSectionItem > <apex:outputText value="Account"/> <apex:inputField value="{!newCar.Account__c}" required="true"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="CAPA #"/> <apex:inputField value="{!newCar.CA__c}" required="true"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="Date"/> <apex:inputField value="{!newCar.Date__c}" required="true"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="Assignee Name"/> <apex:inputField value="{!newCar.Assignee_Name__c}" required="true"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Event Description"> <apex:pageBlockSectionItem > <apex:outputText value="What Found"/> <apex:inputField value="{!newCar.WFound__c}" style="width:80%;"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="When"/> <apex:inputField value="{!newCar.When__c}" style="width:80%;"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputText value="Found Who"/> <apex:inputField value="{!newCar.FWho__c}" style="width:80%;"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
public with sharing class CAReportAE { public CAR__c newCar {get;set;} public String accountId {get;set;} public String carId {get;set;} public CAReportAE(ApexPages.StandardController controller) { newCar = new CAR__c(); accountId = ApexPages.currentPage().getParameters().get('aid'); newCar.Account__c=accountId; } public PageReference saveCAR(){ if(accountId!=null){ try{ insert newCar; carId = newCar.Id; attachDOC(); return new PageReference('/' + accountId); }catch(DMLException e){ ApexPages.addMessages(e); ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Due to miscellaneous reasons the save operation failed.'); ApexPages.addMessage(msg); return null; } }else{ ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Warning, 'Please select at Account.'); ApexPages.addMessage(msg); } return null; } public PageReference cancelMetod() { return new PageReference('/' + accountId); } public void attachDOC(){ PageReference docPage = Page.CAReportDoc; docPage.getParameters().put('cid',carId); docPage.getParameters().put('aid',accountId); Blob docBlob = docPage.getContent(); Attachment attachDoc = new Attachment(parentId = accountId, Name = 'CAR.doc', body = docBlob); insert attachDoc; } }
-
- Deepak Chouhan
- December 22, 2016
- Like
- 0
- Continue reading or reply
Visualforce custom Validation
Hi All,
I trying to custom bootstrap form validation on VF page but it's not working.can any one help me. what am i mistake.
<apex:page docType="html-5.0" applyBodyTag="true" applyHtmlTag="true" showHeader="false" standardStylesheets="false">
<head>
<apex:stylesheet value="{!URLFOR($Resource.customValidation,'validation/formValidation.min.css')}"/>
<apex:stylesheet value="{!URLFOR($Resource.bootstrap_SFOne,'bootstrap-sf1/dist/css/bootstrap.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.wizard,'js/jquery-1.10.2.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.wizard,'js/bootstrap.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.customValidation,'validation/formValidation.min.js')}"/>
</head>
<body>
<apex:form id="frm">
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:inputtext html-name="fname" styleClass="form-control custom-input" value={!firstname}/>
<apex:inputtext html-name="lname" styleClass="form-control custom-input" value="{!lastname}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript">
$(document).ready(function(){
$('#frm').formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields:{
fname:{
validators:{
message:'first name is reuired'
}
},
lname:{
validators:{
message:'last name is reuired'
}
},
}
});
});
</script>
</body>
</apex:page>
I trying to custom bootstrap form validation on VF page but it's not working.can any one help me. what am i mistake.
<apex:page docType="html-5.0" applyBodyTag="true" applyHtmlTag="true" showHeader="false" standardStylesheets="false">
<head>
<apex:stylesheet value="{!URLFOR($Resource.customValidation,'validation/formValidation.min.css')}"/>
<apex:stylesheet value="{!URLFOR($Resource.bootstrap_SFOne,'bootstrap-sf1/dist/css/bootstrap.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.wizard,'js/jquery-1.10.2.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.wizard,'js/bootstrap.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.customValidation,'validation/formValidation.min.js')}"/>
</head>
<body>
<apex:form id="frm">
<apex:pageBlock >
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:inputtext html-name="fname" styleClass="form-control custom-input" value={!firstname}/>
<apex:inputtext html-name="lname" styleClass="form-control custom-input" value="{!lastname}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:commandButton value="save" action="{!save}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript">
$(document).ready(function(){
$('#frm').formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields:{
fname:{
validators:{
message:'first name is reuired'
}
},
lname:{
validators:{
message:'last name is reuired'
}
},
}
});
});
</script>
</body>
</apex:page>
-
- Deepak Chouhan
- March 17, 2015
- Like
- 0
- Continue reading or reply
Visualforce: range slider
Hi All,
I have wrote some code for range slider in VF and I have little bit knowledge in JS. My question is
1. I want to change step based on some criteria for min value and max values. In my code step is working proper for max value but step for min value is not working.
2. And i want to change dynamic value for slider. if min value is 10000 then max value should be 50000.
pls help me out
//my code is------------
<apex:page >
<head>
<apex:stylesheet value="{!URLFOR($Resource.bootstrap_SFOne,'bootstrap-sf1/dist/css/bootstrap.css')}"/>
<apex:stylesheet value="{!URLFOR($Resource.SliderCSSJS,'jquery/jquery-ui-1.7.2.custom.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.SliderCSSJS,'jquery/jquery-1.3.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.SliderCSSJS,'jquery/jquery-ui-1.7.2.custom.min.js')}"/>
<script type="text/javascript">
$(document).ready(function(){
$("#slider-range").slider({
range: true,
min: 0,
max: 20000000,
step: 1000,
values: [0,1000000],
slide: function(event, ui){
$("#minBudget").html('$' + $("#slider-range").slider("values", 0));
$("#maxBudget").html('$' + $("#slider-range").slider("values", 1));
var step = $('#slider-range').slider('option', 'step');
if(ui.values[0]<50000){
$('#slider-range').slider('option', 'step', 5000);
}else{
$('#slider-range').slider('option', 'step', 10000);
}
if(ui.values[1]<50000){
$('#slider-range').slider('option', 'step', 5000);
}else if(ui.values[1]>=50000 && ui.values[1]<100000){
$('#slider-range').slider('option', 'step', 10000);
}else if(ui.values[1]>=100000 && ui.values[1]<2500000){
$('#slider-range').slider('option', 'step', 100000);
}else if(ui.values[1]>=2500000 && ui.values[1]<5000000){
$('#slider-range').slider('option', 'step', 200000);
}else if(ui.values[1]>=5000000 && ui.values[1]<10000000){
$('#slider-range').slider('option', 'step', 500000);
}else{
$('#slider-range').slider('option', 'step', 1000000);
}
}
});
$("#minBudget").html('$' + $("#slider-range").slider("values", 0));
$("#maxBudget").html('$' + $("#slider-range").slider("values", 1));
});
</script>
</head>
<body>
<div id="slider-range" style="font-size: 90%; margin-top: 5em;"></div>
<div id="minBudget" style="margin-top: 1.5em;float:left"></div>
<div id="maxBudget" style="margin-top: 1.5em;float:right"></div>
</body>
<style type="text/css">
.ui-slider-horizontal .ui-slider-handle {
top: -0.75em;
}
.ui-slider .ui-slider-handle{
height:2em;
border-radius: 2em;
width: 1.9em;
}
.ui-state-default, .ui-widget-content .ui-state-default {
border: 1px solid #E10707;
background: repeat-x scroll 50% 50% #f39b9b;
font-weight: bold;
color: #1C94C4;
outline: medium none;
}
.ui-state-hover, .ui-widget-content, .ui-state-hover, .ui-state-focus, .ui-state-content, .ui-state-focus {
border: 1px solid #125189;
background-color:#78b7ef;
}
.ui-slider .ui-slider-handle:hover{
border: 1px solid #125189;
background: repeat-x scroll 50% 50% #78b7ef;
}
.ui-slider-horizontal .ui-slider-range {
top: -1px;
height: 118%;
}
</style>
</apex:page>
I have wrote some code for range slider in VF and I have little bit knowledge in JS. My question is
1. I want to change step based on some criteria for min value and max values. In my code step is working proper for max value but step for min value is not working.
2. And i want to change dynamic value for slider. if min value is 10000 then max value should be 50000.
pls help me out
//my code is------------
<apex:page >
<head>
<apex:stylesheet value="{!URLFOR($Resource.bootstrap_SFOne,'bootstrap-sf1/dist/css/bootstrap.css')}"/>
<apex:stylesheet value="{!URLFOR($Resource.SliderCSSJS,'jquery/jquery-ui-1.7.2.custom.css')}"/>
<apex:includeScript value="{!URLFOR($Resource.SliderCSSJS,'jquery/jquery-1.3.2.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.SliderCSSJS,'jquery/jquery-ui-1.7.2.custom.min.js')}"/>
<script type="text/javascript">
$(document).ready(function(){
$("#slider-range").slider({
range: true,
min: 0,
max: 20000000,
step: 1000,
values: [0,1000000],
slide: function(event, ui){
$("#minBudget").html('$' + $("#slider-range").slider("values", 0));
$("#maxBudget").html('$' + $("#slider-range").slider("values", 1));
var step = $('#slider-range').slider('option', 'step');
if(ui.values[0]<50000){
$('#slider-range').slider('option', 'step', 5000);
}else{
$('#slider-range').slider('option', 'step', 10000);
}
if(ui.values[1]<50000){
$('#slider-range').slider('option', 'step', 5000);
}else if(ui.values[1]>=50000 && ui.values[1]<100000){
$('#slider-range').slider('option', 'step', 10000);
}else if(ui.values[1]>=100000 && ui.values[1]<2500000){
$('#slider-range').slider('option', 'step', 100000);
}else if(ui.values[1]>=2500000 && ui.values[1]<5000000){
$('#slider-range').slider('option', 'step', 200000);
}else if(ui.values[1]>=5000000 && ui.values[1]<10000000){
$('#slider-range').slider('option', 'step', 500000);
}else{
$('#slider-range').slider('option', 'step', 1000000);
}
}
});
$("#minBudget").html('$' + $("#slider-range").slider("values", 0));
$("#maxBudget").html('$' + $("#slider-range").slider("values", 1));
});
</script>
</head>
<body>
<div id="slider-range" style="font-size: 90%; margin-top: 5em;"></div>
<div id="minBudget" style="margin-top: 1.5em;float:left"></div>
<div id="maxBudget" style="margin-top: 1.5em;float:right"></div>
</body>
<style type="text/css">
.ui-slider-horizontal .ui-slider-handle {
top: -0.75em;
}
.ui-slider .ui-slider-handle{
height:2em;
border-radius: 2em;
width: 1.9em;
}
.ui-state-default, .ui-widget-content .ui-state-default {
border: 1px solid #E10707;
background: repeat-x scroll 50% 50% #f39b9b;
font-weight: bold;
color: #1C94C4;
outline: medium none;
}
.ui-state-hover, .ui-widget-content, .ui-state-hover, .ui-state-focus, .ui-state-content, .ui-state-focus {
border: 1px solid #125189;
background-color:#78b7ef;
}
.ui-slider .ui-slider-handle:hover{
border: 1px solid #125189;
background: repeat-x scroll 50% 50% #78b7ef;
}
.ui-slider-horizontal .ui-slider-range {
top: -1px;
height: 118%;
}
</style>
</apex:page>
-
- Deepak Chouhan
- March 12, 2015
- Like
- 0
- Continue reading or reply
create event using apex for test trigger
Hi,
I have create after trigger for event and i want to write a test method for test trigger but trigger code coverage is 0%. i have test this code into execyte anonymous block but lead is crated but event not. please help me out.
@isTest
private class TestEventTrigger {
static testMethod void eventTestMethod() {
lead l = new lead();
event e = new event();
List<Id> leadIds=new List<Id>();
l.Rep__c='Vivek Jain';
l.LastName='Method';
l.Company='Test';
l.Status='Open';
l.Webinar_Status__c='Missed';
l.Webinar_Status_Value__c=decimal.valueOf('2');
l.Start_Date__c=datetime.now();
l.End_Date__c=datetime.now();
insert l;
e.WhatId=l.Id;
e.OwnerId='00590000001Q5ViAAK';
e.G2W4SF__Webinar_Status__c='Missing';
e.G2W4SF__G2W_Attendance_Minutes__c=decimal.valueOf('2');
e.StartDateTime=datetime.now();
e.EndDateTime=datetime.now();
insert e;
leadIds.add(e.WhoId);
List<Lead> leadUpdate=[SELECT End_Date__c,Id,Start_Date__c,Webinar_Status_Value__c,Webinar_Status__c FROM Lead WHERE Id IN :leadIds AND IsConverted=FALSE];
for(Lead lds:leadUpdate){
lds.Webinar_Status_Value__c=e.G2W4SF__G2W_Attendance_Minutes__c;
lds.Webinar_Status__c=e.G2W4SF__Webinar_Status__c;
lds.Start_Date__c=e.StartDateTime;
lds.End_Date__c=e.EndDateTime;
}
try{
update leadUpdate;
}catch(DMLException e){
system.debug('Leads were not all properly updated. Error: '+e);
}
}
}
I have create after trigger for event and i want to write a test method for test trigger but trigger code coverage is 0%. i have test this code into execyte anonymous block but lead is crated but event not. please help me out.
@isTest
private class TestEventTrigger {
static testMethod void eventTestMethod() {
lead l = new lead();
event e = new event();
List<Id> leadIds=new List<Id>();
l.Rep__c='Vivek Jain';
l.LastName='Method';
l.Company='Test';
l.Status='Open';
l.Webinar_Status__c='Missed';
l.Webinar_Status_Value__c=decimal.valueOf('2');
l.Start_Date__c=datetime.now();
l.End_Date__c=datetime.now();
insert l;
e.WhatId=l.Id;
e.OwnerId='00590000001Q5ViAAK';
e.G2W4SF__Webinar_Status__c='Missing';
e.G2W4SF__G2W_Attendance_Minutes__c=decimal.valueOf('2');
e.StartDateTime=datetime.now();
e.EndDateTime=datetime.now();
insert e;
leadIds.add(e.WhoId);
List<Lead> leadUpdate=[SELECT End_Date__c,Id,Start_Date__c,Webinar_Status_Value__c,Webinar_Status__c FROM Lead WHERE Id IN :leadIds AND IsConverted=FALSE];
for(Lead lds:leadUpdate){
lds.Webinar_Status_Value__c=e.G2W4SF__G2W_Attendance_Minutes__c;
lds.Webinar_Status__c=e.G2W4SF__Webinar_Status__c;
lds.Start_Date__c=e.StartDateTime;
lds.End_Date__c=e.EndDateTime;
}
try{
update leadUpdate;
}catch(DMLException e){
system.debug('Leads were not all properly updated. Error: '+e);
}
}
}
-
- Deepak Chouhan
- February 20, 2015
- Like
- 0
- Continue reading or reply
Show VF page only custom profile....
Hi All,
I have created custom account VF page. My question is i want to show standard account page only System Admin profile and rest of all profile custom VF page.
pls help me out
I have created custom account VF page. My question is i want to show standard account page only System Admin profile and rest of all profile custom VF page.
pls help me out
-
- Deepak Chouhan
- February 10, 2015
- Like
- 0
- Continue reading or reply
Site.com : binding custom html input with custom object.
Hi All,
I have working with Site.com. i want to binding html page with custome object. i have create some input field in site.com template. it possibel to stored data into custome object using site.com html page templates.
pls help me out.....
I have working with Site.com. i want to binding html page with custome object. i have create some input field in site.com template. it possibel to stored data into custome object using site.com html page templates.
pls help me out.....
-
- Deepak Chouhan
- February 03, 2015
- Like
- 1
- Continue reading or reply
Custom validation in Visualforce Page on Edit button
Hi,
I have created visualforce page with standard object (account). my question is whenever i click the edit button on detail page i want to disabled some required field and user can't edit those field.
pls help me out.
I have created visualforce page with standard object (account). my question is whenever i click the edit button on detail page i want to disabled some required field and user can't edit those field.
pls help me out.
-
- Deepak Chouhan
- January 15, 2015
- Like
- 0
- Continue reading or reply
mobile no validation onkeyup
Hi, i have created a inputfield for mobileno. i want to keyup event on mobile field without page reload. with boolean return type
pls help me out
pls help me out
-
- Deepak Chouhan
- December 22, 2014
- Like
- 0
- Continue reading or reply
div show or hide in visualforce page but page reload when button onclick event
Hi,
i have crated vf page with 6 div section..
$(document).ready(function () {
$('.step2, .step3, .step4, .step5, .step6').hide();
});
function showStep(step_name){
if(is_validate && is_valid){
$('.step, .step2, .step3, .step4, .step5, .step6').hide();
$('.'+step_name).fadeIn();
}
}
<div class"step">
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step2">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step3">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
and so on
when i click the next button vf page reload....
pls help me out
i have crated vf page with 6 div section..
$(document).ready(function () {
$('.step2, .step3, .step4, .step5, .step6').hide();
});
function showStep(step_name){
if(is_validate && is_valid){
$('.step, .step2, .step3, .step4, .step5, .step6').hide();
$('.'+step_name).fadeIn();
}
}
<div class"step">
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step2">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step3">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
and so on
when i click the next button vf page reload....
pls help me out
-
- Deepak Chouhan
- December 20, 2014
- Like
- 0
- Continue reading or reply
visualforce
Hi,
I have create a picklist and fieldset. i want to control fieldset by picklist without page reload when i will change the picklist value fieldset must be change.
pls help me out
I have create a picklist and fieldset. i want to control fieldset by picklist without page reload when i will change the picklist value fieldset must be change.
pls help me out
-
- Deepak Chouhan
- December 13, 2014
- Like
- 0
- Continue reading or reply
visualforce
Hi,
I have create picklist and multipicklist. multipicklist dependent to picklist. in my project picklist showing in button and multipicklist in checkbox format. how to checkbox box dependable to button click event.
pls help me out.
I have create picklist and multipicklist. multipicklist dependent to picklist. in my project picklist showing in button and multipicklist in checkbox format. how to checkbox box dependable to button click event.
pls help me out.
-
- Deepak Chouhan
- December 13, 2014
- Like
- 0
- Continue reading or reply
visualforce multi picklist
Hi
i have created two multi picklist. 1 st contain dates__c (1-30) and 2nd daysofmonth__c (sun - sat).
i want to controlling dayofmonth__c multipick list by dates__c. i want to select 1-10 and output will be Sun and Mon. 2nd case 11-20 then output will be Tue-Thu and 21-30 then output will be Fri-Sat.
pls help me out
i have created two multi picklist. 1 st contain dates__c (1-30) and 2nd daysofmonth__c (sun - sat).
i want to controlling dayofmonth__c multipick list by dates__c. i want to select 1-10 and output will be Sun and Mon. 2nd case 11-20 then output will be Tue-Thu and 21-30 then output will be Fri-Sat.
pls help me out
-
- Deepak Chouhan
- December 12, 2014
- Like
- 0
- Continue reading or reply
picklist onchange event
Hi,
i have create picklist. it contain 1 to 10 number. i want to display no of apex:inputfile onchange event using jquary.
pls help me out
i have create picklist. it contain 1 to 10 number. i want to display no of apex:inputfile onchange event using jquary.
pls help me out
-
- Deepak Chouhan
- December 09, 2014
- Like
- 0
- Continue reading or reply
Chckmarx Issue : Bulkify apex methods using collections In methods
Hi,
i having some problem in salesforce checkmarx report. this generated one waring : Bulkify_Apex_Methods_Using_Collections_In_Methods in particular code
interested_prop = String.escapeSingleQuotes(interested_prop);
String qry = 'select ' + sObjectUtility.sObjectFields('srex__Matches__c') +' Id from Matches__c';
string whereString = ' where Interested_in_Dealing__c = false';
whereString += ' AND ('+ sObjName + ' =: propid ';
whereString += ' OR '+ lookup2 +' =: propid )';
whereString += ' AND ('+ sObjName + ' =: interested_prop ';
whereString += ' OR '+ lookup2 +' =: interested_prop )';
list<Matches__c> matches = Database.query(String.escapeSingleQuotes(qry)+String.escapeSingleQuotes(whereString));
if(matches.size() > 0){
matches[0].Interested_in_Dealing__c = true;
try{
update matches;
}catch(Exception ex){
system.debug('Error occurred while perfoming DML Operation :::::'+ ex.getMessage());
}
}else{
Matches__c new_match = new Matches__c();
new_match.put(sObjName, prop_id);
new_match.put(lookup2 , interested_prop);
new_match.Interested_in_Dealing__c = true;
try{
List<Matches__c> matchlst =
new List<Matches__c>();
matchlst.add(new_match);
insert matchlst;
}catch(Exception ex){
system.debug('Error occurred while perfoming DML Operation :::::'+ ex.getMessage());
}
}
pls help me out
i having some problem in salesforce checkmarx report. this generated one waring : Bulkify_Apex_Methods_Using_Collections_In_Methods in particular code
interested_prop = String.escapeSingleQuotes(interested_prop);
String qry = 'select ' + sObjectUtility.sObjectFields('srex__Matches__c') +' Id from Matches__c';
string whereString = ' where Interested_in_Dealing__c = false';
whereString += ' AND ('+ sObjName + ' =: propid ';
whereString += ' OR '+ lookup2 +' =: propid )';
whereString += ' AND ('+ sObjName + ' =: interested_prop ';
whereString += ' OR '+ lookup2 +' =: interested_prop )';
list<Matches__c> matches = Database.query(String.escapeSingleQuotes(qry)+String.escapeSingleQuotes(whereString));
if(matches.size() > 0){
matches[0].Interested_in_Dealing__c = true;
try{
update matches;
}catch(Exception ex){
system.debug('Error occurred while perfoming DML Operation :::::'+ ex.getMessage());
}
}else{
Matches__c new_match = new Matches__c();
new_match.put(sObjName, prop_id);
new_match.put(lookup2 , interested_prop);
new_match.Interested_in_Dealing__c = true;
try{
List<Matches__c> matchlst =
new List<Matches__c>();
matchlst.add(new_match);
insert matchlst;
}catch(Exception ex){
system.debug('Error occurred while perfoming DML Operation :::::'+ ex.getMessage());
}
}
pls help me out
-
- Deepak Chouhan
- November 29, 2014
- Like
- 0
- Continue reading or reply
Lightning
Hi,
i have create a page into Lightning. State and Country Picklist value visible into lightning picklist and select option stored into custom objects.
pls help me out.
i have create a page into Lightning. State and Country Picklist value visible into lightning picklist and select option stored into custom objects.
pls help me out.
-
- Deepak Chouhan
- November 28, 2014
- Like
- 0
- Continue reading or reply
trigger : object1 field value stored into object2
Hi,
i have create 2 object Test1 and Test2
Test1 fields : Id auto and name
Test2 fields : Id auto, Test1 Id, Test1Name and status Picklist (Yes,No)
- i want to write a triggen on Test1
- when i insert or update value in Test1 same value insert into Test2
- when i update a value in Test1 same value update on Test2.
i have create 2 object Test1 and Test2
Test1 fields : Id auto and name
Test2 fields : Id auto, Test1 Id, Test1Name and status Picklist (Yes,No)
- i want to write a triggen on Test1
- when i insert or update value in Test1 same value insert into Test2
- when i update a value in Test1 same value update on Test2.
-
- Deepak Chouhan
- November 26, 2014
- Like
- 0
- Continue reading or reply
force.com sites
Hi,
i have created web page on Visualfoce. this page associated to the public site.
when i enter some data into model visible only public page. it not visible recent item and sobject but it is exist in sobject.
i want see all sobject data.
i have created web page on Visualfoce. this page associated to the public site.
when i enter some data into model visible only public page. it not visible recent item and sobject but it is exist in sobject.
i want see all sobject data.
-
- Deepak Chouhan
- October 06, 2014
- Like
- 0
- Continue reading or reply
responsive popup box in visualforce
HI,
I want to open responsive popup box on button click
Regard's
Deepak
I want to open responsive popup box on button click
Regard's
Deepak
-
- Deepak Chouhan
- October 01, 2014
- Like
- 0
- Continue reading or reply
show & hide apex:outputPanel on html button click
Hi,
I am using three html buttons like
<button type="button" class="btn btn-primary" id="btnperson" value="person" >Person</button>
<button type="button" class="btn btn-primary" id="btnbusiness" value="business">Business</button>
<button type="button" class="btn btn-primary" id="btnvisit" value="lastvisit">Last Visit</button>
into VF page and i want to show & hide apex:outputPanel on button click.
Regard's
Deepak
I am using three html buttons like
<button type="button" class="btn btn-primary" id="btnperson" value="person" >Person</button>
<button type="button" class="btn btn-primary" id="btnbusiness" value="business">Business</button>
<button type="button" class="btn btn-primary" id="btnvisit" value="lastvisit">Last Visit</button>
into VF page and i want to show & hide apex:outputPanel on button click.
Regard's
Deepak
-
- Deepak Chouhan
- October 01, 2014
- Like
- 0
- Continue reading or reply
visualforce web page
Hi,
I am createing bootstrap web page into VF page. i have add some animation and boostrap property. but it is not work proper way.
i have add related css and js file into static resorce.
pls anybody can help me.....
Regard's
Deepak
I am createing bootstrap web page into VF page. i have add some animation and boostrap property. but it is not work proper way.
i have add related css and js file into static resorce.
pls anybody can help me.....
Regard's
Deepak
-
- Deepak Chouhan
- September 29, 2014
- Like
- 0
- Continue reading or reply
Site.com : binding custom html input with custom object.
Hi All,
I have working with Site.com. i want to binding html page with custome object. i have create some input field in site.com template. it possibel to stored data into custome object using site.com html page templates.
pls help me out.....
I have working with Site.com. i want to binding html page with custome object. i have create some input field in site.com template. it possibel to stored data into custome object using site.com html page templates.
pls help me out.....
-
- Deepak Chouhan
- February 03, 2015
- Like
- 1
- Continue reading or reply
Custom validation in Visualforce Page on Edit button
Hi,
I have created visualforce page with standard object (account). my question is whenever i click the edit button on detail page i want to disabled some required field and user can't edit those field.
pls help me out.
I have created visualforce page with standard object (account). my question is whenever i click the edit button on detail page i want to disabled some required field and user can't edit those field.
pls help me out.
- Deepak Chouhan
- January 15, 2015
- Like
- 0
- Continue reading or reply
visualforce
Hi,
I have create a picklist and fieldset. i want to control fieldset by picklist without page reload when i will change the picklist value fieldset must be change.
pls help me out
I have create a picklist and fieldset. i want to control fieldset by picklist without page reload when i will change the picklist value fieldset must be change.
pls help me out
- Deepak Chouhan
- December 13, 2014
- Like
- 0
- Continue reading or reply
visualforce
Hi,
I have create picklist and multipicklist. multipicklist dependent to picklist. in my project picklist showing in button and multipicklist in checkbox format. how to checkbox box dependable to button click event.
pls help me out.
I have create picklist and multipicklist. multipicklist dependent to picklist. in my project picklist showing in button and multipicklist in checkbox format. how to checkbox box dependable to button click event.
pls help me out.
- Deepak Chouhan
- December 13, 2014
- Like
- 0
- Continue reading or reply
Lightning
Hi,
i have create a page into Lightning. State and Country Picklist value visible into lightning picklist and select option stored into custom objects.
pls help me out.
i have create a page into Lightning. State and Country Picklist value visible into lightning picklist and select option stored into custom objects.
pls help me out.
- Deepak Chouhan
- November 28, 2014
- Like
- 0
- Continue reading or reply
force.com sites
Hi,
i have created web page on Visualfoce. this page associated to the public site.
when i enter some data into model visible only public page. it not visible recent item and sobject but it is exist in sobject.
i want see all sobject data.
i have created web page on Visualfoce. this page associated to the public site.
when i enter some data into model visible only public page. it not visible recent item and sobject but it is exist in sobject.
i want see all sobject data.
- Deepak Chouhan
- October 06, 2014
- Like
- 0
- Continue reading or reply
visualforce web page
Hi,
I am createing bootstrap web page into VF page. i have add some animation and boostrap property. but it is not work proper way.
i have add related css and js file into static resorce.
pls anybody can help me.....
Regard's
Deepak
I am createing bootstrap web page into VF page. i have add some animation and boostrap property. but it is not work proper way.
i have add related css and js file into static resorce.
pls anybody can help me.....
Regard's
Deepak
- Deepak Chouhan
- September 29, 2014
- Like
- 0
- Continue reading or reply
Site.com
Hi,
I have created sObjects for person information and that sObjects content Name,phone,mobile,address etc.
In a VF page we are useing some controller but into site.com how to use controller i dont know.
I have writen custom code for site.com page template and I want to store data by the help of submit button into site.com page as well as fetch data into table section.
it very urgent for me So pls help me. can you provide some example.
I have created sObjects for person information and that sObjects content Name,phone,mobile,address etc.
In a VF page we are useing some controller but into site.com how to use controller i dont know.
I have writen custom code for site.com page template and I want to store data by the help of submit button into site.com page as well as fetch data into table section.
it very urgent for me So pls help me. can you provide some example.
- Deepak Chouhan
- September 23, 2014
- Like
- 0
- Continue reading or reply
assing apex variable by visualforce tag
hi,
i am using
<apex:repeat value="{!item_Details}" var="item">
<apex:outputPanel styleClass="op_Item_Details" >
<apex:outputField value="{!item.Image__c}"/>
<apex:outputLabel value="{!item.Product_Name__c}"/>
<apex:outputLabel value="{!item.Price__c}" id="me"/> /-
<apex:commandButton value="Item Details" action="{!show_Item_Description}" rerender="item_Popup" style="width:100px;"/>
</apex:outputPanel>
</apex:repeat>
and i want to assing apex variable to above current product item.
i have used actionfunction for onclick event on commandbutton but it's not working.
i am using
<apex:repeat value="{!item_Details}" var="item">
<apex:outputPanel styleClass="op_Item_Details" >
<apex:outputField value="{!item.Image__c}"/>
<apex:outputLabel value="{!item.Product_Name__c}"/>
<apex:outputLabel value="{!item.Price__c}" id="me"/> /-
<apex:commandButton value="Item Details" action="{!show_Item_Description}" rerender="item_Popup" style="width:100px;"/>
</apex:outputPanel>
</apex:repeat>
and i want to assing apex variable to above current product item.
i have used actionfunction for onclick event on commandbutton but it's not working.
- Deepak Chouhan
- May 19, 2014
- Like
- 0
- Continue reading or reply
i want to display image into VF page but it isn't work proper
<apex:repeat value="{!product}" var="p">
<apex:outputPanel styleClass="panel">
<apex:image value="{!p.Image__c}"/> <!--<apex:image url="{!p.Image__c}"/> -->
<apex:outputLabel value="{!p.Product_Name__c}"/>
<apex:outputLabel value="{!p.Price__c}"/>
</apex:outputPanel>
</apex:repeat>
------------------------------------------------
apex:code
------------------------------------------
public PageReference gosearch() {
product= [ SELECT Image__c,Price__c,Product_Name__c FROM OProduct__c WHERE Product_Type__c like :('%'+search+'%') ];
return null;
}
public String search {get;set;}
public List<OProduct__c> product{set;get;}
<apex:outputPanel styleClass="panel">
<apex:image value="{!p.Image__c}"/> <!--<apex:image url="{!p.Image__c}"/> -->
<apex:outputLabel value="{!p.Product_Name__c}"/>
<apex:outputLabel value="{!p.Price__c}"/>
</apex:outputPanel>
</apex:repeat>
------------------------------------------------
apex:code
------------------------------------------
public PageReference gosearch() {
product= [ SELECT Image__c,Price__c,Product_Name__c FROM OProduct__c WHERE Product_Type__c like :('%'+search+'%') ];
return null;
}
public String search {get;set;}
public List<OProduct__c> product{set;get;}
- Deepak Chouhan
- May 09, 2014
- Like
- 0
- Continue reading or reply