• raju p 4
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 17
    Replies
public class multiselectPicklistAccountANDlead {

public list<wrap>ares;
   public list<wrap> ls= new list<wrap>();
   public list<wrap>getares(){
  for(lead l:[select Account_del__r.Id,Account_del__r.Phone,account_del__r.Name,Id,Name,LastName,city,phone from lead limit 5]){
   ls.add(new wrap(false,l));
          
    return ls;
    }}
        public class wrap{
           public Boolean sel{set;get;}
           public account ac{set;get;}
           public lead ld{set;get;}
             public wrap(Boolean b,account a,lead l){
              sel=b;
              ac=a;
              ld=l;
             }
        }
}

i am geting this Error>>>>>>>>>>>>>>

Error: multiselectPicklistAccountANDlead Compile Error: Constructor not defined: [multiselectPicklistAccountANDlead.wrap].<Constructor>(Boolean, Lead) at line 7 column 11
public class sendsmsTwilio {
public string Messages{set;get;}
public string ACCOUNTSID{set;get;}  
public string AUTHTOKEN{set;get;}
  public string Mobile{set;get;}
public string result{set;get;}
public contact con;

public sendsmsTwilio(ApexPages.StandardController controller) {
con =(contact)controller.getrecord();
}
public void sendsmsTwilio(){
BoxIntrgration__c c= [SELECT  accountsid__c, AUTHTOKEN__c from BoxIntrgration__c where name=:'twilio'];
ACCOUNTSID=c.accountSid__c;
AUTHTOKEN=c.AUTHTOKEN__c;

Http p= new http();
HttpRequest req= new HttpRequest();
 string url='https://api.twilio.com/2010-04-01/Accounts/AC58cf47802fa54fe399e85fd822bf2103/Messages.json';
   string body ='Well come';
          body=body+'&To=+con.phone';
           body=body+'&AUTHTOKEN';
            body=body+'&MessagingServiceSid=MG3d0796691bb5c2d7ed266c1850240962';               

req.setmethod('POST');
httpresponse res= new httpResponse();
  // try{
res=p.send(req);
//}
//catch(Exception e){
//system.debug(e);
//}
result=res.getbody();

>>>>>>>>>>>>>>>>>
<apex:page standardController="contact" extensions="sendsmsTwilio">
<apex:form >
<apex:pageblock >
<apex:inputtext value="{!contact.phone}"/>

<apeX:pageblockButtons >
<apex:commandButton value="SendSms" action="{!sendsmsTwilio}"/>
</apeX:pageblockButtons>
</apex:pageblock>
</apex:form>
{!result}
  
</apex:page>
 i am getting  callout null endpoint url at line 28,
 i am trying to send sms . i use try cath but i am not able recive the sms




}
       
}
 i am getting this error >>

System.CalloutException: Endpoint can not be null
Error is in expression '{!sendsmsTwilio}' in component <apex:commandButton> in page sendsmstwilio: Class.sendsmsTwilio.sendsmsTwilio: line 28, column 1
Class.sendsmsTwilio.sendsmsTwilio: line 28, column 1

and its apex code is>>
public class sendsmsTwilio {
public string Messages{set;get;}
public string ACCOUNTSID{set;get;}  
public string AUTHTOKEN{set;get;}
  public string Mobile{set;get;}
public string result{set;get;}
public contact con;

public sendsmsTwilio(ApexPages.StandardController controller) {
con =(contact)controller.getrecord();
}
public void sendsmsTwilio(){
BoxIntrgration__c c= [SELECT  accountsid__c, AUTHTOKEN__c from BoxIntrgration__c where name=:'twilio'];
ACCOUNTSID=c.accountSid__c;
AUTHTOKEN=c.AUTHTOKEN__c;

Http p= new http();
HttpRequest req= new HttpRequest();
 string url='https://api.twilio.com/2010-04-01/Accounts/AC58cf47802fa54fe399e85fd822bf2103/Messages.json';
   string body ='Well come';
          body=body+'&To=+con.phone';
           body=body+'&AUTHTOKEN';
            body=body+'&MessagingServiceSid=MG3d0796691bb5c2d7ed266c1850240962';               

req.setmethod('POST');
httpresponse res= new httpResponse();
res=p.send(req);
result=res.getbody();


}
       
}
public class sendsmsTwilio {
public string Messages{set;get;}
public string ACCOUNTSID{set;get;}  
public string AUTHTOKEN{set;get;}
  public string Mobile{set;get;}
public string result{set;get;}
public contact con;

public sendsmsTwilio(ApexPages.StandardController controller) {
con =(contact)controller.getrecord();
}
public void sendsmsTwilio(){
BoxIntrgration__c c= [SELECT  accountsid__c, AUTHTOKEN__c from BoxIntrgration__c where name=:'twilio'];
ACCOUNTSID=c.accountSid__c;
AUTHTOKEN=c.AUTHTOKEN__c;

Http p= new http();
HttpRequest req= new HttpRequest();
 string url='https://api.twilio.com/2010-04-01/Accounts/AC58cf47802fa54fe399e85fd822bf2103/Messages.json';
   string body ='Well come';
          body=body+'&To=+con.phone';
           body=body+'&AUTHTOKEN';
            body=body+'&MessagingServiceSid=MG3d0796691bb5c2d7ed266c1850240962';               

req.setmethod('POST');
httpresponse res= new httpResponse();
res=p.send(req);
result=res.getbody();


}
       
}

 here is  i am trying to send sms from contact  and its visualforce page

<apex:page standardController="contact" extensions="sendsmsTwilio">
<apex:form >
<apex:pageblock >
<apex:inputtext value="{!contact.phone}"/>

<apeX:pageblockButtons >
<apex:commandButton value="SendSms" action="{!sendsmsTwilio}"/>
</apeX:pageblockButtons>
</apex:pageblock>
</apex:form>
{!result}
  
</apex:page>

 i  tryed using try and catch but , but i am not geting message ,please do the needful

 
public class WhenyouCreateContactCreateAccount {
       
    public static void CreateAccount(list<contact>cons){
         set<id>ids= new set<id>();
         list<account>acc= new list<account>();
      
            for(contact c:cons){
               ids.add(c.AccountId);
  acc=[select name,phone from account where id IN:ids];
                for(account a:acc){

    a.Name=c.Name;
   a.Phone=c.phone;
 
}
 insert  acc;
}
    }}



trigger WhenyouCreateContactCreateAccount on Contact (after insert,after update) {
    WhenyouCreateContactCreateAccount.CreateAccount(trigger.new);

}

please do the needful, where i am doing wrong
Hi Developers,
when i am submit the button  ia m geting This error
<apex:page controller="BoXIntegration" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons location="Top">
<apex:commandButton value="Code" action="{!getCode}"/>
</apex:pageBlockButtons>
<apex:inputtext value="{!ClientId}" size="40"/><br/> 
URL:<apex:outputLabel value="{!uri}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
>>>>>>>>>>>>>
public class BoXIntegration {
    public string ClientId{set;get;}
    public string ClientScr{set;get;}
    public string uri{set;get;}
    public string Acstoken{set;get;}
    public  BoXIntegration(){
      uri='https://c.ap4.visual.force.com/apex/BoxResponse';
    }
    public pageReference getCode(){
   string url='https://account.box.com/api/oauth2/authorize';
        url='url+esponse_type=code&client_id='+ClientId+'&redirect_uri='+uri+'&state=Raju';
        pageReference p= new pageReference(url);
         return p;
    } 
}
 and added url added in remotesite seting
even also i am using readonly  atribute ,  geting same error please do the needful,

Collection size 10,028 exceeds maximum size of 10,000. 


<apex:page controller="Leaddisplay" readOnly="true">

       <apex:pageBlock >
           <apex:DataTable value="{!ld}" var="a">
               <apex:column value="{!a.Lastname}"  headerValue="LastName"/>
            <apex:column value="{!a.company}"  headerValue="companyName"/>
               <apex:column value="{!a.status}"  headerValue="LeadStatus"/>
                     <apex:column value="{!a.phone}"  headerValue="phone"/>
               </apex:DataTable>
             
                 </apex:pageBlock>
      </apex:page>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>....


public class Leaddisplay {
    public list<lead>ld{set;get;}
    public Leaddisplay(){
       // ld= new list<lead>();
       ld=[select  lastname,phone,company,status from lead];
        
    }

}

  
 
trigger Agregate on Student__c(after insert,after Delete,after undelete) {
       list<id> ids= new list<id>();
        if(trigger.isinsert ||  trigger.isUndelete){
           for(Student__c s:trigger.new){
              
              
               }
               }
               if(trigger.isDelete){
               for(Student__c s:trigger.old){
                ids.add(s.Course__c);
           }
           }
            list<Course__c> x= new  list<Course__c>();
       // list<Course__c> cors=[select NUmberOf_Student__c,(select Course__c from Students__r)from Course__c  where id=:ids];
      list<course__c> cors=[select name, NUmberOf_Student__c,(select id,Course__c from Students__r)from course__c where id in:ids ];
 
        cors.NUmberOf_Student__c=cors.Students__r.size(); 
         //   x.add(cors);
            }
       /*    try{

               update x;
               }
               Catch(Exception e){
        System.debug('Exception :'+e.getMessage());
    }*/
i am geeting veraiable doesnot exist ie>.Students__r
public class AgregateFunctionOnTestObject {
    public static void Afterupdate(Map<id,Test123__c> newmap,Map<id,Test123__c>oldmap){
           list<id> ids= new list<id>();
        for(id key: oldmap.keyset()){
            Test123__c n1=newmap.get(key);
            Test123__c o1=oldmap.get(key);
             ids.add(key);
        }
    }
            list<Test__c> tc= new list<Test__c>();
    list<Test__c> t=[select Percentage__c,(select id from Test123s__r)from Test__c where id=:ids];
        for(Test__c t1:t){
            for(Test123__c r:Test123s__r){
            t1.Percentage__c= t1.Test123s__r.size();
            tc.add(t1);
        }        }  
}
        
    
         

 
Update account phone number by contact phone number  by account phone number on before update, it is possible or not,
 i am trying using berfore update with map, i am not geting 

// update AccountPHONE by CONTACT
   public Class BeoreupdateAccountPhone{
       public static void beforeupdate(map<id,contact>newmap,map<id,contact>oldmap){
       
        set<id> ids= new set<id>();
       for(id key:oldmap.keyset()){
         contact n1= newmap.get(key);
         contact o1= oldmap.get(key);
             ids.add(key);
             
             list<account> ac= new list<account>();
             list<account> acc=[select phone,(select phone from contacts) from account where id=:ids];
                 for(account a:acc){
                    for(contact c:a.contacts){
                       if(a.phone!= c.phone){
                       a.phone= c.phone;
                          // acc.add((c.phone).a.contacts);
                          acc.add(a);
                           }
                           }
                       }
                       update acc;
                       }
                         }}
I have little dought in trigger  can we update account phone number by contact phone number >ON Beffore update,,please focus on this, i am using map i am not getting need know for learning purpose 
 i know after it is possible please brifly explain me,

// update AccountPHONE by CONTACT
   public Class BeoreupdateAccountPhone{
       public static void beforeupdate(map<id,contact>newmap,map<id,contact>oldmap){
       
        set<id> ids= new set<id>();
       for(id key:oldmap.keyset()){
         contact n1= newmap.get(key);
         contact o1= oldmap.get(key);
             ids.add(key);
             
             list<account> ac= new list<account>();
             list<account> acc=[select phone,(select phone from contacts) from account where id=:ids];
                 for(account a:acc){
                    for(contact c:a.contacts){
                       if(a.phone!= c.phone){
                       a.phone= c.phone;
                           //acc.add((c.phone).contacts);
                           }
                           }
                       }
                       update acc;
                       }
                         }}
This page has an error. You might just need to refresh it. Action failed: c:LightUIcomponent2$controller$callme [omponent is not defined] Failing descriptor: {c:LightUIcomponent2$controller$callme}
    when i am going to run lighting application i am getting this error 

>>1   Component 

<aura:component >
    <ui:inputText label="Enter Name" placeholder="employee Name" aura:id="name"/>
    <ui:inputText label="My name" aura:id="Myname"/>
    <ui:button label="submit" press="{!c.callme}"/>
</aura:component>
>>>>>>>>>>>>>>2 contoller
({
    callme :function(component) {
        var name=component.find("name").get("v.value");
                omponent.find("my name").get("v.value",name);

        
    }
}) 
3>>>>>>>>>>>>application 3
<aura:application >
    <c:LightUIcomponent2/>
</aura:application>

i am learning lighting >.please help me out
https://ap5.salesforce.com/setup/secur/RemoteAccessErrorPage.apexp?error=invalid_grant&error_description=expired+authorization+code

We can't authorize you because of an OAuth error. For more information, contact your Salesforce administrator.
OAUTH_APPROVAL_ERROR_GENERIC : An unexpected error has occured during authentication. Please try again.
i am not geting what is this when trying to login lighting trailhead i am geting this error
 
public class multiselectPicklistAccountANDlead {

public list<wrap>ares;
   public list<wrap> ls= new list<wrap>();
   public list<wrap>getares(){
  for(lead l:[select Account_del__r.Id,Account_del__r.Phone,account_del__r.Name,Id,Name,LastName,city,phone from lead limit 5]){
   ls.add(new wrap(false,l));
          
    return ls;
    }}
        public class wrap{
           public Boolean sel{set;get;}
           public account ac{set;get;}
           public lead ld{set;get;}
             public wrap(Boolean b,account a,lead l){
              sel=b;
              ac=a;
              ld=l;
             }
        }
}

i am geting this Error>>>>>>>>>>>>>>

Error: multiselectPicklistAccountANDlead Compile Error: Constructor not defined: [multiselectPicklistAccountANDlead.wrap].<Constructor>(Boolean, Lead) at line 7 column 11
 i am getting this error >>

System.CalloutException: Endpoint can not be null
Error is in expression '{!sendsmsTwilio}' in component <apex:commandButton> in page sendsmstwilio: Class.sendsmsTwilio.sendsmsTwilio: line 28, column 1
Class.sendsmsTwilio.sendsmsTwilio: line 28, column 1

and its apex code is>>
public class sendsmsTwilio {
public string Messages{set;get;}
public string ACCOUNTSID{set;get;}  
public string AUTHTOKEN{set;get;}
  public string Mobile{set;get;}
public string result{set;get;}
public contact con;

public sendsmsTwilio(ApexPages.StandardController controller) {
con =(contact)controller.getrecord();
}
public void sendsmsTwilio(){
BoxIntrgration__c c= [SELECT  accountsid__c, AUTHTOKEN__c from BoxIntrgration__c where name=:'twilio'];
ACCOUNTSID=c.accountSid__c;
AUTHTOKEN=c.AUTHTOKEN__c;

Http p= new http();
HttpRequest req= new HttpRequest();
 string url='https://api.twilio.com/2010-04-01/Accounts/AC58cf47802fa54fe399e85fd822bf2103/Messages.json';
   string body ='Well come';
          body=body+'&To=+con.phone';
           body=body+'&AUTHTOKEN';
            body=body+'&MessagingServiceSid=MG3d0796691bb5c2d7ed266c1850240962';               

req.setmethod('POST');
httpresponse res= new httpResponse();
res=p.send(req);
result=res.getbody();


}
       
}
public class sendsmsTwilio {
public string Messages{set;get;}
public string ACCOUNTSID{set;get;}  
public string AUTHTOKEN{set;get;}
  public string Mobile{set;get;}
public string result{set;get;}
public contact con;

public sendsmsTwilio(ApexPages.StandardController controller) {
con =(contact)controller.getrecord();
}
public void sendsmsTwilio(){
BoxIntrgration__c c= [SELECT  accountsid__c, AUTHTOKEN__c from BoxIntrgration__c where name=:'twilio'];
ACCOUNTSID=c.accountSid__c;
AUTHTOKEN=c.AUTHTOKEN__c;

Http p= new http();
HttpRequest req= new HttpRequest();
 string url='https://api.twilio.com/2010-04-01/Accounts/AC58cf47802fa54fe399e85fd822bf2103/Messages.json';
   string body ='Well come';
          body=body+'&To=+con.phone';
           body=body+'&AUTHTOKEN';
            body=body+'&MessagingServiceSid=MG3d0796691bb5c2d7ed266c1850240962';               

req.setmethod('POST');
httpresponse res= new httpResponse();
res=p.send(req);
result=res.getbody();


}
       
}

 here is  i am trying to send sms from contact  and its visualforce page

<apex:page standardController="contact" extensions="sendsmsTwilio">
<apex:form >
<apex:pageblock >
<apex:inputtext value="{!contact.phone}"/>

<apeX:pageblockButtons >
<apex:commandButton value="SendSms" action="{!sendsmsTwilio}"/>
</apeX:pageblockButtons>
</apex:pageblock>
</apex:form>
{!result}
  
</apex:page>

 i  tryed using try and catch but , but i am not geting message ,please do the needful

 
public class WhenyouCreateContactCreateAccount {
       
    public static void CreateAccount(list<contact>cons){
         set<id>ids= new set<id>();
         list<account>acc= new list<account>();
      
            for(contact c:cons){
               ids.add(c.AccountId);
  acc=[select name,phone from account where id IN:ids];
                for(account a:acc){

    a.Name=c.Name;
   a.Phone=c.phone;
 
}
 insert  acc;
}
    }}



trigger WhenyouCreateContactCreateAccount on Contact (after insert,after update) {
    WhenyouCreateContactCreateAccount.CreateAccount(trigger.new);

}

please do the needful, where i am doing wrong
Hi Developers,
when i am submit the button  ia m geting This error
<apex:page controller="BoXIntegration" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons location="Top">
<apex:commandButton value="Code" action="{!getCode}"/>
</apex:pageBlockButtons>
<apex:inputtext value="{!ClientId}" size="40"/><br/> 
URL:<apex:outputLabel value="{!uri}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
>>>>>>>>>>>>>
public class BoXIntegration {
    public string ClientId{set;get;}
    public string ClientScr{set;get;}
    public string uri{set;get;}
    public string Acstoken{set;get;}
    public  BoXIntegration(){
      uri='https://c.ap4.visual.force.com/apex/BoxResponse';
    }
    public pageReference getCode(){
   string url='https://account.box.com/api/oauth2/authorize';
        url='url+esponse_type=code&client_id='+ClientId+'&redirect_uri='+uri+'&state=Raju';
        pageReference p= new pageReference(url);
         return p;
    } 
}
 and added url added in remotesite seting
even also i am using readonly  atribute ,  geting same error please do the needful,

Collection size 10,028 exceeds maximum size of 10,000. 


<apex:page controller="Leaddisplay" readOnly="true">

       <apex:pageBlock >
           <apex:DataTable value="{!ld}" var="a">
               <apex:column value="{!a.Lastname}"  headerValue="LastName"/>
            <apex:column value="{!a.company}"  headerValue="companyName"/>
               <apex:column value="{!a.status}"  headerValue="LeadStatus"/>
                     <apex:column value="{!a.phone}"  headerValue="phone"/>
               </apex:DataTable>
             
                 </apex:pageBlock>
      </apex:page>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>....


public class Leaddisplay {
    public list<lead>ld{set;get;}
    public Leaddisplay(){
       // ld= new list<lead>();
       ld=[select  lastname,phone,company,status from lead];
        
    }

}

  
 
public class AgregateFunctionOnTestObject {
    public static void Afterupdate(Map<id,Test123__c> newmap,Map<id,Test123__c>oldmap){
           list<id> ids= new list<id>();
        for(id key: oldmap.keyset()){
            Test123__c n1=newmap.get(key);
            Test123__c o1=oldmap.get(key);
             ids.add(key);
        }
    }
            list<Test__c> tc= new list<Test__c>();
    list<Test__c> t=[select Percentage__c,(select id from Test123s__r)from Test__c where id=:ids];
        for(Test__c t1:t){
            for(Test123__c r:Test123s__r){
            t1.Percentage__c= t1.Test123s__r.size();
            tc.add(t1);
        }        }  
}
        
    
         

 
This page has an error. You might just need to refresh it. Action failed: c:LightUIcomponent2$controller$callme [omponent is not defined] Failing descriptor: {c:LightUIcomponent2$controller$callme}
    when i am going to run lighting application i am getting this error 

>>1   Component 

<aura:component >
    <ui:inputText label="Enter Name" placeholder="employee Name" aura:id="name"/>
    <ui:inputText label="My name" aura:id="Myname"/>
    <ui:button label="submit" press="{!c.callme}"/>
</aura:component>
>>>>>>>>>>>>>>2 contoller
({
    callme :function(component) {
        var name=component.find("name").get("v.value");
                omponent.find("my name").get("v.value",name);

        
    }
}) 
3>>>>>>>>>>>>application 3
<aura:application >
    <c:LightUIcomponent2/>
</aura:application>

i am learning lighting >.please help me out

I'm getting the followig error in my test method:

constructor not defined: [AccountOpenCasesExtension].<Constructor>()

 

I instantiated the class file and called my initialize method that is called within the constructor.  I'm not clear on why the constructor is not defined.  Shouldn't the constructor execute when the class is instantiated?

 

Here is my class file:

 

public class AccountOpenCasesExtension { private List<Account> accounts; public List<Account> getAccounts() { return accounts; } public AccountOpenCasesExtension(ApexPages.StandardController stdController) { init((Account)stdController.getRecord()); //accounts = [Select id, name, (Select Owner.Name, Contact.Name, CaseNumber, Subject, CreatedDate From Cases WHERE IsClosed = false) From Account a WHERE id =: stdController.getId()]; } public void init(Account a) { accounts = [Select id, name, (Select Owner.Name, Contact.Name, CaseNumber, Subject, CreatedDate From Cases WHERE IsClosed = false) From Account a WHERE id =: a.Id]; } static testMethod void test() { Account acct = [Select id, name, (Select Owner.Name, Contact.Name, CaseNumber, Subject, CreatedDate From Cases WHERE IsClosed = false) From Account a LIMIT 1]; AccountOpenCasesExtension ctrl = new AccountOpenCasesExtension(); ctrl.init(acct); } }