• a!
  • NEWBIE
  • 5 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 21
    Replies

Hi to all,

 

I have made some code changes in 2 apex classes, when i deploying these two apex classes, it throughs an error like this

: Average Test Coverage across all Apex classes and Triggers is 69%, atleast 75% test coverage is required.

 

when i run those 2 test classes, its test coverage is 84% and 86%.

 

I have deployd with change sets and also i try with Eclipse, getting the same error.

 

Please help me on this error, colud you please suggest any ideas or suggestons it will be greatly apriciated.

 

 

Thanking You in Advance. 

  • August 07, 2013
  • Like
  • 0

Hi ,

 

I wrote  below validation rule, working fine, but from summer 13 release, am getting the error  field is inaccessible.

 

PRIORVALUE(IsSplit) = FALSE && (IsSplit = TRUE)

 

can you please suggest how to get access to IsSplit field.

 

 

Thanking you in advance.

 

 

  • May 21, 2013
  • Like
  • 0

Hi All,

 

any body can suggest  how to deactivate a portal administrator.

 

We don't have any customer portal users also.

 

Thanking you in advance

  • April 05, 2013
  • Like
  • 0

Hi All,

 

i have a requirement like this,   mass transfer of account owner names  with filters,  and keep the opportunity owner name same as old opportunity owner name.

 

when am doing mass transfer records, transfering account owner names, transfers all  account owner names to new owner, here my requirement is i need opportunity owner name does't change. 

 

Please guide me, 

 

thanking you in advance

  • March 19, 2013
  • Like
  • 0
List<string> s =new list<string>{'CESSSSS'};
List<string> s1= new list<string>{'WA'};
List<string> s2= new list<string>{'NZ'};
List<account> acc = new list<account>();
for (account a :[select id,ownerid,billingstate from account where type='Prospect' and name != 's'])
{
    for (account b : s1)
    {
    if(b.billingstate == a.billingstate)
    { 
        a.ownerid='00591128657gfH5';
        acc.add(a);
    }
    }
}
 update acc;

 

  • March 15, 2013
  • Like
  • 0
 obj1.name = obj2.name+obj3.name;

 getting out put as "namename"

but i need space or any special character in between two filelds as name name or name-name.

 

 

Thanking you in advance.

 

  • October 26, 2012
  • Like
  • 0
public with sharing class classexample {
    public classexample() {
         c= new contact();  
         paramMap = apexpages.currentpage().getparameters();      
         list1 = new List<String>(paramMap.keySet());
         for(integer i=0;i<list1.size();i++){
              paramName = list1.get(i);
              paramValue = paramMap.get(paramName);
              if(paramName != 'returnUrl' && paramName !='core.apexpages.devmode.url'){
              c.put(paramName,paramValue);
              }         
            }   
         returnUrl = apexpages.currentpage().getparameters().get('returnUrl');  

    }

public contact c;
public string lastname{get;set;}
public string firstname{get;set;}
public string paramName{get;set;}
public string paramValue{get;set;}
public List<String> list1{get;set;}
public  map<string,string> paramMap{get;set;}
public  string returnUrl;
   
   
    public pagereference autorun() {  
           
      if(c.lastname!=null){     
       insert c;
       }
       if(returnUrl!=null){
      pagereference p = new pagereference(returnUrl);  
      return p;
      }else{
          return null;
      }

      
     
  }
  }

 Hi to all,

 

in the above class  there are two security issues.

1. returnUrl = apexpages.currentpage().getparameters().get('returnUrl'); 

 

and 

2.

pagereference p = new pagereference(returnUrl);
return p;

 

here Security issue is

"

 Open Redirect Vulnerability

An open redirect is an application that takes a parameter and redirects a user to the parameter value without any validation. This vulnerability is used in phishing attacks to get users to visit malicious sites without realizing it."

 

 

how to fix these issues, please help me, its urgent,

 

 

Thanking you inadvance.

  • September 13, 2012
  • Like
  • 0
public with sharing class account_name {
public list<account> accounts=new List<Account>();
Account acc_con=new Account();
public Account getaccdet()
{
return acc_con;
}
public account_name()
{
}
public class innerClass
{
public Account accc{get; set;}
public Integer UniqId{get;set;}
}
public List<innerClass> IList = new List<innerClass>();
public Integer i=0;


public void add()
{
innerclass inn=new innerclass();
Account acc_det=new Account();
acc_det.Name=acc_con.Name;
acc_det.Industry=acc_con.Industry;
acc_det.Phone=acc_con.Phone;
i++;
inn.accc=acc_det;
inn.uniqid=i;
System.debug('******'+inn);
IList.add(inn);
System.debug('iiii'+IList);
acc_con=new account();
}
public List<innerClass> getAlist()
{
return IList;
}
public void save1()
{ 

List<Account> insertaccount = new List<Account>();
for(InnerClass IPs : iLIst)
{
//IPs.accc.AccouontId=acc_con.id;
insertaccount.add(IPs.accc);
System.debug('//////'+insertaccount);
}
insert insertaccount;
}

public void deleteITem()
{
String i=System.CurrentPageReference().getParameters().get('aid');
System.debug('/////'+i);
Integer k = 0;
boolean b = true;
for(InnerClass IP : IList)
{
System.debug('*************'+IP.uniqid);

if(IP.uniqid==Integer.valueOf(System.CurrentPageReference().getParameters().get('aid')))
{ 
b=false;
break;
}
k++;
}
if(!b)
{
IList.remove(k);
}
}
//--------------Test Method--------------//
public static testmethod void test()
{
account_name obj=new account_name();
obj.getaccdet();
obj.add(); 
obj.getAlist(); 
obj.save1();
obj.deleteITem();
}
}

 

Hi 

 

 

public void deleteITem()
{
String i=System.CurrentPageReference().getParameters().get('aid');
System.debug('/////'+i);
Integer k = 0;
boolean b = true;
for(InnerClass IP : IList)
{
System.debug('*************'+IP.uniqid);

if(IP.uniqid==Integer.valueOf(System.CurrentPageReference().getParameters().get('aid')))
{ 
b=false;
break;
}
k++;
}
if(!b)
{
IList.remove(k);
}
}

 am not covering the above code in the test class, plese look at this

 

Thanks in Advance

 

  • August 30, 2012
  • Like
  • 0

Hi All

 

i am created a package and uploaded that package,

 when installing that package in another credentials, it installed succesfully in anothe cedentials.

 

But an getting an error when running that package like this  "page   ABc does not exit"

 

Please give me any idea why am getting this type of error.

 

Thanks

 

 

  • July 31, 2012
  • Like
  • 0

Hi to All,

please write test class for this, its urgernt.

 

 

public with sharing class controlll {  
public cont__c co;
public string country;
public   string transactionid;
public string cardtype;
public controlllApexPages.StandardController controller)
{
    pc = (cont__c)controller.getrecord();
       
}
    public pagereference p1(){
    if(pc.country__c == 'United States')
    {
    country ='US';
      
     asdf3 c = new asdf3();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
    else
    {
     if(pc.country__c == 'Aus')
    {
    country ='AU';
      
 
    asdf4 p = new asdf4();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
   
   }   
          pagereference p4 = page.successpay ;
             p4.getParameters().put('transid', transactionid);
             return p4.setredirect(true);    
                }
            public cont__c  getp(){
            return pc;

}

 

 

 @IsTest(SeeAllData=true) public static void testcontrolll() {
        // Instantiate a new controller with all parameters in the page
        controlll obj = new controll();
        obj.country = 'INDIA';
        obj.transactionid = '4455660018567896';
        obj.cardtype = 'qwerty';
        obj.p1();
        System.assertEquals(obj.p1(),null);

 

}

 

 

i written test class like this, but it covers only 12%

 

am new to test class, please help me hou to  write the remaining testmethod, with code

  • July 31, 2012
  • Like
  • 0

Hi to All,

please write test class for this, its urgernt.

 

 

public with sharing class controlll {  
public cont__c co;
public string country;
public   string transactionid;
public string cardtype;
public controlllApexPages.StandardController controller)
{
    pc = (cont__c)controller.getrecord();
       
}
    public pagereference p1(){
    if(pc.country__c == 'United States')
    {
    country ='US';
      
     asdf3 c = new asdf3();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
    else
    {
     if(pc.country__c == 'Aus')
    {
    country ='AU';
      
 
    asdf4 p = new asdf4();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
   
   }   
          pagereference p4 = page.successpay ;
             p4.getParameters().put('transid', transactionid);
             return p4.setredirect(true);    
                }
            public cont__c  getp(){
            return pc;

}

 

 

 

 

thanking you adavance ,

 

 

  • July 30, 2012
  • Like
  • 0

With out middle layer, by using HTTP RestConnection the HTML post directly to Salesforce, 

is there any posibility no do this,

 

if possible what are the limitaions,

 

please help me.

 

 

 

Thanking you in advance

  • July 30, 2012
  • Like
  • 0

Hi Every One,

 

in the web to lead, when we click on edit, in the edit page we have

                   Web-To-Lead (Check box)

                  Default lead Creator  (look-up)

                  Default Response Template (look-up)

 

 

am created custom field for Default lead Creator , but am not getting the Web-to-lead  and Default Response Template.

 

i need web-to-lead (check box) and Default Response Template (look-up) functionality,

please help me with the sample code,

 

Thanks in Advance

 

  • July 27, 2012
  • Like
  • 0

With out middle layer, by using HTTP RestConnection the HTML post directly to Salesforce, 

is there any posibility no do this,

 

if possible what are the limitaions,

 

please help me.

 

 

 

Thanking you in advance

 

  • July 25, 2012
  • Like
  • 0

 

 

With out middle layer, by using HTTP RestConnection the HTML post directly to Salesforce, 

is there any posibility no do this,

please help me.

 

 

Thanking you in advance

 

 

 

 

  • July 25, 2012
  • Like
  • 0

public with sharing class ChangeOwner {
    public String getQ() {
        return null;
    }


    public String getPUL() {
        return null;
    }

}

 

thanking you in advance

  • July 24, 2012
  • Like
  • 0

public String getMainBody() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('main') != null) {
return this.theXMLDom.getElementsByTagName('main')[0].nodeValue;
} else {
return '';
}
}

public String getSideBar() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('sidebar') != null) {
return this.theXMLDom.getElementsByTagName('sidebar')[0].nodeValue;
} else {
return '';
}
}

public String getFooter() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('footer') != null) {
return this.theXMLDom.getElementsByTagName('footer')[0].nodeValue;
} else {
return '';
}
}

public String getTracker() {
if (this.theXMLDom != null && this.theXMLDom.getElementsByTagName('tracker') != null) {
return this.theXMLDom.getElementsByTagName('tracker')[0].nodeValue;
} else {
return '';
}

 

 

for this code am notable to testcoverage for the RETURN values,

please help me.

Thanking you in Advance

 


  • July 24, 2012
  • Like
  • 0

Hi to all,

 

I have made some code changes in 2 apex classes, when i deploying these two apex classes, it throughs an error like this

: Average Test Coverage across all Apex classes and Triggers is 69%, atleast 75% test coverage is required.

 

when i run those 2 test classes, its test coverage is 84% and 86%.

 

I have deployd with change sets and also i try with Eclipse, getting the same error.

 

Please help me on this error, colud you please suggest any ideas or suggestons it will be greatly apriciated.

 

 

Thanking You in Advance. 

  • August 07, 2013
  • Like
  • 0

Hi ,

 

I wrote  below validation rule, working fine, but from summer 13 release, am getting the error  field is inaccessible.

 

PRIORVALUE(IsSplit) = FALSE && (IsSplit = TRUE)

 

can you please suggest how to get access to IsSplit field.

 

 

Thanking you in advance.

 

 

  • May 21, 2013
  • Like
  • 0

Hi All,

 

i have a requirement like this,   mass transfer of account owner names  with filters,  and keep the opportunity owner name same as old opportunity owner name.

 

when am doing mass transfer records, transfering account owner names, transfers all  account owner names to new owner, here my requirement is i need opportunity owner name does't change. 

 

Please guide me, 

 

thanking you in advance

  • March 19, 2013
  • Like
  • 0

Hi everybody

 

 

how can i implement social media.

Hi Everybody

 

 

           how can i implement CTI  in developer edition

Hi Community

 

I am writing a trigger on contact and trying to get all AccountId s related to the contact  in the following code but i am comming across an error 

Variable does not exist: AccountId.

 

set<Account> ids = new set<Account>();
for(Contact cnt : Trigger.New){
ids.add(cnt.AccountId);
}

 

Do any body let me know what mistake i did.

 

Thanks in advance for your time and help.

public with sharing class classexample {
    public classexample() {
         c= new contact();  
         paramMap = apexpages.currentpage().getparameters();      
         list1 = new List<String>(paramMap.keySet());
         for(integer i=0;i<list1.size();i++){
              paramName = list1.get(i);
              paramValue = paramMap.get(paramName);
              if(paramName != 'returnUrl' && paramName !='core.apexpages.devmode.url'){
              c.put(paramName,paramValue);
              }         
            }   
         returnUrl = apexpages.currentpage().getparameters().get('returnUrl');  

    }

public contact c;
public string lastname{get;set;}
public string firstname{get;set;}
public string paramName{get;set;}
public string paramValue{get;set;}
public List<String> list1{get;set;}
public  map<string,string> paramMap{get;set;}
public  string returnUrl;
   
   
    public pagereference autorun() {  
           
      if(c.lastname!=null){     
       insert c;
       }
       if(returnUrl!=null){
      pagereference p = new pagereference(returnUrl);  
      return p;
      }else{
          return null;
      }

      
     
  }
  }

 Hi to all,

 

in the above class  there are two security issues.

1. returnUrl = apexpages.currentpage().getparameters().get('returnUrl'); 

 

and 

2.

pagereference p = new pagereference(returnUrl);
return p;

 

here Security issue is

"

 Open Redirect Vulnerability

An open redirect is an application that takes a parameter and redirects a user to the parameter value without any validation. This vulnerability is used in phishing attacks to get users to visit malicious sites without realizing it."

 

 

how to fix these issues, please help me, its urgent,

 

 

Thanking you inadvance.

  • September 13, 2012
  • Like
  • 0
public with sharing class account_name {
public list<account> accounts=new List<Account>();
Account acc_con=new Account();
public Account getaccdet()
{
return acc_con;
}
public account_name()
{
}
public class innerClass
{
public Account accc{get; set;}
public Integer UniqId{get;set;}
}
public List<innerClass> IList = new List<innerClass>();
public Integer i=0;


public void add()
{
innerclass inn=new innerclass();
Account acc_det=new Account();
acc_det.Name=acc_con.Name;
acc_det.Industry=acc_con.Industry;
acc_det.Phone=acc_con.Phone;
i++;
inn.accc=acc_det;
inn.uniqid=i;
System.debug('******'+inn);
IList.add(inn);
System.debug('iiii'+IList);
acc_con=new account();
}
public List<innerClass> getAlist()
{
return IList;
}
public void save1()
{ 

List<Account> insertaccount = new List<Account>();
for(InnerClass IPs : iLIst)
{
//IPs.accc.AccouontId=acc_con.id;
insertaccount.add(IPs.accc);
System.debug('//////'+insertaccount);
}
insert insertaccount;
}

public void deleteITem()
{
String i=System.CurrentPageReference().getParameters().get('aid');
System.debug('/////'+i);
Integer k = 0;
boolean b = true;
for(InnerClass IP : IList)
{
System.debug('*************'+IP.uniqid);

if(IP.uniqid==Integer.valueOf(System.CurrentPageReference().getParameters().get('aid')))
{ 
b=false;
break;
}
k++;
}
if(!b)
{
IList.remove(k);
}
}
//--------------Test Method--------------//
public static testmethod void test()
{
account_name obj=new account_name();
obj.getaccdet();
obj.add(); 
obj.getAlist(); 
obj.save1();
obj.deleteITem();
}
}

 

Hi 

 

 

public void deleteITem()
{
String i=System.CurrentPageReference().getParameters().get('aid');
System.debug('/////'+i);
Integer k = 0;
boolean b = true;
for(InnerClass IP : IList)
{
System.debug('*************'+IP.uniqid);

if(IP.uniqid==Integer.valueOf(System.CurrentPageReference().getParameters().get('aid')))
{ 
b=false;
break;
}
k++;
}
if(!b)
{
IList.remove(k);
}
}

 am not covering the above code in the test class, plese look at this

 

Thanks in Advance

 

  • August 30, 2012
  • Like
  • 0

Hi all;

 

I have a beta managed package and have installed it in a new dev org but there is a problem; some of my Static Resources don't seem to be loading.

 

On my home page I have several VF page links. Those links have an image taken from Static Resources; the images are not loading but the link action is working. Also, some standard feature links (e.g., Edit, Delete, etc.) are gray instead of the color called in the CSS, and when hovered over they go invisible.

 

All of my pages and objects are Custom (we are not using any standard objects).

 

I've looked at the Static Resource files and they are present.

 

The VF page CSS file attributes are:

MIME type; text/css

Cache Control; Public

 

The images file attributes are:

MIME type; application/zip

Cache Control; Public

 

Thank you in advance for any suggestions.

Hello All,

 

I have created a site, I have a page called testLogged, which will be accessed by logged in user.

 

But when I hit http://devsitepratik-developer-edition.ap1.force.com/testLogged this url directly

in browser without login then I can see the dashboard which is wrong.

 

So I have used below code for authorization,

 

if(UserInfo.getName().contains('Guest'))
       return page.ErrorPage;

 

but I think I need a better logic for this, so can anybody help me to resolve my queries.

1. Why this is happened? Is it because of portal guest user?

 

2. Is there any Better logic available for this?

 

Thanks in advance.

 

regards,

 

Pratty

 

 

 

  • August 26, 2012
  • Like
  • 0

Hi All

 

i am created a package and uploaded that package,

 when installing that package in another credentials, it installed succesfully in anothe cedentials.

 

But an getting an error when running that package like this  "page   ABc does not exit"

 

Please give me any idea why am getting this type of error.

 

Thanks

 

 

  • July 31, 2012
  • Like
  • 0

Hi to All,

please write test class for this, its urgernt.

 

 

public with sharing class controlll {  
public cont__c co;
public string country;
public   string transactionid;
public string cardtype;
public controlllApexPages.StandardController controller)
{
    pc = (cont__c)controller.getrecord();
       
}
    public pagereference p1(){
    if(pc.country__c == 'United States')
    {
    country ='US';
      
     asdf3 c = new asdf3();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
    else
    {
     if(pc.country__c == 'Aus')
    {
    country ='AU';
      
 
    asdf4 p = new asdf4();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
   
   }   
          pagereference p4 = page.successpay ;
             p4.getParameters().put('transid', transactionid);
             return p4.setredirect(true);    
                }
            public cont__c  getp(){
            return pc;

}

 

 

 @IsTest(SeeAllData=true) public static void testcontrolll() {
        // Instantiate a new controller with all parameters in the page
        controlll obj = new controll();
        obj.country = 'INDIA';
        obj.transactionid = '4455660018567896';
        obj.cardtype = 'qwerty';
        obj.p1();
        System.assertEquals(obj.p1(),null);

 

}

 

 

i written test class like this, but it covers only 12%

 

am new to test class, please help me hou to  write the remaining testmethod, with code

  • July 31, 2012
  • Like
  • 0

Hi to All,

please write test class for this, its urgernt.

 

 

public with sharing class controlll {  
public cont__c co;
public string country;
public   string transactionid;
public string cardtype;
public controlllApexPages.StandardController controller)
{
    pc = (cont__c)controller.getrecord();
       
}
    public pagereference p1(){
    if(pc.country__c == 'United States')
    {
    country ='US';
      
     asdf3 c = new asdf3();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
    else
    {
     if(pc.country__c == 'Aus')
    {
    country ='AU';
      
 
    asdf4 p = new asdf4();
    p.city = pc.city__c;
    p.state = pc.state__c;

insert pc;
     }
   
   }   
          pagereference p4 = page.successpay ;
             p4.getParameters().put('transid', transactionid);
             return p4.setredirect(true);    
                }
            public cont__c  getp(){
            return pc;

}

 

 

 

 

thanking you adavance ,

 

 

  • July 30, 2012
  • Like
  • 0

Hi,

    

i have created web to lead with pick list values, if select other option, automatically created one field in that form.

 

Thank you.