-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
8Questions
-
9Replies
Test class. urgent help required
He Champs,
I am working on some test class and help required. Below is my Apex class and Test class code.
__________________________
public with sharing class NeMO_InvoiceOverviewcontroller {
public invoice__c objInvoice{get; set;}
public Asset objAsset{get; set;}
public string vehicleId{get;set;}
public list<invoice__c> lstWrapperCommission{get; set;}
public list<invoice__c> lstWrapperSuplimentry{get; set;}
public list<invoice__c> lstWrapperVehicleInvoice {get; set;}
public general_parameters__c generalParameter{get; set;}
public id recordtypeIdsupli;
public id recordtypeIdvehicle;
public id recordtypeIdcommission;
public decimal TotalNet {get; set;}
public decimal TotalVatFFO {get; set;}
public decimal SubToatl {get; set;}
public decimal TotalNetDFO {get; set;}
public decimal TotalVatDFO {get; set;}
public decimal SubToatlDFO {get; set;}
public list<wrapperStatus> lstWrapStatus{get; set;}
public boolean vehicleStatus{get;set;} // this value is used for check the document storage present in vehicle invoice header or not
public boolean commisionStatus{get;set;} // this value is used for check the document storage present in Commission or not
public string isexist {get; set;}
public boolean isSuppexist {get ;set;}
public string strSelectedSuppInvoice {get; set;}
private static final string URLOVERVIEW = '/apex/NeMo_invoiceOverview?VehicleId=';
private static final string URLSUPPLEMENTRY = '/apex/NeMO_SupplementaryInvoice?VehicleId=';
//To Mantain Stage
private static final String STRSTAGEINV ='Invoice Breakdown';
private Set<String> setStage;
NEMO_Invoice_Util utility=new NEMO_Invoice_Util();
/**************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : Constructor *
**************************************************************************/
public NeMo_InvoiceOverviewcontroller(){
vehicleId = ApexPages.currentPage().getParameters().get('VehicleId');
isexist = ApexPages.currentPage().getParameters().get(label.NEMO_ISEXISTPARAM);
generalParameter = general_parameters__c.getInstance();
vehicleStatus=false;
recordtypeIdsupli = NeMo_GlobalUtill.GetRecordTypeId('invoice__c','Supplementar Invoice Header');
recordtypeIdvehicle = NeMo_GlobalUtill.GetRecordTypeId('invoice__c','Vehicle Invoice Header');
recordtypeIdcommission = NeMo_GlobalUtill.GetRecordTypeId('invoice__c','Commission Invoice Header');
onLoadData();
StatusDocument();
StatusDocumentForVehComm();
}
/**************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This Method is used to load the data on page *
**************************************************************************/
private void onLoadData(){
lstWrapperCommission = new list<invoice__c>();
lstWrapperSuplimentry = new list<invoice__c>();
lstWrapperVehicleInvoice = new list<invoice__c>();
isSuppexist = false;
TotalNet = 0;
TotalVatFFO = 0;
SubToatl = 0;
TotalNetDFO = 0;
TotalVatDFO = 0;
SubToatlDFO = 0;
if(vehicleId != null && vehicleId != '')
{
for(invoice__c InvFor:[select id, name,status__c ,line_item_type__c,supplier__r.Name,Subtotal__c,total_net__c,
Recordtypeid,recordtype.name,total_vat__c,total_vat_amount__c,total_net_amount__c,total_gross_amount__c,
(select id,Name,total_net__c,subtotal__c,total_vat__c,line_item_type__c from Invoice_Line_Items__r)
from invoice__c where asset__c=:vehicleId])
{
if(InvFor.recordtype.name == 'Vehicle Invoice Header')
{
lstWrapperVehicleInvoice.add(InvFor);
if(InvFor.Invoice_Line_Items__r.size() > 0)
{
for(invoice_line_item__c objInvoiceLine : InvFor.Invoice_Line_Items__r)
{
if(objInvoiceLine.line_item_type__c == 'Factory Fitted Option (FFO)'){
if(objInvoiceLine.total_net__c != null){
TotalNet += objInvoiceLine.total_net__c;
}
if(objInvoiceLine.total_vat__c != null){
TotalVatFFO += objInvoiceLine.total_vat__c ;
}
if(objInvoiceLine.subtotal__c != null){
SubToatl += objInvoiceLine.subtotal__c;
}
}
if(objInvoiceLine.line_item_type__c == 'Dealer Fitted Option (DFO)')
{
if( objInvoiceLine.total_net__c != null){
TotalNetDFO += objInvoiceLine.total_net__c;
}
if(objInvoiceLine.total_vat__c != null){
TotalVatDFO += objInvoiceLine.total_vat__c ;
}
if(objInvoiceLine.subtotal__c != null){
SubToatlDFO += objInvoiceLine.subtotal__c;
}
}
}
}
}
if(InvFor.recordtype.name == 'Supplementar Invoice Header')
{
lstWrapperSuplimentry.add(InvFor);
}
if(InvFor.recordtype.name == 'Commission Invoice Header')
{
lstWrapperCommission.add(InvFor);
}
}
if(isexist == NeMO_GlobalConstant.PARAMONE || isexist == NeMO_GlobalConstant.PARAMZERO){
isSuppexist = true;
}
}
}
/**
* This Method is used to ........... .
* @name :
*/
public pagereference InvoicingOverview(){
PageReference pg = new PageReference(URLOVERVIEW +vehicleId+'&ovId=0');
pg.setRedirect(true);
return pg;
}
public pagereference redirectToSupplier(){
system.debug('Ankita===='+strSelectedSuppInvoice);
PageReference pg = new PageReference(URLSUPPLEMENTRY+vehicleId+'&SuppId='+strSelectedSuppInvoice+'&isexist='+isexist);
pg.setRedirect(true);
return pg;
}
public void Close(){
// Call this method to update stage in Invoice to identify new or existing credit proposal
if(!String.isBLANK(vehicleId) && vehicleId !=NeMO_GlobalConstant.PARAMNULL){
utility.UpdateInvoiceStage(vehicleId ,STRSTAGEINV);
}
}
/**
* This Method is used to load the data on page .
* @name : document
*/
/************************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This Method is used to change the status the sent os not sent *
*************************************************************************************/
private void StatusDocumentForVehComm(){
list<invoice__c> lstfor_veh_comm =new list<invoice__c>();
if(vehicleId != null && vehicleId != ''){
lstfor_veh_comm =[SELECT id,name,Recordtypeid,Recordtype.name,(SELECT id,invoice__c,GDMS_Document_Id__c FROM Document_Storage__r)
FROM invoice__c WHERE asset__c=:vehicleId AND Recordtype.name IN('Vehicle Invoice Header','Commission Invoice Header')];
IF(lstfor_veh_comm.size()>0){
For(invoice__c invo:lstfor_veh_comm){
For(GDMS_Document__c docu: invo.Document_Storage__r){
if(invo.Recordtype.name == 'Vehicle Invoice Header' && docu.invoice__c == invo.id){
if(docu.GDMS_Document_Id__c != null && docu.GDMS_Document_Id__c != ''){
vehicleStatus=true;
}
}
if(invo.Recordtype.name == 'Commission Invoice Header' && docu.invoice__c == invo.id){
if(docu.GDMS_Document_Id__c !=null && docu.GDMS_Document_Id__c != ''){
commisionStatus=true;
}
}
}
}
}
}
}
/************************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This Method is used to change the status the sent os not sent *
*************************************************************************************/
private void StatusDocument(){
list<invoice__c> lstofInvoice = new list<invoice__c>();
lstWrapStatus = new list<wrapperStatus>();
if(vehicleId != null && vehicleId != ''){
lstofInvoice =[SELECT id,name,total_net_amount__c,supplier__r.Name,Recordtypeid,Recordtype.name,(SELECT id,invoice__c,GDMS_Document_Id__c FROM Document_Storage__r)
FROM invoice__c WHERE asset__c=:vehicleId AND Recordtype.name = 'Supplementar Invoice Header'];
IF(lstofInvoice.size()>0){
for(invoice__c invoie : lstofInvoice ){
if(!invoie.Document_Storage__r.isEmpty()){
for(GDMS_Document__c docu: invoie.Document_Storage__r){
wrapperStatus objWrapStatus = new wrapperStatus();
if(docu.invoice__c == invoie.id){
if(docu.GDMS_Document_Id__c !=null && docu.GDMS_Document_Id__c != '')
objWrapStatus.supplementarStatus=true;
objWrapStatus.objInvoice = invoie;
}
lstWrapStatus.add(objWrapStatus);
}
}
}
}
}
}
/****************************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This wrapper class is used to display Status of Invoice Line Item *
*****************************************************************************************/
public class wrapperStatus{
public invoice__c objInvoice {get; set;}
public boolean supplementarStatus{get;set;}
public wrapperStatus(){
this.supplementarStatus=false;
}
}
}
__________________
Test class code
___________
@istest
private class NeMO_InvoiceOverviewcontroller_Test{
static testMethod void MyTest(){
Account acc= NeMO_TestUtil.createTestAccountsSupplier(true);
insert acc;
Contact c = NeMO_TestUtil.createTestContactswithAcc( true,acc.id);
insert c;
Asset ast= NeMO_TestUtil.createTestAsset_ConAccFirst(true,c.id,acc.id );
insert ast;
system.debug('***' + ast);
Invoice__c Inv = NeMO_TestUtil.createTestInvoiceAsset(true,ast.id,'Supplementar Invoice Header');
insert inv;
Test.startTest();
NeMO_InvoiceOverviewcontroller obj = new NeMO_InvoiceOverviewcontroller();
//system.debug('*Sachin*'+ obj.vehicleId);
obj.vehicleId=ast.id;
obj.InvoicingOverview();
obj.redirectToSupplier();
test.stoptest();
}
}
Test class is not mathcing the vehicleId condition in onLoadData(), its showing as null, however i am passing the same from the test class.
Please help.
____________
I am working on some test class and help required. Below is my Apex class and Test class code.
__________________________
public with sharing class NeMO_InvoiceOverviewcontroller {
public invoice__c objInvoice{get; set;}
public Asset objAsset{get; set;}
public string vehicleId{get;set;}
public list<invoice__c> lstWrapperCommission{get; set;}
public list<invoice__c> lstWrapperSuplimentry{get; set;}
public list<invoice__c> lstWrapperVehicleInvoice {get; set;}
public general_parameters__c generalParameter{get; set;}
public id recordtypeIdsupli;
public id recordtypeIdvehicle;
public id recordtypeIdcommission;
public decimal TotalNet {get; set;}
public decimal TotalVatFFO {get; set;}
public decimal SubToatl {get; set;}
public decimal TotalNetDFO {get; set;}
public decimal TotalVatDFO {get; set;}
public decimal SubToatlDFO {get; set;}
public list<wrapperStatus> lstWrapStatus{get; set;}
public boolean vehicleStatus{get;set;} // this value is used for check the document storage present in vehicle invoice header or not
public boolean commisionStatus{get;set;} // this value is used for check the document storage present in Commission or not
public string isexist {get; set;}
public boolean isSuppexist {get ;set;}
public string strSelectedSuppInvoice {get; set;}
private static final string URLOVERVIEW = '/apex/NeMo_invoiceOverview?VehicleId=';
private static final string URLSUPPLEMENTRY = '/apex/NeMO_SupplementaryInvoice?VehicleId=';
//To Mantain Stage
private static final String STRSTAGEINV ='Invoice Breakdown';
private Set<String> setStage;
NEMO_Invoice_Util utility=new NEMO_Invoice_Util();
/**************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : Constructor *
**************************************************************************/
public NeMo_InvoiceOverviewcontroller(){
vehicleId = ApexPages.currentPage().getParameters().get('VehicleId');
isexist = ApexPages.currentPage().getParameters().get(label.NEMO_ISEXISTPARAM);
generalParameter = general_parameters__c.getInstance();
vehicleStatus=false;
recordtypeIdsupli = NeMo_GlobalUtill.GetRecordTypeId('invoice__c','Supplementar Invoice Header');
recordtypeIdvehicle = NeMo_GlobalUtill.GetRecordTypeId('invoice__c','Vehicle Invoice Header');
recordtypeIdcommission = NeMo_GlobalUtill.GetRecordTypeId('invoice__c','Commission Invoice Header');
onLoadData();
StatusDocument();
StatusDocumentForVehComm();
}
/**************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This Method is used to load the data on page *
**************************************************************************/
private void onLoadData(){
lstWrapperCommission = new list<invoice__c>();
lstWrapperSuplimentry = new list<invoice__c>();
lstWrapperVehicleInvoice = new list<invoice__c>();
isSuppexist = false;
TotalNet = 0;
TotalVatFFO = 0;
SubToatl = 0;
TotalNetDFO = 0;
TotalVatDFO = 0;
SubToatlDFO = 0;
if(vehicleId != null && vehicleId != '')
{
for(invoice__c InvFor:[select id, name,status__c ,line_item_type__c,supplier__r.Name,Subtotal__c,total_net__c,
Recordtypeid,recordtype.name,total_vat__c,total_vat_amount__c,total_net_amount__c,total_gross_amount__c,
(select id,Name,total_net__c,subtotal__c,total_vat__c,line_item_type__c from Invoice_Line_Items__r)
from invoice__c where asset__c=:vehicleId])
{
if(InvFor.recordtype.name == 'Vehicle Invoice Header')
{
lstWrapperVehicleInvoice.add(InvFor);
if(InvFor.Invoice_Line_Items__r.size() > 0)
{
for(invoice_line_item__c objInvoiceLine : InvFor.Invoice_Line_Items__r)
{
if(objInvoiceLine.line_item_type__c == 'Factory Fitted Option (FFO)'){
if(objInvoiceLine.total_net__c != null){
TotalNet += objInvoiceLine.total_net__c;
}
if(objInvoiceLine.total_vat__c != null){
TotalVatFFO += objInvoiceLine.total_vat__c ;
}
if(objInvoiceLine.subtotal__c != null){
SubToatl += objInvoiceLine.subtotal__c;
}
}
if(objInvoiceLine.line_item_type__c == 'Dealer Fitted Option (DFO)')
{
if( objInvoiceLine.total_net__c != null){
TotalNetDFO += objInvoiceLine.total_net__c;
}
if(objInvoiceLine.total_vat__c != null){
TotalVatDFO += objInvoiceLine.total_vat__c ;
}
if(objInvoiceLine.subtotal__c != null){
SubToatlDFO += objInvoiceLine.subtotal__c;
}
}
}
}
}
if(InvFor.recordtype.name == 'Supplementar Invoice Header')
{
lstWrapperSuplimentry.add(InvFor);
}
if(InvFor.recordtype.name == 'Commission Invoice Header')
{
lstWrapperCommission.add(InvFor);
}
}
if(isexist == NeMO_GlobalConstant.PARAMONE || isexist == NeMO_GlobalConstant.PARAMZERO){
isSuppexist = true;
}
}
}
/**
* This Method is used to ........... .
* @name :
*/
public pagereference InvoicingOverview(){
PageReference pg = new PageReference(URLOVERVIEW +vehicleId+'&ovId=0');
pg.setRedirect(true);
return pg;
}
public pagereference redirectToSupplier(){
system.debug('Ankita===='+strSelectedSuppInvoice);
PageReference pg = new PageReference(URLSUPPLEMENTRY+vehicleId+'&SuppId='+strSelectedSuppInvoice+'&isexist='+isexist);
pg.setRedirect(true);
return pg;
}
public void Close(){
// Call this method to update stage in Invoice to identify new or existing credit proposal
if(!String.isBLANK(vehicleId) && vehicleId !=NeMO_GlobalConstant.PARAMNULL){
utility.UpdateInvoiceStage(vehicleId ,STRSTAGEINV);
}
}
/**
* This Method is used to load the data on page .
* @name : document
*/
/************************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This Method is used to change the status the sent os not sent *
*************************************************************************************/
private void StatusDocumentForVehComm(){
list<invoice__c> lstfor_veh_comm =new list<invoice__c>();
if(vehicleId != null && vehicleId != ''){
lstfor_veh_comm =[SELECT id,name,Recordtypeid,Recordtype.name,(SELECT id,invoice__c,GDMS_Document_Id__c FROM Document_Storage__r)
FROM invoice__c WHERE asset__c=:vehicleId AND Recordtype.name IN('Vehicle Invoice Header','Commission Invoice Header')];
IF(lstfor_veh_comm.size()>0){
For(invoice__c invo:lstfor_veh_comm){
For(GDMS_Document__c docu: invo.Document_Storage__r){
if(invo.Recordtype.name == 'Vehicle Invoice Header' && docu.invoice__c == invo.id){
if(docu.GDMS_Document_Id__c != null && docu.GDMS_Document_Id__c != ''){
vehicleStatus=true;
}
}
if(invo.Recordtype.name == 'Commission Invoice Header' && docu.invoice__c == invo.id){
if(docu.GDMS_Document_Id__c !=null && docu.GDMS_Document_Id__c != ''){
commisionStatus=true;
}
}
}
}
}
}
}
/************************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This Method is used to change the status the sent os not sent *
*************************************************************************************/
private void StatusDocument(){
list<invoice__c> lstofInvoice = new list<invoice__c>();
lstWrapStatus = new list<wrapperStatus>();
if(vehicleId != null && vehicleId != ''){
lstofInvoice =[SELECT id,name,total_net_amount__c,supplier__r.Name,Recordtypeid,Recordtype.name,(SELECT id,invoice__c,GDMS_Document_Id__c FROM Document_Storage__r)
FROM invoice__c WHERE asset__c=:vehicleId AND Recordtype.name = 'Supplementar Invoice Header'];
IF(lstofInvoice.size()>0){
for(invoice__c invoie : lstofInvoice ){
if(!invoie.Document_Storage__r.isEmpty()){
for(GDMS_Document__c docu: invoie.Document_Storage__r){
wrapperStatus objWrapStatus = new wrapperStatus();
if(docu.invoice__c == invoie.id){
if(docu.GDMS_Document_Id__c !=null && docu.GDMS_Document_Id__c != '')
objWrapStatus.supplementarStatus=true;
objWrapStatus.objInvoice = invoie;
}
lstWrapStatus.add(objWrapStatus);
}
}
}
}
}
}
/****************************************************************************************
* @Name : NeMO_InvoiceOverviewcontroller *
* @Params : void *
* @Return : void *
* @Description : This wrapper class is used to display Status of Invoice Line Item *
*****************************************************************************************/
public class wrapperStatus{
public invoice__c objInvoice {get; set;}
public boolean supplementarStatus{get;set;}
public wrapperStatus(){
this.supplementarStatus=false;
}
}
}
__________________
Test class code
___________
@istest
private class NeMO_InvoiceOverviewcontroller_Test{
static testMethod void MyTest(){
Account acc= NeMO_TestUtil.createTestAccountsSupplier(true);
insert acc;
Contact c = NeMO_TestUtil.createTestContactswithAcc( true,acc.id);
insert c;
Asset ast= NeMO_TestUtil.createTestAsset_ConAccFirst(true,c.id,acc.id );
insert ast;
system.debug('***' + ast);
Invoice__c Inv = NeMO_TestUtil.createTestInvoiceAsset(true,ast.id,'Supplementar Invoice Header');
insert inv;
Test.startTest();
NeMO_InvoiceOverviewcontroller obj = new NeMO_InvoiceOverviewcontroller();
//system.debug('*Sachin*'+ obj.vehicleId);
obj.vehicleId=ast.id;
obj.InvoicingOverview();
obj.redirectToSupplier();
test.stoptest();
}
}
Test class is not mathcing the vehicleId condition in onLoadData(), its showing as null, however i am passing the same from the test class.
Please help.
____________
- Sachin Sharma 3886
- November 06, 2015
- Like
- 0
- Continue reading or reply
Save button extension
Hi Expertz,
I am working on some functionality that when even a user clicks on Save button a new VF form should comes up alogn with some differemnt fields.
Then when ever user click the OK button on the new VF page all the data should commit to Salesforce.
I don't have any clues for this that how to even start as i a newbie, Kinldy assists.
Thanks
Sachin Sharma
I am working on some functionality that when even a user clicks on Save button a new VF form should comes up alogn with some differemnt fields.
Then when ever user click the OK button on the new VF page all the data should commit to Salesforce.
I don't have any clues for this that how to even start as i a newbie, Kinldy assists.
Thanks
Sachin Sharma
- Sachin Sharma 3886
- September 08, 2015
- Like
- 0
- Continue reading or reply
SingleEmail and MassEmail
Hi Expertz,
Can any one please told me the differenct between SingleEmail and MassEmail.
Thanks in advance
Thanks
Sharma
Can any one please told me the differenct between SingleEmail and MassEmail.
Thanks in advance
Thanks
Sharma
- Sachin Sharma 3886
- August 10, 2015
- Like
- 0
- Continue reading or reply
What is the benefit of callout ?
Hi Experts,
I am very confused about the word, Keyword Callout.
Where to use it ?
Why to use it?
And what is the benefit it ?
Can anybody explain me. This is very urgent and i need the suggestion asap.
Thanks in advance.
Sachin
I am very confused about the word, Keyword Callout.
Where to use it ?
Why to use it?
And what is the benefit it ?
Can anybody explain me. This is very urgent and i need the suggestion asap.
Thanks in advance.
Sachin
- Sachin Sharma 3886
- July 03, 2015
- Like
- 0
- Continue reading or reply
VF Page,Attempt to de-reference a null object
Hi,
I am working on some custom Controller and VF pages, but the page is throwing error that
System.NullPointerException: Attempt to de-reference a null object
Class.ControllerApexsharing.<init>: line 7, column 1
My Class and VF pages are below.
Class---
public class ControllerApexsharing{
public List<ApexSharing__c> SelectedApexSharing{ get; set; }
public ControllerApexsharing(){
for(ApexSharing__c Apexs :[select id,name, Field_1__c,Field_2__c,Account__c from ApexSharing__c]){
system.debug('***' + Apexs.name +'***');
SelectedApexSharing.add( Apexs);
}
}
}
VF page---
<apex:page controller="ControllerApexsharing">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!SelectedApexSharing}" var="LoopVar">
<apex:column value="{!LoopVar.id}"/>
<apex:column value="{!LoopVar.name}"/>
<apex:column value="{!LoopVar.Field_1__c}"/>
<apex:column value="{!LoopVar.Field_2__c}"/>
<apex:column value="{!LoopVar.Account__c }"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Please suggest...
I am working on some custom Controller and VF pages, but the page is throwing error that
System.NullPointerException: Attempt to de-reference a null object
Class.ControllerApexsharing.<init>: line 7, column 1
My Class and VF pages are below.
Class---
public class ControllerApexsharing{
public List<ApexSharing__c> SelectedApexSharing{ get; set; }
public ControllerApexsharing(){
for(ApexSharing__c Apexs :[select id,name, Field_1__c,Field_2__c,Account__c from ApexSharing__c]){
system.debug('***' + Apexs.name +'***');
SelectedApexSharing.add( Apexs);
}
}
}
VF page---
<apex:page controller="ControllerApexsharing">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!SelectedApexSharing}" var="LoopVar">
<apex:column value="{!LoopVar.id}"/>
<apex:column value="{!LoopVar.name}"/>
<apex:column value="{!LoopVar.Field_1__c}"/>
<apex:column value="{!LoopVar.Field_2__c}"/>
<apex:column value="{!LoopVar.Account__c }"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Please suggest...
- Sachin Sharma 3886
- May 20, 2015
- Like
- 0
- Continue reading or reply
VF page issue for Google map integration
When I scroll the window in IE it shows me the unspecified error at line 1 .Works fine in other browsers.
Kindly assist.
Below is the VF page:
Refer only google map integration code, I have not copied all the VF page
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<apex:includeScript value="{!URLFOR($Resource.myStyleSheet, 'jquery-ui-1.11.4.custom.min.js')}"/>
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript" >
$j = jquery.noConflict();
$j(document).ready(function(){
});-->
<script>
function submitListener(e){
var keynum = 0;
if (window.event){
keynum = window.event.keyCode;
}
else if (e.which){
keynum = e.which;
}
// Here we check whether the Enter button was pressed
if (keynum == 13){
onFormSubmit();
return false;
}else
{
return true;
}
}
</script>
<style>
#slider-range-min {
width: 120px;
background: black;
margin-bottom: 8px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
$j = jQuery.noConflict();
$j(document).ready(function(){
});
</script>
<html>
<body>
<div id="googleMap" style="width:1300px;height:380px;border:1;" align="centre"></div>
</body>
</html>
<apex:actionFunction name="initialize" reRender="pbid">
<!--<apex:param assignTo="{!accObj.Location__latitude__s}" value="lat"/>
<apex:param assignTo="{!accObj.Location__longitude__s}" value="long"/>-->
</apex:actionFunction>
<apex:pageBlock id="pbid" >
<script src="https://maps.googleapis.com/maps/api/js"/>
<script>
var latitude="{!Acc.Location__Latitude__s}";
var longitude="{!Acc.Location__Longitude__s}";
function initialize(lat,long) {
var sizeoflist="{!size}" ;
google.maps.event.clearListeners(window, 'resize');
var mapProp = {
center:new google.maps.LatLng(lat,long),
zoom:10,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"), mapProp);
icon = "http://maps.google.com/mapfiles/ms/icons/blue.png";
var marker = new google.maps.Marker({
map:map,
position:new google.maps.LatLng(latitude,longitude),
icon: new google.maps.MarkerImage(icon),
title:"{!acc.Name},{!Acc.Location__Latitude__s},{!Acc.Location__Longitude__s}"
});
<apex:repeat value="{!SearchCourseWrapperList}" var="temp">
<apex:outputText >
var marker1 = new google.maps.Marker({
map:map,
position:new google.maps.LatLng("{!temp.JobVacancy.InstanceLocation__Latitude__s}","{!temp.JobVacancy.InstanceLocation__Longitude__s}"),
title:"{!temp.JobVacancy.Name},{!temp.JobVacancy.Course__r.CourseName__c}"
});
</apex:outputText>
</apex:repeat>
}
google.maps.event.trigger(map, "resize");
google.maps.event.addDomListener(window, 'load', initialize(latitude,longitude));
</script>
</apex:pageBlock>
</apex:form>
</apex:page>
Kindly assist.
Below is the VF page:
Refer only google map integration code, I have not copied all the VF page
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<apex:includeScript value="{!URLFOR($Resource.myStyleSheet, 'jquery-ui-1.11.4.custom.min.js')}"/>
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript" >
$j = jquery.noConflict();
$j(document).ready(function(){
});-->
<script>
function submitListener(e){
var keynum = 0;
if (window.event){
keynum = window.event.keyCode;
}
else if (e.which){
keynum = e.which;
}
// Here we check whether the Enter button was pressed
if (keynum == 13){
onFormSubmit();
return false;
}else
{
return true;
}
}
</script>
<style>
#slider-range-min {
width: 120px;
background: black;
margin-bottom: 8px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
$j = jQuery.noConflict();
$j(document).ready(function(){
});
</script>
<html>
<body>
<div id="googleMap" style="width:1300px;height:380px;border:1;" align="centre"></div>
</body>
</html>
<apex:actionFunction name="initialize" reRender="pbid">
<!--<apex:param assignTo="{!accObj.Location__latitude__s}" value="lat"/>
<apex:param assignTo="{!accObj.Location__longitude__s}" value="long"/>-->
</apex:actionFunction>
<apex:pageBlock id="pbid" >
<script src="https://maps.googleapis.com/maps/api/js"/>
<script>
var latitude="{!Acc.Location__Latitude__s}";
var longitude="{!Acc.Location__Longitude__s}";
function initialize(lat,long) {
var sizeoflist="{!size}" ;
google.maps.event.clearListeners(window, 'resize');
var mapProp = {
center:new google.maps.LatLng(lat,long),
zoom:10,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"), mapProp);
icon = "http://maps.google.com/mapfiles/ms/icons/blue.png";
var marker = new google.maps.Marker({
map:map,
position:new google.maps.LatLng(latitude,longitude),
icon: new google.maps.MarkerImage(icon),
title:"{!acc.Name},{!Acc.Location__Latitude__s},{!Acc.Location__Longitude__s}"
});
<apex:repeat value="{!SearchCourseWrapperList}" var="temp">
<apex:outputText >
var marker1 = new google.maps.Marker({
map:map,
position:new google.maps.LatLng("{!temp.JobVacancy.InstanceLocation__Latitude__s}","{!temp.JobVacancy.InstanceLocation__Longitude__s}"),
title:"{!temp.JobVacancy.Name},{!temp.JobVacancy.Course__r.CourseName__c}"
});
</apex:outputText>
</apex:repeat>
}
google.maps.event.trigger(map, "resize");
google.maps.event.addDomListener(window, 'load', initialize(latitude,longitude));
</script>
</apex:pageBlock>
</apex:form>
</apex:page>
- Sachin Sharma 3886
- April 30, 2015
- Like
- 0
- Continue reading or reply
Profile and Permission in manage package
Hi,
How to profile and permissions are added in manage pacakge to installed it in other org ?
I have to create a manage packege with arround 20 custom profiles. How to proceed please help me. Thanks!!
How to profile and permissions are added in manage pacakge to installed it in other org ?
I have to create a manage packege with arround 20 custom profiles. How to proceed please help me. Thanks!!
- Sachin Sharma 3886
- April 30, 2015
- Like
- 0
- Continue reading or reply
Test class, Need help
Hi,
I am working on some test class and got stuck at some place, need help.
My Controller class is
**************************************
public class APMP_cloneAgileProcessController {
public Agile_Process__c objAgile_Process{get;set;}
public string AgileProcessId{get;set;}
public list<Stage__c> lstAPMPStages{get;set;}
public APMP_cloneAgileProcessController(){
AgileProcessId=ApexPages.currentPage().getParameters().get('id');
objAgile_Process=[Select name, Process_Description__c, Active__c from Agile_Process__c where id =:AgileProcessId];
lstAPMPStages=[select id, name, Stage_Name__c from Stage__c where Agile_Process__c =:AgileProcessId];
}
public PageReference Cancel() {
return (new ApexPages.StandardController(objAgile_Process)).view();
}
public PageReference Save() {
Agile_Process__c objnewAgileProc=new Agile_Process__c();
try{
objnewAgileProc.Active__c= objAgile_Process.Active__c;
objnewAgileProc.Process_Description__c=objAgile_Process.Process_Description__c;
objnewAgileProc.Name=objAgile_Process.Name;
insert objnewAgileProc;
list<Stage__c > lstnewAPMPStgs=new list<Stage__c>();
for(Stage__c stg:lstAPMPStages){
Stage__c objstg=new Stage__c();
objstg.Agile_Process__c=objnewAgileProc.id;
objStg.Stage_Name__c=stg.Stage_Name__c;
lstnewAPMPStgs.add(objStg);
}
insert lstnewAPMPStgs;
}catch(exception ex){
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage());
ApexPages.addMessage(msg);
return null;
}
return (new ApexPages.StandardController(objnewAgileProc)).view();
}
}
***************************************
And code for my test class is
************************************
@istest
private class TestAPMP_cloneAgileProcessController {
static testMethod void MyTest(){
//Inserting test date for Agile_Process__c (Process) object
Agile_Process__c AP = new Agile_Process__c (name='Test Agile Process',Process_Description__c='Test Description',Active__c=False);
insert AP;
Apexpages.standardcontroller controller = new Apexpages.standardcontroller(AP);
Test.startTest();
APMP_cloneAgileProcessController ObjTest = new APMP_cloneAgileProcessController ();
objtest.cancel();
test.stoptest();
}
}
************************************
Its failing the test method and saying that no wrow for assignment.
Kindly help.
I am working on some test class and got stuck at some place, need help.
My Controller class is
**************************************
public class APMP_cloneAgileProcessController {
public Agile_Process__c objAgile_Process{get;set;}
public string AgileProcessId{get;set;}
public list<Stage__c> lstAPMPStages{get;set;}
public APMP_cloneAgileProcessController(){
AgileProcessId=ApexPages.currentPage().getParameters().get('id');
objAgile_Process=[Select name, Process_Description__c, Active__c from Agile_Process__c where id =:AgileProcessId];
lstAPMPStages=[select id, name, Stage_Name__c from Stage__c where Agile_Process__c =:AgileProcessId];
}
public PageReference Cancel() {
return (new ApexPages.StandardController(objAgile_Process)).view();
}
public PageReference Save() {
Agile_Process__c objnewAgileProc=new Agile_Process__c();
try{
objnewAgileProc.Active__c= objAgile_Process.Active__c;
objnewAgileProc.Process_Description__c=objAgile_Process.Process_Description__c;
objnewAgileProc.Name=objAgile_Process.Name;
insert objnewAgileProc;
list<Stage__c > lstnewAPMPStgs=new list<Stage__c>();
for(Stage__c stg:lstAPMPStages){
Stage__c objstg=new Stage__c();
objstg.Agile_Process__c=objnewAgileProc.id;
objStg.Stage_Name__c=stg.Stage_Name__c;
lstnewAPMPStgs.add(objStg);
}
insert lstnewAPMPStgs;
}catch(exception ex){
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage());
ApexPages.addMessage(msg);
return null;
}
return (new ApexPages.StandardController(objnewAgileProc)).view();
}
}
***************************************
And code for my test class is
************************************
@istest
private class TestAPMP_cloneAgileProcessController {
static testMethod void MyTest(){
//Inserting test date for Agile_Process__c (Process) object
Agile_Process__c AP = new Agile_Process__c (name='Test Agile Process',Process_Description__c='Test Description',Active__c=False);
insert AP;
Apexpages.standardcontroller controller = new Apexpages.standardcontroller(AP);
Test.startTest();
APMP_cloneAgileProcessController ObjTest = new APMP_cloneAgileProcessController ();
objtest.cancel();
test.stoptest();
}
}
************************************
Its failing the test method and saying that no wrow for assignment.
Kindly help.
- Sachin Sharma 3886
- April 24, 2015
- Like
- 0
- Continue reading or reply
Save button extension
Hi Expertz,
I am working on some functionality that when even a user clicks on Save button a new VF form should comes up alogn with some differemnt fields.
Then when ever user click the OK button on the new VF page all the data should commit to Salesforce.
I don't have any clues for this that how to even start as i a newbie, Kinldy assists.
Thanks
Sachin Sharma
I am working on some functionality that when even a user clicks on Save button a new VF form should comes up alogn with some differemnt fields.
Then when ever user click the OK button on the new VF page all the data should commit to Salesforce.
I don't have any clues for this that how to even start as i a newbie, Kinldy assists.
Thanks
Sachin Sharma
- Sachin Sharma 3886
- September 08, 2015
- Like
- 0
- Continue reading or reply
I have created a ExceptionLog object. When ever the new exception caught, i like to create a new record in my ExceptionLog Object. But it is showing a exception like Limit exception:DML Not allowed here. Can you please suggest how to resolve it?
I have created a ExceptionLog object. When ever the new exception caught, i like to create a new record in my ExceptionLog Object. But it is showing a exception like Limit exception:DML Not allowed here. Can you please suggest how to resolve it? Is it possible to create a new record from the catch block? Please suggest me way to achieve this issue.
- saripalli abhinay 17
- July 02, 2015
- Like
- 0
- Continue reading or reply
data import wizard
Data Import Wizard—this tool, accessible through the Setup menu, lets you import data in common standard objects, such as contacts, leads, accounts, opportunities, as well as data in custom objects. It can import up to 50,000 records at a time. It provides a simple interface to specify the configuration parameters, data sources, and the field mappings that map the field names in your import file with the field names in Salesforce.
can we import opportunities using data import wizard? as i cant see any option in data import wizard... but it is clearly mentioned in trailheads of admin
can we import opportunities using data import wizard? as i cant see any option in data import wizard... but it is clearly mentioned in trailheads of admin
- niranjan reddy 6
- July 01, 2015
- Like
- 0
- Continue reading or reply
Why my code does not save the page information?
I have custom page, and when i try to save it my page does not save any information. I used different type of codes for saving. Most of them does not work and some of them break my page. Is there anything wrong with my code that i could not find? ( My main problem is it should save information and return to the same page with values) Any idea? Thanks
public class test1 { public Product_Brief__c pb {get;set;} public User u {get;set;} private ApexPages.StandardController controller {get;set;} public boolean bUpdate {get;set;} public string loggedinUserId = UserInfo.getUserId(); public User u2 = [Select ContactId From User where Id =: '005R0000001Y6h4']; public String ctId{ get { ctId = u2.ContactId; return ctId; } set; } Contact ct = [SELECT AccountId FROM Contact WHERE id=:ctId]; public string getacct(){ Account acct = [SELECT Name FROM Account WHERE id=:ct.AccountId]; return acct.Name; return null; } Opportunity opp = [SELECT Id FROM Opportunity WHERE AccountId=:ct.AccountId LIMIT 1]; /* public PageReference save() { controller.save();{ pageReference pg = new pageReference('/apex/pitu3'); pg.setRedirect(true); pg .getParameters().put('id',controller.getId()); return pg; } return null; } */ /* public PageReference save() { controller.save(); return null; } */ /* public PageReference save() { if(controller.save() != null) { PageReference ref = Page.sumpage3; ref.setRedirect(true); return ref; } return null; } */ public PageReference save() { if(controller.save() != null) { PageReference congratsPage = Page.pitu3; congratsPage.setRedirect(true); congratsPage.getParameters().put('id',controller.getId()); return congratsPage; }return null; } public test1(ApexPages.StandardController controller) { this.controller = controller; } public PageReference page1(){ return Page.pitu1; } public PageReference page2(){ return Page.pitu2; } public PageReference page3(){ return Page.pitu3; } public PageReference page4(){ return Page.pitu4; } public PageReference page5(){ return Page.pitu5; } }
- Dhananjaya Bulugahamulle
- July 01, 2015
- Like
- 0
- Continue reading or reply
VF page issue for Google map integration
When I scroll the window in IE it shows me the unspecified error at line 1 .Works fine in other browsers.
Kindly assist.
Below is the VF page:
Refer only google map integration code, I have not copied all the VF page
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<apex:includeScript value="{!URLFOR($Resource.myStyleSheet, 'jquery-ui-1.11.4.custom.min.js')}"/>
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript" >
$j = jquery.noConflict();
$j(document).ready(function(){
});-->
<script>
function submitListener(e){
var keynum = 0;
if (window.event){
keynum = window.event.keyCode;
}
else if (e.which){
keynum = e.which;
}
// Here we check whether the Enter button was pressed
if (keynum == 13){
onFormSubmit();
return false;
}else
{
return true;
}
}
</script>
<style>
#slider-range-min {
width: 120px;
background: black;
margin-bottom: 8px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
$j = jQuery.noConflict();
$j(document).ready(function(){
});
</script>
<html>
<body>
<div id="googleMap" style="width:1300px;height:380px;border:1;" align="centre"></div>
</body>
</html>
<apex:actionFunction name="initialize" reRender="pbid">
<!--<apex:param assignTo="{!accObj.Location__latitude__s}" value="lat"/>
<apex:param assignTo="{!accObj.Location__longitude__s}" value="long"/>-->
</apex:actionFunction>
<apex:pageBlock id="pbid" >
<script src="https://maps.googleapis.com/maps/api/js"/>
<script>
var latitude="{!Acc.Location__Latitude__s}";
var longitude="{!Acc.Location__Longitude__s}";
function initialize(lat,long) {
var sizeoflist="{!size}" ;
google.maps.event.clearListeners(window, 'resize');
var mapProp = {
center:new google.maps.LatLng(lat,long),
zoom:10,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"), mapProp);
icon = "http://maps.google.com/mapfiles/ms/icons/blue.png";
var marker = new google.maps.Marker({
map:map,
position:new google.maps.LatLng(latitude,longitude),
icon: new google.maps.MarkerImage(icon),
title:"{!acc.Name},{!Acc.Location__Latitude__s},{!Acc.Location__Longitude__s}"
});
<apex:repeat value="{!SearchCourseWrapperList}" var="temp">
<apex:outputText >
var marker1 = new google.maps.Marker({
map:map,
position:new google.maps.LatLng("{!temp.JobVacancy.InstanceLocation__Latitude__s}","{!temp.JobVacancy.InstanceLocation__Longitude__s}"),
title:"{!temp.JobVacancy.Name},{!temp.JobVacancy.Course__r.CourseName__c}"
});
</apex:outputText>
</apex:repeat>
}
google.maps.event.trigger(map, "resize");
google.maps.event.addDomListener(window, 'load', initialize(latitude,longitude));
</script>
</apex:pageBlock>
</apex:form>
</apex:page>
Kindly assist.
Below is the VF page:
Refer only google map integration code, I have not copied all the VF page
<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<apex:includeScript value="{!URLFOR($Resource.myStyleSheet, 'jquery-ui-1.11.4.custom.min.js')}"/>
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>
<script type="text/javascript" >
$j = jquery.noConflict();
$j(document).ready(function(){
});-->
<script>
function submitListener(e){
var keynum = 0;
if (window.event){
keynum = window.event.keyCode;
}
else if (e.which){
keynum = e.which;
}
// Here we check whether the Enter button was pressed
if (keynum == 13){
onFormSubmit();
return false;
}else
{
return true;
}
}
</script>
<style>
#slider-range-min {
width: 120px;
background: black;
margin-bottom: 8px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js">
$j = jQuery.noConflict();
$j(document).ready(function(){
});
</script>
<html>
<body>
<div id="googleMap" style="width:1300px;height:380px;border:1;" align="centre"></div>
</body>
</html>
<apex:actionFunction name="initialize" reRender="pbid">
<!--<apex:param assignTo="{!accObj.Location__latitude__s}" value="lat"/>
<apex:param assignTo="{!accObj.Location__longitude__s}" value="long"/>-->
</apex:actionFunction>
<apex:pageBlock id="pbid" >
<script src="https://maps.googleapis.com/maps/api/js"/>
<script>
var latitude="{!Acc.Location__Latitude__s}";
var longitude="{!Acc.Location__Longitude__s}";
function initialize(lat,long) {
var sizeoflist="{!size}" ;
google.maps.event.clearListeners(window, 'resize');
var mapProp = {
center:new google.maps.LatLng(lat,long),
zoom:10,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"), mapProp);
icon = "http://maps.google.com/mapfiles/ms/icons/blue.png";
var marker = new google.maps.Marker({
map:map,
position:new google.maps.LatLng(latitude,longitude),
icon: new google.maps.MarkerImage(icon),
title:"{!acc.Name},{!Acc.Location__Latitude__s},{!Acc.Location__Longitude__s}"
});
<apex:repeat value="{!SearchCourseWrapperList}" var="temp">
<apex:outputText >
var marker1 = new google.maps.Marker({
map:map,
position:new google.maps.LatLng("{!temp.JobVacancy.InstanceLocation__Latitude__s}","{!temp.JobVacancy.InstanceLocation__Longitude__s}"),
title:"{!temp.JobVacancy.Name},{!temp.JobVacancy.Course__r.CourseName__c}"
});
</apex:outputText>
</apex:repeat>
}
google.maps.event.trigger(map, "resize");
google.maps.event.addDomListener(window, 'load', initialize(latitude,longitude));
</script>
</apex:pageBlock>
</apex:form>
</apex:page>
- Sachin Sharma 3886
- April 30, 2015
- Like
- 0
- Continue reading or reply
Test class, Need help
Hi,
I am working on some test class and got stuck at some place, need help.
My Controller class is
**************************************
public class APMP_cloneAgileProcessController {
public Agile_Process__c objAgile_Process{get;set;}
public string AgileProcessId{get;set;}
public list<Stage__c> lstAPMPStages{get;set;}
public APMP_cloneAgileProcessController(){
AgileProcessId=ApexPages.currentPage().getParameters().get('id');
objAgile_Process=[Select name, Process_Description__c, Active__c from Agile_Process__c where id =:AgileProcessId];
lstAPMPStages=[select id, name, Stage_Name__c from Stage__c where Agile_Process__c =:AgileProcessId];
}
public PageReference Cancel() {
return (new ApexPages.StandardController(objAgile_Process)).view();
}
public PageReference Save() {
Agile_Process__c objnewAgileProc=new Agile_Process__c();
try{
objnewAgileProc.Active__c= objAgile_Process.Active__c;
objnewAgileProc.Process_Description__c=objAgile_Process.Process_Description__c;
objnewAgileProc.Name=objAgile_Process.Name;
insert objnewAgileProc;
list<Stage__c > lstnewAPMPStgs=new list<Stage__c>();
for(Stage__c stg:lstAPMPStages){
Stage__c objstg=new Stage__c();
objstg.Agile_Process__c=objnewAgileProc.id;
objStg.Stage_Name__c=stg.Stage_Name__c;
lstnewAPMPStgs.add(objStg);
}
insert lstnewAPMPStgs;
}catch(exception ex){
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage());
ApexPages.addMessage(msg);
return null;
}
return (new ApexPages.StandardController(objnewAgileProc)).view();
}
}
***************************************
And code for my test class is
************************************
@istest
private class TestAPMP_cloneAgileProcessController {
static testMethod void MyTest(){
//Inserting test date for Agile_Process__c (Process) object
Agile_Process__c AP = new Agile_Process__c (name='Test Agile Process',Process_Description__c='Test Description',Active__c=False);
insert AP;
Apexpages.standardcontroller controller = new Apexpages.standardcontroller(AP);
Test.startTest();
APMP_cloneAgileProcessController ObjTest = new APMP_cloneAgileProcessController ();
objtest.cancel();
test.stoptest();
}
}
************************************
Its failing the test method and saying that no wrow for assignment.
Kindly help.
I am working on some test class and got stuck at some place, need help.
My Controller class is
**************************************
public class APMP_cloneAgileProcessController {
public Agile_Process__c objAgile_Process{get;set;}
public string AgileProcessId{get;set;}
public list<Stage__c> lstAPMPStages{get;set;}
public APMP_cloneAgileProcessController(){
AgileProcessId=ApexPages.currentPage().getParameters().get('id');
objAgile_Process=[Select name, Process_Description__c, Active__c from Agile_Process__c where id =:AgileProcessId];
lstAPMPStages=[select id, name, Stage_Name__c from Stage__c where Agile_Process__c =:AgileProcessId];
}
public PageReference Cancel() {
return (new ApexPages.StandardController(objAgile_Process)).view();
}
public PageReference Save() {
Agile_Process__c objnewAgileProc=new Agile_Process__c();
try{
objnewAgileProc.Active__c= objAgile_Process.Active__c;
objnewAgileProc.Process_Description__c=objAgile_Process.Process_Description__c;
objnewAgileProc.Name=objAgile_Process.Name;
insert objnewAgileProc;
list<Stage__c > lstnewAPMPStgs=new list<Stage__c>();
for(Stage__c stg:lstAPMPStages){
Stage__c objstg=new Stage__c();
objstg.Agile_Process__c=objnewAgileProc.id;
objStg.Stage_Name__c=stg.Stage_Name__c;
lstnewAPMPStgs.add(objStg);
}
insert lstnewAPMPStgs;
}catch(exception ex){
ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR,ex.getMessage());
ApexPages.addMessage(msg);
return null;
}
return (new ApexPages.StandardController(objnewAgileProc)).view();
}
}
***************************************
And code for my test class is
************************************
@istest
private class TestAPMP_cloneAgileProcessController {
static testMethod void MyTest(){
//Inserting test date for Agile_Process__c (Process) object
Agile_Process__c AP = new Agile_Process__c (name='Test Agile Process',Process_Description__c='Test Description',Active__c=False);
insert AP;
Apexpages.standardcontroller controller = new Apexpages.standardcontroller(AP);
Test.startTest();
APMP_cloneAgileProcessController ObjTest = new APMP_cloneAgileProcessController ();
objtest.cancel();
test.stoptest();
}
}
************************************
Its failing the test method and saying that no wrow for assignment.
Kindly help.
- Sachin Sharma 3886
- April 24, 2015
- Like
- 0
- Continue reading or reply