• Bmart
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 9
    Replies
Hello, I have an html/text template that I'm trying to change over to a visualforce template. This is my first time playing around with visualforce, so I've come across trouble converting my url.  I'm able to save it,but when I get the email it comes as markup language. I'm obviously doing something wrong, so if anyone could assist I would greatly appreciate it. Thanks!

The original text template I'm trying to convert to a visualforce template: (I purposely changed the beginning of the url, so I'm not exposing the actual survey url on the boards here.)
Dear {!Contact.Name},

At Undertone, we are constantly
focused on enhancing the level of service, performance and insights that we
deliver. One of the ways we do this is by gathering feedback from our clients
via a brief customer satisfaction survey.

This survey takes two to three
minutes to complete and is designed to gather your opinions on your recent
experience with Undertone. You can access the survey here:

http:/abc.com/abc/abc/go.jsp?iv=63czc8cvlqh2&q1={!Account.Id}&q2={!Contact.Id}&q3={!Opportunity.Id}&q4={!User.Id}&q5=US

Thank you in advance – your
opinions matter.


visualforce template attempt
<messaging:emailTemplate subject="Undertone Survey" recipientType="Contact" relatedToType="Opportunity">

<messaging:plainTextEmailBody >
Dear {!recipient.name},

At Undertone, we are constantly focused on enhancing the level of service, performance and insights that we deliver. 

One of the ways we do this is by gathering feedback from our clients via a brief customer satisfaction survey.

This survey takes two to three minutes to complete and is designed to gather your opinions on your recent experience with Undertone. 

You can access the survey here:
<a href="http://abc.com.com/abc/abc/go.jsp?iv=63czc8cvlqh2&q1={" target="_blank" rel="nofollow">http://survey.clicktools.com/app/survey/go.jsp?iv=63czc8cvlqh2q1={</a>!relatedto.Account.Id}<apex:outputText value="&"/>q2={!recipient.Id}<apex:outputText value="&"/>q3={!relatedto.Id}<apex:outputText value="&"/>q4={!relatedto.lastmodifiedbyid}<apex:outputText value="&"/>q4="US"

Thank you in advance – your
opinions matter.
</messaging:plainTextEmailBody>
</messaging:emailTemplate>

email
-----Original Message-----
From: noreply@salesforce.com [mailto:noreply@salesforce.com] On Behalf Of Brian Martinez
Sent: Thursday, August 04, 2016 5:37 PM
To: Brian Martinez | Undertone <bmartinez@tbd.com>
Subject: Undertone Survey

 
 
Dear Brian Martinez,
 
At Undertone, we are constantly focused on enhancing the level of service, performance and insights that we deliver.
 
One of the ways we do this is by gathering feedback from our clients via a brief customer satisfaction survey.
 
This survey takes two to three minutes to complete and is designed to gather your opinions on your recent experience with Undertone.
 
You can access the survey here:
<a href="http://abc.com.com/abc/abc/go.jsp?iv=63czc8cvlqh2&amp;q1={" rel="nofollow" target="_blank">http://abc.com.com/abc/abc/go.jsp?iv=63czc8cvlqh2q1={</a>!relatedto.Account.Id}&q2=0033000000ufQWMAA2&q3=0061300001AI0MQAA1&q4=00530000004UwpHAAS&q4="US"
 
Thank you in advance – your
opinions matter.
 
  • August 04, 2016
  • Like
  • 0
Hi everyone. not a developer here so I struggle sometimes with code. I'm trying to create a trigger where when on the Opportunity object I flag the billed complete field (custom field, Jan Billed complete in this example) it queries the opportunity team members of the opportunity and then creates a new CSM Commission record (custom object).  I can get everything to work in terms of creating the CSM Commission record, but when creating the CSM record I'm having trouble getting the OpportunityTeamMember who's teammemberrole == 'Client Service Manager' from the CSMTeamMember. Can someone help me out and point out what I need to do? to get the values to feed over correctly? Thanks for your help in advance. 

trigger Opportunity_to_CSM_Commission on Opportunity (after update) {
// create a set of all the unique line item revision records based on WF ID
     
List<string> CSMIDS = new List<string>();  

       for (Opportunity o : Trigger.new)  
		{
           CSMIDS.add(o.id);   
        }
    
           
Date datobj =date.today();
Integer dy = datobj.day();
Integer mon = datobj.month();
Integer yr = datobj.year();
Integer lastyr = datobj.year()-1;    
           
 List <CSM_Commission__c	> CSMINSERTS = new list <CSM_Commission__c> ();	

 
 List <OpportunityTeamMember> CSMTeamMember=[Select OpportunityID, Userid, TeamMemberRole from OpportunityTeamMember Where Opportunityid =:CSMIDS ];
 




for (Opportunity Opp : Trigger.new)  {
	   	 
	if (/*I want to add a filter here where TeamMemberRole='Client Service Manager' && */OPP.Intl__c == false && OPP.Jan_Billed_Complete__c == true && OPP.Jan_CSM_Payment_Complete__c != true)
			
			{
		   CSM_Commission__c CSMCOM= new CSM_Commission__c ();
           CSMCOM.Opportunity__c = OPP.Id;
           CSMCOM.Name = 'IO#' + OPP.IO_Number__c + '- January' + yr + '- CSM Payment';
           CSMCOM.Jan_Billed__c = OPP.Jan_Billed__c;
          // CSMCOM.CSM__c = I want to get the OpportunityTeamMember userid where the teamMemberRole = 'Client Service Manager' and assign that person as the CSM__c user lookup value.
           //CSMCOM.OwnerId= I want to get the OpportunityTeamMember userid where the teamMemberRole = 'Client Service Manager' and assign that person as the Owner of the CSM Commission record.
           CSMINSERTS.add(CSMCOM); 
			}
			    
       		} 
		


try{

	insert CSMINSERTS;
}catch (System.Dmlexception e) {
	
}
}


  • October 16, 2014
  • Like
  • 0
Hi I'm trying to create a trigger to do the following.

On Line Item Revision object if a record is created I want to query the Line item Revision Parent Object and see if there is a Parent that exists with the matching WF_ID__c value, and if not I want to create a new parent.

On Line Item Revision object if a record is updated I want to query the Line item Revision Parent Object and see if there is a Parent that exists with the matching WF_ID__c value, I want to update the trigger__c field by incrementing it by 1.

I can get the first part to work in that i can get it to create a parent, but when trying to update an existing parent I get the following error with my code "Initial term of field expression must be a concrete SObject:ID"

If anyone can assist in helping understand what I'm doing wrong that would be greatly appreciated. Thank you.

trigger Create_Line_Item_Parent_On_Line_Item_Revisions on Line_Item_Revisions__c (before update,after insert, after update, after delete, after undelete) {


// create a set of all the unique line item revision records based on WF ID
   
List<string> LIRevisions = new List<string>();

       for (Line_Item_Revisions__c lir : Trigger.new)
  {
         
           LIRevisions.add(lir.wf_id__c); 

       }
List <Line_Item_Revision_Parent__c > LineItemParentstoCreate = new list <Line_Item_Revision_Parent__c> ();
List <Line_Item_Revision_Parent__c > LineItemParentstoUpdate = new list <Line_Item_Revision_Parent__c> ();
List <Line_Item_Revision_Parent__c > LineItemParentList=[Select WF_ID__c, id, Trigger__c from Line_Item_Revision_Parent__c Where WF_ID__c =:LIRevisions ];
List <OpportunityLineItem > IOLineItem=[Select WF_ID__c, id from OpportunityLineItem where WF_ID__c =:LIRevisions ];



Map<String,Id> LIRPMap = new Map <String,ID> ();
for (Line_Item_Revision_Parent__c LIP:LineItemParentList)
{
  LIRPMAP.put(LIP.WF_ID__c,LIP.id);

}

Map<String,Id> IOLineItemMap = new Map <String,ID> ();
for (OpportunityLineItem OLI:IOLineItem)
{
  IOLineItemMap.put(OLI.WF_ID__c,OLI.id);
}



for (Line_Item_Revisions__c LIRadd : Trigger.new)  {


if (LIRPMAP.isEmpty () )
   {
    Line_Item_Revision_Parent__c LIP2 = new Line_Item_Revision_Parent__c ();
  
    LIP2.WF_ID__c= LIRadd.WF_ID__c;
    LIP2.IO_Line_Item_Parent__c=IOLineItemMap.get(LIP2.WF_ID__c);
    LineItemParentstoCreate.add(LIP2);
  
                 
   }
  
   if(!LIRPMAP.isEmpty())
 
   {
    Line_Item_Revision_Parent__c LIP3 =LIRPMAP.get(LIRADD.WF_ID__c).id;
    LIP3.Trigger__c= LIRPMAP.get(LIP3.WF_ID__c)trigger__c+1;
       LineItemParentstoUpdate.add(LIP3);
   }
   }



try{
update LineItemParentstoUpdate;
insert LineItemParentstoCreate;
}catch (System.Dmlexception e) {

}
}

  • June 20, 2014
  • Like
  • 0
Hi, I'm trying to create a apex trigger on the Lead object to associate a Lead with an existing account. To do this I created a custom lookup field on Lead called Account (Account__c) and upon creating or updating a lead I want to query the Account object and find an existing account where the name of the account is equal to the name of the Company on the Lead. I only want 1 item returned and if the account doesn't exist I don't want the trigger to do anything. This code I have written works exactly how I want it to work, but only after update. When I try to do it on before insert it gives me the list has no rows for assignment. I'm sure there's probably a better way to do this, so if anyone can assist me I would greatly appreciate it! Thank you in advance for your help.
Trigger Account_Lookup_for_Campaign_Member on Lead (before update) {

Set<Id> acctIds = new Set<Id>();  {

       for (Lead l : Trigger.new)

           acctIds.add(l.id);

       }

 

List <Account> AccName=[Select id, name from Account Where Name =:[SELECT Company FROM Lead WHERE Id =:AcctIds].company limit 1];
     
  

       
    for (Lead acctadd : Trigger.new)  {
      
         if (!AccName.isEmpty () && acctadd.account__c == null)
     
            acctadd.Account__c = accname[0].id;            
      
        }

}

  • May 16, 2014
  • Like
  • 0
Hi everyone. not a developer here so I struggle sometimes with code. I'm trying to create a trigger where when on the Opportunity object I flag the billed complete field (custom field, Jan Billed complete in this example) it queries the opportunity team members of the opportunity and then creates a new CSM Commission record (custom object).  I can get everything to work in terms of creating the CSM Commission record, but when creating the CSM record I'm having trouble getting the OpportunityTeamMember who's teammemberrole == 'Client Service Manager' from the CSMTeamMember. Can someone help me out and point out what I need to do? to get the values to feed over correctly? Thanks for your help in advance. 

trigger Opportunity_to_CSM_Commission on Opportunity (after update) {
// create a set of all the unique line item revision records based on WF ID
     
List<string> CSMIDS = new List<string>();  

       for (Opportunity o : Trigger.new)  
		{
           CSMIDS.add(o.id);   
        }
    
           
Date datobj =date.today();
Integer dy = datobj.day();
Integer mon = datobj.month();
Integer yr = datobj.year();
Integer lastyr = datobj.year()-1;    
           
 List <CSM_Commission__c	> CSMINSERTS = new list <CSM_Commission__c> ();	

 
 List <OpportunityTeamMember> CSMTeamMember=[Select OpportunityID, Userid, TeamMemberRole from OpportunityTeamMember Where Opportunityid =:CSMIDS ];
 




for (Opportunity Opp : Trigger.new)  {
	   	 
	if (/*I want to add a filter here where TeamMemberRole='Client Service Manager' && */OPP.Intl__c == false && OPP.Jan_Billed_Complete__c == true && OPP.Jan_CSM_Payment_Complete__c != true)
			
			{
		   CSM_Commission__c CSMCOM= new CSM_Commission__c ();
           CSMCOM.Opportunity__c = OPP.Id;
           CSMCOM.Name = 'IO#' + OPP.IO_Number__c + '- January' + yr + '- CSM Payment';
           CSMCOM.Jan_Billed__c = OPP.Jan_Billed__c;
          // CSMCOM.CSM__c = I want to get the OpportunityTeamMember userid where the teamMemberRole = 'Client Service Manager' and assign that person as the CSM__c user lookup value.
           //CSMCOM.OwnerId= I want to get the OpportunityTeamMember userid where the teamMemberRole = 'Client Service Manager' and assign that person as the Owner of the CSM Commission record.
           CSMINSERTS.add(CSMCOM); 
			}
			    
       		} 
		


try{

	insert CSMINSERTS;
}catch (System.Dmlexception e) {
	
}
}


  • October 16, 2014
  • Like
  • 0
Hi I'm trying to create a trigger to do the following.

On Line Item Revision object if a record is created I want to query the Line item Revision Parent Object and see if there is a Parent that exists with the matching WF_ID__c value, and if not I want to create a new parent.

On Line Item Revision object if a record is updated I want to query the Line item Revision Parent Object and see if there is a Parent that exists with the matching WF_ID__c value, I want to update the trigger__c field by incrementing it by 1.

I can get the first part to work in that i can get it to create a parent, but when trying to update an existing parent I get the following error with my code "Initial term of field expression must be a concrete SObject:ID"

If anyone can assist in helping understand what I'm doing wrong that would be greatly appreciated. Thank you.

trigger Create_Line_Item_Parent_On_Line_Item_Revisions on Line_Item_Revisions__c (before update,after insert, after update, after delete, after undelete) {


// create a set of all the unique line item revision records based on WF ID
   
List<string> LIRevisions = new List<string>();

       for (Line_Item_Revisions__c lir : Trigger.new)
  {
         
           LIRevisions.add(lir.wf_id__c); 

       }
List <Line_Item_Revision_Parent__c > LineItemParentstoCreate = new list <Line_Item_Revision_Parent__c> ();
List <Line_Item_Revision_Parent__c > LineItemParentstoUpdate = new list <Line_Item_Revision_Parent__c> ();
List <Line_Item_Revision_Parent__c > LineItemParentList=[Select WF_ID__c, id, Trigger__c from Line_Item_Revision_Parent__c Where WF_ID__c =:LIRevisions ];
List <OpportunityLineItem > IOLineItem=[Select WF_ID__c, id from OpportunityLineItem where WF_ID__c =:LIRevisions ];



Map<String,Id> LIRPMap = new Map <String,ID> ();
for (Line_Item_Revision_Parent__c LIP:LineItemParentList)
{
  LIRPMAP.put(LIP.WF_ID__c,LIP.id);

}

Map<String,Id> IOLineItemMap = new Map <String,ID> ();
for (OpportunityLineItem OLI:IOLineItem)
{
  IOLineItemMap.put(OLI.WF_ID__c,OLI.id);
}



for (Line_Item_Revisions__c LIRadd : Trigger.new)  {


if (LIRPMAP.isEmpty () )
   {
    Line_Item_Revision_Parent__c LIP2 = new Line_Item_Revision_Parent__c ();
  
    LIP2.WF_ID__c= LIRadd.WF_ID__c;
    LIP2.IO_Line_Item_Parent__c=IOLineItemMap.get(LIP2.WF_ID__c);
    LineItemParentstoCreate.add(LIP2);
  
                 
   }
  
   if(!LIRPMAP.isEmpty())
 
   {
    Line_Item_Revision_Parent__c LIP3 =LIRPMAP.get(LIRADD.WF_ID__c).id;
    LIP3.Trigger__c= LIRPMAP.get(LIP3.WF_ID__c)trigger__c+1;
       LineItemParentstoUpdate.add(LIP3);
   }
   }



try{
update LineItemParentstoUpdate;
insert LineItemParentstoCreate;
}catch (System.Dmlexception e) {

}
}

  • June 20, 2014
  • Like
  • 0
Hi, I'm trying to create a apex trigger on the Lead object to associate a Lead with an existing account. To do this I created a custom lookup field on Lead called Account (Account__c) and upon creating or updating a lead I want to query the Account object and find an existing account where the name of the account is equal to the name of the Company on the Lead. I only want 1 item returned and if the account doesn't exist I don't want the trigger to do anything. This code I have written works exactly how I want it to work, but only after update. When I try to do it on before insert it gives me the list has no rows for assignment. I'm sure there's probably a better way to do this, so if anyone can assist me I would greatly appreciate it! Thank you in advance for your help.
Trigger Account_Lookup_for_Campaign_Member on Lead (before update) {

Set<Id> acctIds = new Set<Id>();  {

       for (Lead l : Trigger.new)

           acctIds.add(l.id);

       }

 

List <Account> AccName=[Select id, name from Account Where Name =:[SELECT Company FROM Lead WHERE Id =:AcctIds].company limit 1];
     
  

       
    for (Lead acctadd : Trigger.new)  {
      
         if (!AccName.isEmpty () && acctadd.account__c == null)
     
            acctadd.Account__c = accname[0].id;            
      
        }

}

  • May 16, 2014
  • Like
  • 0