• ItsJustCode2
  • NEWBIE
  • 33 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 8
    Replies
When using the Dataloader, does the rule still apply that workflow won't fire for batch sizes > 20 ???  Used to I remember that batch sizes set to greater than 20 records at a time workflow wouldn't fire.  Has that been changed?  If so, what are the new rules?

Thank you,
Steve Laycock
As of this morning anything that inserts a lead which would also invoke a webservice call out separately in code is erroring out with the following error.

" Methods defined as TestMethod do not support Web service callouts null; Methods defined as TestMethod do not support Web service callouts null"

Here is a sample of one of the web service call outs... Please help....  Kudos given...
trigger ImmediateResponseUniversal2 on Lead (after insert) {

ID[] ids = new List<ID>();

    String url = 'https://cmncom.insidesales.com/do=noauth/immediate_response';

    String body;
     
    for (Lead l : Trigger.new) 
    {
         if(l.School__c != 'CMNTest' && l.LeadSource != 'Inbound Call' && l.LeadSource != 'School HST' && 
            l.LeadSource != 'Inbound Call' && l.LeadSource != 'School HST' &&
            l.Status != 'Application' && l.Status != 'Enrolled' && l.Status != 'Started' && l.Status != 'Closed')
         {   
           ids.add(l.id);
         }  

    }                        
      

      if (!ids.isEmpty()) 
      {
        if(trigger.isInsert)
        {
              body = 'method=call_now&dialer_initiative_id=67&ids='+EncodingUtil.urlEncode(JSON.serialize(ids), 'ISO-8859-1');              
              HTTPRequestSender.sendHTTPRequest(url, body);
        }

      }
}




 
I seem to have problems around line 43 where I have my

zipMapState.get(l.postalcode.substring(0,5));

Statement.  I was wondering if there is a more efficient way of doing this??  Please help if you can I'd really appriciated it.

Thank you, Steve
trigger ZipCodeStateCityFix on Lead (before insert, before update) { 
    
    set<string> left5zips = new set<string>();
    
    String ZipVar;
     
    for (lead l: trigger.New) {
        
        ZipVar = l.postalcode;
        
        if(l.PostalCode != null)
        {
          if(l.postalcode.length()>= 5)
          {
               
            if ((l.State == null || l.City == null) && l.postalcode != null) {
                left5zips.add(l.postalcode.substring(0,5));
            }
          }
        }  
    }

    //query the zip_code object to get the zipcode (Name) and zone from the zip code object
    if(ZipVar != null)
    {
    if(ZipVar.length() >= 5)
    {
     
    map<string,string> zipMapState=new map<string,string>(); 
    map<string,string> zipMapCity=new map<string,string>();
    
    
    for(Zip_Code_Look_up__c z : [Select name, State__c, City__c 
    from Zip_Code_Look_up__c WHERE name IN :left5zips]) 
    {
            zipMapState.put (z.name, z.State__c); 
            zipMapCity.put (z.name, z.City__c);
    }

    for (lead l: trigger.new) {
        if((l.State == null || l.City == null) && l.postalcode != null) {
              
              String State = zipMapState.get(l.postalcode.substring(0,5));
              String City = zipMapCity.get(l.postalcode.substring(0,5));
              
              if (State != null) 
              {
                  l.State = State;
                  l.City = City;
                  l.Country = 'USA';
              }

        }
        if (l.State == null )
        {
            Return;        
        }
    }
    }}
    Return;
}

 
The following is the code snippet of what I'm trying to do.  However the update portion seems to be off somehow?  What am I doing wrong?  I want the trigger to be ready for bulk please let me know if you have any ideas?  Thanks ahead of time.
trigger AssignLastModified on Lead (after update)  
{

    List<Id> LeadList = new List<Id>();

    for (Lead l : Trigger.new) 
    { 
       Lead oldLead = Trigger.oldMap.get(l.ID); 
       if (l.Status != oldLead.Status && (oldLead.Status == 'Prospect' || oldLead.Status == 'Contact Attempted') 
       && l.Status != 'Prospect' && l.Status != 'Contact Attempted') 
       {   
           l.OwnerId = l.LastModifiedById;
           LeadList.add(l.id);      
       } 
    }

    Update LeadList;




 
I'm new to C# webservices, so I need some help.  I will give kudos for all help provided.  What I need to do basically is connect via a C# webservice from a primary subscriber type org of salesforce to multiple other orgs of Salesforce at least for the first phase (later to systems other than Salesforce will need this type or Publiser and subscriber relationship).  I need the ability to transform and map the fields coming into the Salesforce via C# webservice and then insert the Lead into the subscribing org of Salesforce.  I would like to use a REST or REST BULK connection because I don't know how many leads will be transfered from org to org given an certain time period.

So I need to know how to create a simple C# web service that will search in a foreign org of Salesforce for a lead for example named "Chuck", make sure via a custom field in the subscriber org via a foreign key (supplied by the publisher org to prevent duplicates) and insert just the newly published and scrubbed lead and basic native required lead fields into the subscribing org of Salesforce.

Any help would be greatly appriciated.  Please help me. Steve J
I'm new to C# webservices, so I need some help.  I will give kudos for all help provided.  What I need to do basically is connect via a C# webservice from a primary subscriber type org of salesforce to multiple other orgs of Salesforce at least for the first phase (later to systems other than Salesforce will need this type or Publiser and subscriber relationship).  I need the ability to transform and map the fields coming into the Salesforce via C# webservice and then insert the Lead into the subscribing org of Salesforce.  I would like to use a REST or REST BULK connection because I don't know how many leads will be transfered from org to org given an certain time period.

So I need to know how to create a simple C# web service that will search in a foreign org of Salesforce for a lead for example named "Chuck", make sure via a custom field in the subscriber org via a foreign key (supplied by the publisher org to prevent duplicates) and insert just the newly published and scrubbed lead and basic native required lead fields into the subscribing org of Salesforce.

Any help would be greatly appriciated.  Please help me. Steve
I'm new to C# webservices, so I need some help.  I will give kudos for all help provided.  What I need to do basically is connect via a C# webservice from a primary subscriber type org of salesforce to multiple other orgs of Salesforce at least for the first phase (later to systems other than Salesforce will need this type or Publiser and subscriber relationship).  I need the ability to transform and map the fields coming into the Salesforce via C# webservice and then insert the Lead into the subscribing org of Salesforce.  I would like to use a REST or REST BULK connection because I don't know how many leads will be transfered from org to org given an certain time period.

So I need to know how to create a simple C# web service that will search in a foreign org of Salesforce for a lead for example named "Chuck", make sure via a custom field in the subscriber org via a foreign key (supplied by the publisher org to prevent duplicates) and insert just the newly published and scrubbed lead and basic native required lead fields into the subscribing org of Salesforce.

Any help would be greatly appriciated.  Please help me.
As of this morning anything that inserts a lead which would also invoke a webservice call out separately in code is erroring out with the following error.

" Methods defined as TestMethod do not support Web service callouts null; Methods defined as TestMethod do not support Web service callouts null"

Here is a sample of one of the web service call outs... Please help....  Kudos given...
trigger ImmediateResponseUniversal2 on Lead (after insert) {

ID[] ids = new List<ID>();

    String url = 'https://cmncom.insidesales.com/do=noauth/immediate_response';

    String body;
     
    for (Lead l : Trigger.new) 
    {
         if(l.School__c != 'CMNTest' && l.LeadSource != 'Inbound Call' && l.LeadSource != 'School HST' && 
            l.LeadSource != 'Inbound Call' && l.LeadSource != 'School HST' &&
            l.Status != 'Application' && l.Status != 'Enrolled' && l.Status != 'Started' && l.Status != 'Closed')
         {   
           ids.add(l.id);
         }  

    }                        
      

      if (!ids.isEmpty()) 
      {
        if(trigger.isInsert)
        {
              body = 'method=call_now&dialer_initiative_id=67&ids='+EncodingUtil.urlEncode(JSON.serialize(ids), 'ISO-8859-1');              
              HTTPRequestSender.sendHTTPRequest(url, body);
        }

      }
}




 
When using the Dataloader, does the rule still apply that workflow won't fire for batch sizes > 20 ???  Used to I remember that batch sizes set to greater than 20 records at a time workflow wouldn't fire.  Has that been changed?  If so, what are the new rules?

Thank you,
Steve Laycock
As of this morning anything that inserts a lead which would also invoke a webservice call out separately in code is erroring out with the following error.

" Methods defined as TestMethod do not support Web service callouts null; Methods defined as TestMethod do not support Web service callouts null"

Here is a sample of one of the web service call outs... Please help....  Kudos given...
trigger ImmediateResponseUniversal2 on Lead (after insert) {

ID[] ids = new List<ID>();

    String url = 'https://cmncom.insidesales.com/do=noauth/immediate_response';

    String body;
     
    for (Lead l : Trigger.new) 
    {
         if(l.School__c != 'CMNTest' && l.LeadSource != 'Inbound Call' && l.LeadSource != 'School HST' && 
            l.LeadSource != 'Inbound Call' && l.LeadSource != 'School HST' &&
            l.Status != 'Application' && l.Status != 'Enrolled' && l.Status != 'Started' && l.Status != 'Closed')
         {   
           ids.add(l.id);
         }  

    }                        
      

      if (!ids.isEmpty()) 
      {
        if(trigger.isInsert)
        {
              body = 'method=call_now&dialer_initiative_id=67&ids='+EncodingUtil.urlEncode(JSON.serialize(ids), 'ISO-8859-1');              
              HTTPRequestSender.sendHTTPRequest(url, body);
        }

      }
}




 
I seem to have problems around line 43 where I have my

zipMapState.get(l.postalcode.substring(0,5));

Statement.  I was wondering if there is a more efficient way of doing this??  Please help if you can I'd really appriciated it.

Thank you, Steve
trigger ZipCodeStateCityFix on Lead (before insert, before update) { 
    
    set<string> left5zips = new set<string>();
    
    String ZipVar;
     
    for (lead l: trigger.New) {
        
        ZipVar = l.postalcode;
        
        if(l.PostalCode != null)
        {
          if(l.postalcode.length()>= 5)
          {
               
            if ((l.State == null || l.City == null) && l.postalcode != null) {
                left5zips.add(l.postalcode.substring(0,5));
            }
          }
        }  
    }

    //query the zip_code object to get the zipcode (Name) and zone from the zip code object
    if(ZipVar != null)
    {
    if(ZipVar.length() >= 5)
    {
     
    map<string,string> zipMapState=new map<string,string>(); 
    map<string,string> zipMapCity=new map<string,string>();
    
    
    for(Zip_Code_Look_up__c z : [Select name, State__c, City__c 
    from Zip_Code_Look_up__c WHERE name IN :left5zips]) 
    {
            zipMapState.put (z.name, z.State__c); 
            zipMapCity.put (z.name, z.City__c);
    }

    for (lead l: trigger.new) {
        if((l.State == null || l.City == null) && l.postalcode != null) {
              
              String State = zipMapState.get(l.postalcode.substring(0,5));
              String City = zipMapCity.get(l.postalcode.substring(0,5));
              
              if (State != null) 
              {
                  l.State = State;
                  l.City = City;
                  l.Country = 'USA';
              }

        }
        if (l.State == null )
        {
            Return;        
        }
    }
    }}
    Return;
}

 
The following is the code snippet of what I'm trying to do.  However the update portion seems to be off somehow?  What am I doing wrong?  I want the trigger to be ready for bulk please let me know if you have any ideas?  Thanks ahead of time.
trigger AssignLastModified on Lead (after update)  
{

    List<Id> LeadList = new List<Id>();

    for (Lead l : Trigger.new) 
    { 
       Lead oldLead = Trigger.oldMap.get(l.ID); 
       if (l.Status != oldLead.Status && (oldLead.Status == 'Prospect' || oldLead.Status == 'Contact Attempted') 
       && l.Status != 'Prospect' && l.Status != 'Contact Attempted') 
       {   
           l.OwnerId = l.LastModifiedById;
           LeadList.add(l.id);      
       } 
    }

    Update LeadList;