• CharlyG
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 18
    Replies
Hi,  I have a couple of triggers that sends out sms's based on lead and contact data changes. We are sending these sms's via HTTP to a sms service provider. I get 100% test coverage on my triggers, but 0% on my class... Any help will be appreciated.
TRIGGER

trigger SMSNewLead on Lead (after insert) {
  for(Lead l : Trigger.new){
     //check that the status is new and the owner is not a queue, rating must be hot
     if(l.Status == 'New' && (''+l.OwnerId).startsWith('005') && l.Lead_Rating__c == 'Hot'){
       SmsNewLead.basicSmsNewLead(l.Id, l.Name);
     }
  }
}

 

 

CLASS

public class SmsNewLead {  
  
   //Future annotation to mark the method as async.
   @Future(callout=true) 
   
    public static void basicSmsNewLead(String Id, String Name){       
         
            //get the lead details
            Lead l = [Select Id, Name, Initials__c, Salutation, LastName, Status, OwnerId, MobilePhone FROM Lead WHERE Id=:id  ];           
             
            //Get the user details
            User u = [SELECT Id, LastName, FirstName, Name, Title, MobilePhone FROM User Where id = :l.ownerId];
             
            String Clientsalutation = l.Salutation;
            String ClientInitials = l.Initials__c;
            String Clientlastname = l.LastName;
            String clientcellphonenumber = l.MobilePhone;                                  

            string CurrentDate = string.valueof(System.now());
            CurrentDate = CurrentDate.replace('-','');
            CurrentDate = CurrentDate.replace(' ','');
            CurrentDate = CurrentDate.replace(':','');
			
            String Data = 'data=ZCF\nChanged for the purpose of this post|New Lead: Please contact .......|'+id+'1||';
               Http http = new Http();
               HttpRequest req = new HttpRequest();
               req.setEndpoint('http://correcturl/');
               req.setMethod('POST');
               req.setBody(Data);

               HttpResponse res = http.send(req);
                     
            //check the response
            if (res.getStatusCode() == 200) {   
               //update lead
               l.SMS_To_Consultant__c = true;
               l.SMS_To_Consultant_Result__c = res.getBody();
               update l;
            } else {
               //update lead
               l.SMS_To_Consultant__c = false;
               l.SMS_To_Consultant_Result__c = res.getBody();
               update l;
            }
    }         
 }

 

TEST METHOD
 
 Global Class TestSMSNotifications{
    
    static testMethod void SMSLeadTest(){
        
        //SMS to Consultant - New Lead
        Lead lt = new Lead(FirstName='Test1', LastName='Method', Status = 'New', MobilePhone='0833004553', Initials__c='T', Company='Test', phone='012345678',
        LeadSource='Client', Area__c='Free State', Gender__c='Female', Qualification_1__c='Q1', Qualification_2__c='Q2', Duration_1__c='D1', Institution_1__c='I1', Known_As__c='test' );
        insert lt;

        Test.startTest();
            SmsNewLead.basicSmsNewLead(lt.id, lt.Name); 
        Test.stopTest();        
                
    }  
}

 

 

Hi
 
I am using the data loader to UPSERT some Opportunity records linked to a custom object with an external ID field, and get the following error on some records (not all):
 
java.sql.SQLException: ORA-20016:
ORA-06512: at "DOC.CUSER", line 2771
ORA-06512: at "DOC.SOPPORTUNITY", line 692
ORA-06512: at line 1
: {call sOpportunity.insert_detail(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
 
What does this mean and how can I fix it?
 
Thanks
 
Charly

Just started developing with VF.

 

I have the following:

 

<apex:page sidebar="false" title="Article List">

<knowledge:articleTypeList articleTypeVar="articleType">      {!articleType.label}<br /> </knowledge:articleTypeList>

<knowledge:articleList articleVar="article">     {!article.title} <br/> </knowledge:articleList>  

</apex:page>

 

I'm able to display the article types, but not the article title.

 

I'm believe I have set up the article permission and user permissions to read the articles accordingly.

 

Any help you be great to hear.


Thanks.

Hi All,

I'm having a tough time composing a validation rule.

We have three custom fields on our case page that restricts an order from going through if an account has certain requirements - Credit Card Only, Purchase Order Only, Cannot Order Supplies.  These fields are formula fields and pulled from the account page:  

Account_Requires_CC__c    (TRUE/FALSE)
Account_Requires_PO__c    (TRUE/FALSE)         
Account_Requires_No_Supplies__c    (TRUE/FALSE)

In some cases, Account_Requires_CC__c and Account_Requires_PO__c could both be true, because the account requires either a PO or a CC to be used on order.

I wrote this rule, but I am recieving errors that it isn't valid:

IF(
(AND(Account_Requires_PO__c = "TRUE"), (Account_Requires_CC__c = "TRUE"),
ISPICKVAL ( Payment_Type__c  , "Open Account" )),
OR( PO__c = "",  CC__c ="")

In my mind, the rule says that if both Account_Requires_CC__c and Account_Requires_PO__c are TRUE and the pick value Payment_Type__c is "Open Account", and either the PO__c field or the CC_c fields are blank, then the forumula would be true and an error message would flag.

Is my logic incorrect?  Any thoughts?

 

Thanks!

 

Mike

On our opportunity page when it is marked closed won and paid it is changing the paid date to the day before at 7:00 pm.  Can be edited but trying to figure where and why it is pulling the day before.  Has anyone run into anything like this or have any ideas?

Hi.

 

I have a Visualforce page in it I have a pageblock and there is a button 'Add Line'. Now I want a grid in which  a new line should be added just for preview purpose. On the page i have a Save button, and when it is clicked I want to add all the Lines present in the grid to be saved in the Line__c object.  Can I do this in VFpage? Please provide a good example. Thank you.

 

NOTE: While adding new line in the grid I dont want to refresh the page.

 

Regards,

Meer Salman

  • March 16, 2012
  • Like
  • 0

We are in the process of merging 2 salesforce orgs. It would be really helpful if there was a printable report that showed all standard objects as well as all customizations to SalesForce. (I'm not interested in the user-data, just the meta-data) Do any such reporting tools exist?

 

Thanks for any links or suggestions. 

 

Mike

  • March 15, 2012
  • Like
  • 0

Win 32 system, XP OS. Using Eclipse Helios, Followed the following URL to do the very basic - install the eclipse plugin for Force.com, but no dice.  Here is the error at 47% everytime.  I don't see any resolution when i searched online.  Not sure if i am doing something wrong, or maybe the install documentation is incorrect, or may be an error in the installation package.  Pls. take a look and let me know what is going on.  Thanks.

 

An error occurred while collecting items to be installed
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 7251ab037ae632a5a9835c7c07210451 and found 7fcf87fad05f91b6c00745869ba36929.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.core,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 44db36699ca7fdd38917fced4e63c3b3 and found 7c211598ddd92347f0671c339fda7ac6.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.documentation,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 6d87eb2e76e7e19f7b709682e5272dfc and found 25a4e7db6ebe25b7a3cbcfd8119d38f2.

 

Hi,  I have a couple of triggers that sends out sms's based on lead and contact data changes. We are sending these sms's via HTTP to a sms service provider. I get 100% test coverage on my triggers, but 0% on my class... Any help will be appreciated.
TRIGGER

trigger SMSNewLead on Lead (after insert) {
  for(Lead l : Trigger.new){
     //check that the status is new and the owner is not a queue, rating must be hot
     if(l.Status == 'New' && (''+l.OwnerId).startsWith('005') && l.Lead_Rating__c == 'Hot'){
       SmsNewLead.basicSmsNewLead(l.Id, l.Name);
     }
  }
}

 

 

CLASS

public class SmsNewLead {  
  
   //Future annotation to mark the method as async.
   @Future(callout=true) 
   
    public static void basicSmsNewLead(String Id, String Name){       
         
            //get the lead details
            Lead l = [Select Id, Name, Initials__c, Salutation, LastName, Status, OwnerId, MobilePhone FROM Lead WHERE Id=:id  ];           
             
            //Get the user details
            User u = [SELECT Id, LastName, FirstName, Name, Title, MobilePhone FROM User Where id = :l.ownerId];
             
            String Clientsalutation = l.Salutation;
            String ClientInitials = l.Initials__c;
            String Clientlastname = l.LastName;
            String clientcellphonenumber = l.MobilePhone;                                  

            string CurrentDate = string.valueof(System.now());
            CurrentDate = CurrentDate.replace('-','');
            CurrentDate = CurrentDate.replace(' ','');
            CurrentDate = CurrentDate.replace(':','');
			
            String Data = 'data=ZCF\nChanged for the purpose of this post|New Lead: Please contact .......|'+id+'1||';
               Http http = new Http();
               HttpRequest req = new HttpRequest();
               req.setEndpoint('http://correcturl/');
               req.setMethod('POST');
               req.setBody(Data);

               HttpResponse res = http.send(req);
                     
            //check the response
            if (res.getStatusCode() == 200) {   
               //update lead
               l.SMS_To_Consultant__c = true;
               l.SMS_To_Consultant_Result__c = res.getBody();
               update l;
            } else {
               //update lead
               l.SMS_To_Consultant__c = false;
               l.SMS_To_Consultant_Result__c = res.getBody();
               update l;
            }
    }         
 }

 

TEST METHOD
 
 Global Class TestSMSNotifications{
    
    static testMethod void SMSLeadTest(){
        
        //SMS to Consultant - New Lead
        Lead lt = new Lead(FirstName='Test1', LastName='Method', Status = 'New', MobilePhone='0833004553', Initials__c='T', Company='Test', phone='012345678',
        LeadSource='Client', Area__c='Free State', Gender__c='Female', Qualification_1__c='Q1', Qualification_2__c='Q2', Duration_1__c='D1', Institution_1__c='I1', Known_As__c='test' );
        insert lt;

        Test.startTest();
            SmsNewLead.basicSmsNewLead(lt.id, lt.Name); 
        Test.stopTest();        
                
    }  
}

 

 

I recently created my first visualforce page where I'm listing through a collection of information. I've tried both Datatable and pageblocktable and I'm having the same issue with both. When the page renders it appears that the table takes less than 50% of the actual page. I've tried changing the width on the table, the width of each column, I've tried columnswidth and various combination including setting the number of columns in the table. Each time I get very minimal changes where the total width of the table never exceeds 50% of the page width. This causes the data strings in my columns to wrap and appear "smushed" when you can clearly see plenty of "Blank" space off to the right. Example of one of my many attempts is below. Any suggestions on how I can make my table actually use the full space available and not end up with really narrow columns? The only time I can seem to "stretch" the column is when I only display  1 or 2 columns and not the complete 4.
 
Code:
          <apex:pageblocktable value="{!Issues}" var="each" width="100%">
            <apex:column width="100%" headervalue="Issue"  >{!each.Issue__c}</apex:column> 
            <apex:column width="100%" headervalue="Message Type" > {!each.Type__c}</apex:column>
            <apex:column width="100%" headervalue="Reported Date" ><apex:outputfield value="{!each.Date__c}"/></apex:column>
            <apex:column  width="100%" headervalue="Comments" >{!each.Client_Comments__c}</apex:column>
          </apex:pageblocktable>

 
Does anyone know anything about the forthcoming integration between Joomla and SalesForce being designed by Picnet?
 
I have tried to contact them with regards to the tool, but have heard nothing yet.
 
 
Regards,
Warren
Hi,
         Just got a question about lead and contact.
         So I have got all these qualified leads, when I push them across to salesforce, I can do Option 1: push them across to become leads and immediately after that, convert them to contacts; Option 2: push them across to become contacts directly which bypasses the lead thing.  If I go with option 2, what do I have to lose? What is the difference between these two options?
         Thanks in advance for your insight.


  • April 06, 2007
  • Like
  • 0
Is there a way to set up a workflow outbound message, that will update a field on a record in salesforce.

for eg, when an opportunity closes, we want a field on a custom object which is related to opportunity to be changed to Not Available.

Can this be configured using outbound messaging? All and any leads, thoughts are appreciated.
Thanks!
Niyati
Consultant
Bluewolf
Hi
 
I am using the data loader to UPSERT some Opportunity records linked to a custom object with an external ID field, and get the following error on some records (not all):
 
java.sql.SQLException: ORA-20016:
ORA-06512: at "DOC.CUSER", line 2771
ORA-06512: at "DOC.SOPPORTUNITY", line 692
ORA-06512: at line 1
: {call sOpportunity.insert_detail(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
 
What does this mean and how can I fix it?
 
Thanks
 
Charly
I seem to have gotten stuck!
I am looking to create a validation rule that will validate a field called ticket number:

The rule needs to check that the value:
1) begins with "LTK"
2) contains more than one number
3) ends with "X"

this is so simple, that I feel stupid asking...

:smileysad:
We've got some custom objects in Salesforce where we currently require our end users to click a web link on an account to create.  The web link is basically passing information via the URL to fields on the edit screen.  In addition, it enforces that the recordtype is always "New".  The users have access to other recordtypes, which the these new records eventually become, but they always need to start at "New".
 
With the Winter 07 release, I'm looking at the options of either removing the standard New button totally, and potentially overriding the "New" button with similar code as the weblink to pass information to the edit screen.  I would prefer to override the "New" button, since it shows up in the related lists, along with the hover button related lists.
 
However, it appears that when you override the "New" button with an s-control, it going to the recordtype selection screen prior to running the s-control.  There does not appear to be a way to have the "New" button force a recordtype like a weblink can. 
 
Is anyone aware of any way to avoid the recordtype selection screen when overriding the "New" button on an object?  Short of adjusting the profile of the user to only let them create new recordtypes, (which isn't feasible here, since the user later changes the recordtypes) I haven't been able to figure out a way.
 
Thanks!
 
Jon Keener