• JesseRC
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 8
    Replies

I have two lead triggers, Before Insert and After Insert. Both are showing null information for some fields. To test I am printing out lead information in the very beginning of Before Insert trigger and lead.Name always shows as Null. But I when open lead in UI the name is filled in correctly. Earlier today they were working just fine. The only changes I made were adding comment blocks for documentation. After that this issue started.

 

Any explanations? Could it be from updating trigger apiVersion from 16.0 to 19.0?

Is there a way to change the from email/sender address when sending a email message via apex or any method? I know you can change the sender name. We are sending out survey emails generated via apex and triggered by a agetns actions. But instead of coming from the agent we want the email to come from the manager. It looks weird to change the sender name to the managers name but still have the sender email as the agents.

 

Thanks,

Jesse

I'm trying to have a APEX trigger use a html template. It works in sending the email but i cannot get the merge fields to work.

 

There are two custom objects, object1 and object2. When object1 is "completed" it creates object2 and i would like to use an email template in an apex trigger off of object2. But none of the fields from object2 are coming through. Does anybody have any good examples?

  • September 21, 2010
  • Like
  • 0

I've searched and found some old posts confirming this issue did exists and it seems it still does:

 

You cannot create a new event from an object like an Opportunity and assign it to a public calendar by using the name of the public calendar in the User field.

 

Is there any way around this? Considering the age of those original posts I would hope something had happened with this.

 

Thanks,

Jesse

We have an intermediary new lead page that takes basic fields (name, phone, email, company) and searchs showing possible duplicates. When one is not found then the user can choose to create his new lead. The lead is created with all the data the rep has already filled out, inserted and then shown to the user via a a pagereference. 

 

Is there a way to not "insert" the lead before showing it? I would like for agent's to have a chance to change some other field data before the initial insert trigger is fired. I just want to open the lead to its edit page 

I have a before insert on the lead object. I am using "before" because I am changing lead owner based on campaign that cannot be done in an after trigger. If i'm wrong about that please let me know. 

 

My basic flow is:

 

  1. lead comes in, before trigger activated
  2. using lead information to find correct campaign
  3. use campaign information to update lead owner
  4. Need to associate lead to campaign by creating CampaignMember object

 

But I cannot insert any CampaignMember objects that I create because this is a before trigger and the leads dont have Id's yet. 

 

Any thoughts on how i can accomplish this all from the same trigger? Right now i'm working on storing the campaign Id in a dummy field on the lead so that an after trigger can find it and create and insert a campaignmember object. Doing this so that i don't have the same query (finding the campaign) in two different places.  

I have a list of our office IP Ranges. Entered them into the appropriate area for our site's profile. But then we got totally locked out of the site. So my first question is does anybody know about anything funky when enabling Login IP Ranges? I removed the IP Ranges but the site is still unaccesible, getting authorization required message. Its been at least 15 minutes since i removed the IP ranges but the site is still locked out. 

 

Does anybody have insight on whats going on? Just to verify the site did work just fine before, it had been up for a few days and everybody could see it. We wanted it to be internal so I got a list of our external IP's. Even went to whatsmyip.com to verify. 

I am building a simple page to show the account details and notes of an account. Will be used on a site for another team to view sales notes. I would like it to be a single page with the bottom section just freshing with the details of the notes selected from up top. Is there anyway to do this with the related lists (apex:relatedlist)? It would be great if i could use those but also change the links so that instead of opening to the whole new page the detail just opened below.

 

I first built the page with a pageblock table, and commandlinks. Essentially making my own related list, was just wondering if there was an easier way. Also if i use a related list how do i control what buttons show  on my VF page? I'm sure i could change the button layout on my page layout but all our profiles are using the same layout. If i make a second page layout how do I tell my VF page to use the related list from that layout?

 

Since i'm on the topic of related lists. Lets say i have a custom object Survey which has notes. How come the notes of a survey don't show in the notes related list on the Account page? 

 

Thanks,

Jesse

I have tried before insert and after insert triggers but i cannot seem to update the ownerId. During the trigger the ownerId gets set properly, as seen via the debug log, but when I look at the lead in SF it is still the default owner. Specificly these leads are being created via a web-to-lead form.

 

In either version (Before or After insert) I get the list of leads, find the proper ownerId and assign it to the lead. In my After Insert trigger i even printed to the log the owner Id before updating the leads and then again after updating the leads. The ownerId comes our correct in the log but still not in SF. Here is a stripped down version of my After Insert trigger

 

 

trigger Lead on Lead (after insert) { 
    ProtectionRules pr = new ProtectionRules();
    String prResult = 'not found';
 	
 	String countryCode;
 	
	Set<ID> ids = trigger.newmap.keyset();
	list<Lead> leads = [SELECT Id,Status,Downgrade_Date__c,Phone,indexedPhone__c,Email,indexedEmail__c,OwnerId,Owner_Manager_Email__c,Owner_Manager_Name__c,LeadSource,Lead_Score__c FROM Lead WHERE Id in :ids];
		 				
	for(Integer i=0; i<leads.size();i++){
		*Code to find OwnerId*
	    		
                leads[i].OwnerId = [SELECT id FROM User WHERE Team__c=:assignmentRule.TeamName__c AND Team_Member_Number__c=:teamMemberNumber].Id;
	    		

		system.debug('THIS IS LEAD.OWNERID AT THE END: ' + leads[i].OwnerId);
		
			
        }		
    

    system.debug('THIS IS THE LEAD OWNER BEFORE UPDATE: ' + [SELECT Id,OwnerId FROM Lead WHERE Id=:leads[0].Id].OwnerId);    	
	update leads;
	system.debug('THIS IS THE LEAD OWNER AFTER UPDATE: ' + [SELECT Id,OwnerId FROM Lead WHERE Id=:leads[0].Id].OwnerId);
}

 

 

 I realize those debug lines at the end will only show the first lead in the list. I am just testing one at a time.

 

What am I missing? I've been stuck on this for the last day or two and any help would be appreciated.

 

 

I have two lead triggers, Before Insert and After Insert. Both are showing null information for some fields. To test I am printing out lead information in the very beginning of Before Insert trigger and lead.Name always shows as Null. But I when open lead in UI the name is filled in correctly. Earlier today they were working just fine. The only changes I made were adding comment blocks for documentation. After that this issue started.

 

Any explanations? Could it be from updating trigger apiVersion from 16.0 to 19.0?

We have an intermediary new lead page that takes basic fields (name, phone, email, company) and searchs showing possible duplicates. When one is not found then the user can choose to create his new lead. The lead is created with all the data the rep has already filled out, inserted and then shown to the user via a a pagereference. 

 

Is there a way to not "insert" the lead before showing it? I would like for agent's to have a chance to change some other field data before the initial insert trigger is fired. I just want to open the lead to its edit page 

I have a before insert on the lead object. I am using "before" because I am changing lead owner based on campaign that cannot be done in an after trigger. If i'm wrong about that please let me know. 

 

My basic flow is:

 

  1. lead comes in, before trigger activated
  2. using lead information to find correct campaign
  3. use campaign information to update lead owner
  4. Need to associate lead to campaign by creating CampaignMember object

 

But I cannot insert any CampaignMember objects that I create because this is a before trigger and the leads dont have Id's yet. 

 

Any thoughts on how i can accomplish this all from the same trigger? Right now i'm working on storing the campaign Id in a dummy field on the lead so that an after trigger can find it and create and insert a campaignmember object. Doing this so that i don't have the same query (finding the campaign) in two different places.  

I have a list of our office IP Ranges. Entered them into the appropriate area for our site's profile. But then we got totally locked out of the site. So my first question is does anybody know about anything funky when enabling Login IP Ranges? I removed the IP Ranges but the site is still unaccesible, getting authorization required message. Its been at least 15 minutes since i removed the IP ranges but the site is still locked out. 

 

Does anybody have insight on whats going on? Just to verify the site did work just fine before, it had been up for a few days and everybody could see it. We wanted it to be internal so I got a list of our external IP's. Even went to whatsmyip.com to verify. 

I am building a simple page to show the account details and notes of an account. Will be used on a site for another team to view sales notes. I would like it to be a single page with the bottom section just freshing with the details of the notes selected from up top. Is there anyway to do this with the related lists (apex:relatedlist)? It would be great if i could use those but also change the links so that instead of opening to the whole new page the detail just opened below.

 

I first built the page with a pageblock table, and commandlinks. Essentially making my own related list, was just wondering if there was an easier way. Also if i use a related list how do i control what buttons show  on my VF page? I'm sure i could change the button layout on my page layout but all our profiles are using the same layout. If i make a second page layout how do I tell my VF page to use the related list from that layout?

 

Since i'm on the topic of related lists. Lets say i have a custom object Survey which has notes. How come the notes of a survey don't show in the notes related list on the Account page? 

 

Thanks,

Jesse

Hi folks. I have a requirement to pre-populate certain fields (phone, fax, mobile phone), based on the record type, when creating a new Lead. Currently, this is done through an s-control, but I intend to re-implement it using visualforce. Can anyone give me any pointers on how to do this? I can't seem to find any good examples for this particular case.