• Tasia Demuth 4
  • NEWBIE
  • 145 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 21
    Questions
  • 43
    Replies
I am looking for a way to copy the emails from a calendar event and returning just the email string, rather than the name and email string. 

Ideally it would look like: john@esource.com,nick@esource.com

I have been playing around with the TRIM and SUBSTITUTE functions but have been struggling to get it just right. 

Any help would be greatly appreciated. 

Thanks!
Tasia
Hi!! 

I have a lightning component that I am using in a flow to search for contacts. It works great on a desktop (see image below) but the search does not work in mobile. 

What am I missing? 

Any help would be greatly appreciated!
Tasia

User-added image

Here is my lightning component code:

Component
<aura:component implements="force:appHostable,lightning:availableForFlowScreens,flexipage:availableForAllPageTypes" access="global">
    <aura:attribute name="Contact" type="String" access="public" />
    <aura:attribute name="ContactLookup" type="String" access="public" />
    <aura:attribute name="ContactLookup__c" type="String" access="public" />
    <aura:attribute name="selectedRecordId" type="String" access="public" />
    
    <lightning:recordEditForm objectApiName="{!v.Contact}">
        <label class="ContactLookup">{!v.ContactLookup}</label>
        <lightning:inputField fieldName="{!v.ContactLookup__c}" onchange="{!c.handleOnChange}" />
    </lightning:recordEditForm>
</aura:component>    

Controller
({
    handleOnChange : function(component, event, helper) {
        component.set( "v.selectedRecordId", event.getParams( "fields" ).value );
    }
})

Style
.THIS label.slds-form-element__label {
    display: none;
}
.THIS .fieldLabel {
    font-size: .75rem;
}​​​​​​​

Design
<design:component>
    <design:attribute name="Contact" />
    <design:attribute name="ContactLookup" />
    <design:attribute name="ContactLookup__c" />
    <design:attribute name="selectedRecordId" />
</design:component>
 
Hi all, 

I am still learning writing apex code and could use some help on a controller I am writing for a visualforce email template. 

What I am trying to do is use a visualforce component to list all active contracts related to an account when a case is declined. 

Everything seems to work EXCEPT the component lists EVERY active contract not just those associated with the account. 

Any help would be greatly appreciated!!

Thanks,
Tasia

My controller looks like this: 

public class FindActiveContracts {
    private final List<Contract> contracts;
    public FindActiveContracts(){
        contracts = [select Name from Contract where status='Activated' AND EndDate > TODAY AND StartDate < TODAY AND AccountId IN (SELECT Id from Account Where Id =:case.accountId)];
        }
    public List<Contract> getActiveContracts() {
        return contracts;
    }
}

My component looks like this: 
<apex:component controller ="FindActiveContracts" access="global">
    <apex:dataTable value="{!ActiveContracts}" var="s_contract">
    <apex:column>
    <apex:facet name="header">Service Name</apex:facet>
        {!s_contract.Name}
    </apex:column>
</apex:dataTable>
</apex:component>

My email template looks like this: 
<messaging:emailTemplate subject="Your Ask E Source request on {!relatedTo.Subject}"
recipientType="Contact" 
relatedToType="Case"
replyTo="emily_hunsicker@esource.com">
<messaging:htmlEmailBody >        
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
    <p>Hi {!recipient.Name},</p>
    <p>Thanks for your recent Ask E Source request on {!relatedTo.Subject}. We have done research about this topic as part of our E Source {!relatedTo.ProductLookup__r.Name}. Unfortunately, {!recipient.Account_Name__c} is not a member of that service, so we will not be able to answer your question at this time.</p>
        <p>Our <a href="https://www.esource.com/questions-faq">Ask E Source FAQ</a> describes the general topics that are covered under each of our services; you currently have access to these services:</p>
        <c:SetActiveContracts />                 
       <p>If you’d like a personal overview of your membership, please <a href="{!recipient.CSD_Calendly_Link__c}">contact us</a> to sign up for a 30-minute walk-through with your Customer Success Director, {!recipient.CSD_Name__c}. I have copied both {!recipient.CSD_First_Name__c} and {!recipient.BDD_Name__c}, your sales contact, on this message. 
 </p> 
       <p> Best,</p>
       <p> Emily Hunsicker</p>
       <p> Customer Success Coordinator, E Source</p>       
 </font>
       
        </body>
    </html>

Hi all, 

I have a working Visualforce email template, but it lists all the contacts associated to an account rather than just contacts that have a value in the role field. 

Is there a way to filter the related records to just look at contacts with roles? Below is my code!


<messaging:emailTemplate subject="Opportunity has been won, please review roles for this account" recipientType="User" relatedToType="Account">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
        <p>Hello,</p>
        <p>{!relatedTo.Name} has closed won opportunities. Please review the contacts with roles related to this account.</p>
        <p><u>Account Information</u></p>
        <b>Account Name:</b> <a href="https://na32.salesforce.com/{!relatedTo.id}">{!relatedTo.name}</a>  
        <br/><b>Account Owner:</b> {!relatedTo.owner.name}
        <p/>                  
       <table border="1px" >
                 <tr > 
                     <th>Contact Name</th> <th>Role</th>
                  </tr>
    <apex:repeat var="contact" value="{!relatedTo.Contacts}">
       <tr>
           <td align="center">{!contact.Name}</td>
           <td align="center">{!contact.Role__c}</td>
       </tr>
    </apex:repeat>                 
       </table>
       <p />
       <table border="1px" >
                 <tr > 
                     <th>Opportunity Name</th> <th>Amount</th>
                  </tr>
    <apex:repeat var="opportunity" value="{!relatedTo.Opportunities}">
       <tr>
           <td align="center">{!opportunity.Name}</td>
           <td align="center">{!opportunity.amount}</td>
       </tr>
    </apex:repeat>                 
       </table>
       <p />
       <p> Thank you</p>
 </font>
       
        </body>
    </html>
</messaging:htmlEmailBody> 
</messaging:emailTemplate>


Thanks so much for your help!
Tasia

Hi team Developer!

I am hoping you can help me with this tricky request. Our org has a custom object called Meeting__c and a related custom object called Attendee__c. These custom objects are used to hold notes about internal meetings and to list everyone who attended the meetings. 

What I want to do is if an Event is associated to a meeting, I want to take all of the Event attendees and create meeting attendees. Below, I believe I have the code needed to look up the Event attendees. But, then I go stuck as to where I go next to create the meeting attendees. 

Any help would be much appreciated! Thank you so much for your help!

trigger CreateAttendeesfromEventInvitees on Event (after insert, after update) {

For (Event EVT:trigger.new){
    List <eventRelation> Erelates =[select RelationId,WhoId from eventRelation where eventID=: EVT.id]; 
    Set<Id> erelateSet = (new Map<Id,eventRelation>(Erelates)).keySet();
    Set<Id> erelateSet = new Set<Id>();
    for(EventRelation evtRel : Erelates){
    erelateSet.add(evtRel.WhoId);
}
Is it possible to
1.create a list button on the related list for opportunity products 
2.call a flow from that list button. 

This is the visualforce page I constructed, but it says that List Controllers are not supported for OpportunityLineItem. If this is the case, is there any way around this, where I could have a list button that allows me to take action on multiple opportunity line items from within the opportunity?

<apex:page standardController="OpportunityLineItem" lightningStylesheets="true" tabStyle="OpportunityLineItem" recordSetVar="AllOpportunityLineItems">
  <apex:repeat value="{!AllOpportunityLineItems}" var="row" rendered="false">
  {!row.id}
  </apex:repeat>
  <flow:interview name="Opp_close_lose"
  finishLocation="{!URLFOR($Action.OpportunityLineItem.Tab, $ObjectType.OpportunityLineItem)}">
  <apex:param name="recordId" value="{!Selected}"/>
  </flow:interview>
</apex:page>

Let me know and thank you in advance for your help!

Tasia
Hi team, 

I have a rich text field on the account object where users can paste links to different pieces of content that they like. I then pulled a report with the rich text in it, and the links are not clickable. 

Is there a way to make these links clickable in the report? 

Let me know!

Thanks,
Tasia
Hi community!

I am having an interesting issue. Our Salesforce instance is integrated with our company website. We are a subscription-model company selling content, so we sync contacts up to our website to determine which contacts have web accounts and also what these contacts have access to. 

I am seeing a weird thing where I am getting errors for leads regarding the state in the state/country codes for leads only. So contacts are syncing all right, but leads seem to be erroring out. 

But, I thought the state/country picklist was universal for the instance so that does not make much sense to me. Am I wrong in that assumption? 

Any thoughts would be greatly appreciated. 

Thanks,
Tasia
Hi all, 

Does anyone know of a way to list in an enhanced lightning grid cases that are both owned by the current user or cases that the current user is a secondary owner on? 

When I use this criteria for just looking at the assigned agent is the current user, my enhanced lightning grid works. But, if I go to add criteria showing that the secondary owner (a lookup field) is the current user then the sortable grid disappears. 

RecordType.Name IN('Ask E Record Type') AND Status NOT IN('Closed') AND Assigned_Agent_is_the_current_user__c = True

Any help would be greatly appreciated
Hi all, 

I am trying to write a trigger that posts the old Role value to Chatter when the Role field is udpated. My code is below. 

However, I am getting this error: RoleChangeTrigger: execution of AfterUpdate caused by System.StringException: Invalid id: AMS EB External entry point. 
AMS EB is the role that I was trying to change the field to. The role field is a multi-select picklist field. 

Any help would be greatly appreciated. 


trigger RoleChangeTrigger on Contact (after update) {
    List<FeedItem> posts = new List<FeedItem>();
    for(Contact con: Trigger.new){
        Contact newContact = Trigger.newMap.get(con.Role__c);
        Contact oldContact = Trigger.oldMap.get(con.Role__c);
        if(newContact.Role__c != oldContact.Role__c){
        String status = 'Role has changed. Here is the previous value:' + oldContact.Role__c;
            FeedItem post = new FeedItem(
            ParentId = con.Id,
            Title = 'Role Change',
            Body = status
            );
        }
    }
}
I am trying to calculate the end date of an opportunity line item. 

Here is the formula I am using: 
Data TypeFormula  
DATE(YEAR(ServiceDate)+FLOOR((MONTH(ServiceDate +Term__c))/12)+if(MOD(MONTH(ServiceDate+Term__c),12)=0,-1,0), if(MOD(MONTH(ServiceDate+Term__c),12)=0,12,MOD(MONTH(ServiceDate+Term__c),12)), DAY(ServiceDate))-1

and when I run the Dataflow, this is the error I am getting:

Something went wrong while executing the End Date node: invalid field expression DATE(YEAR(ServiceDate)+FLOOR((MONTH(ServiceDate +Term__c))/12)+if(MOD(MONTH(ServiceDate+Term__c),12)=0,-1,0), if(MOD(MONTH(ServiceDate+Term__c),12)=0,12,MOD(MONTH(ServiceDate+Term__c),12)), DAY(ServiceDate))-1;; for field 'EndDate': Syntax Error at position 102 after token = :: ;+Term__c),12)⇾=⇽0,-1,0), if(MO; (02K380000008giyEAA_03C38000000D6cqEAC)

I believe the syntax is correct, so any help would be greatly appreciated. 

Thanks!
Tasia
Hi all,

We just activated myDomain and deployed Lightning to a subset of our users.

We have it set up where when someone clicks a link from email etc, that there is a redirect message so folks can update their bookmarks. 

However, some users indicate that they just get a 400 error when they click on the SF links in Evernote. 

Has anyone else experienced this? Please let me know because I am a bit stumped. 

Thanks so much!
Tasia
Hello, 

I am having some trouble getting the Lightning stylesheets to stick for the opportunity product Add Product action. I have a visualforce page and custom controller that I use to create an opportunity. Once the opportunity is created, one is redirected to add products to the opportunity. Right now, the redirect works, but sends the user into Classic to add the products and then is redirected back to Lightning. 

Is there a way to keep everything in Lightning? Below is the code for the visualforce page. 

Thanks in advance for your help!
Tasia

<apex:page lightningStylesheets="true" controller="OppCreateController"> <apex:slds > <!-- >> KO << flow:interview name="Testflow3" interview="{!OppCreate}" finishLocation="{!URLFOR($Action.OpportunityLineItem.AddProducts,OppId)}" / --> <flow:interview name="CreateOpportunityFlow" interview="{!OppCreate}" finishLocation="{!BackToOpp}"> <apex:param name="AccountId" value="{!$CurrentPage.parameters.Id}"/> </flow:interview> </apex:slds> </apex:page>
I have a visualforce page that I used to override the 'New Opportunity' button on the Opportunity related list on the Account. To make this usable in Lightning, should I create a lightning component? Or is there a way to use the Visualforce page that I already have written? 

Any advice is greatly appreciated. 

Thanks, 
Tasia
Hi all, 

I am getting an assertion failed in the logs when I run the below test. I receive 100% coverage on this test. Any help you can provide to point me in the right direction, would be much appreciated. 

Thanks!
Tasia

@isTest
public class UpdateCaseWhenLeadDeletedTest {

    private static testMethod void LeadDeletedTest(){
        //create a Lead
        Lead lead=new Lead(LastName='Test',FirstName='Tester',Status='Known', Company = 'CD Test');
        insert lead;
        // create a Case
        Case cscase=new Case(Status = 'New', Priority = 'Medium', Origin = 'Email');
        cscase.Lead__c = lead.Id;
        insert cscase;
       
        //delete Lead
        delete lead;
        
        List<Case> lstCase = [SELECT id ,Status,Type FROM Case WHERE Lead__c =:lead.id ];
        System.assert(lstCase.size() > 0 );
        System.assertEquals('Denied', lstCase[0].Status);
        System.assertEquals('Web Account Denied', lstCase[0].Type);
    }
}

Hi all,

I have a test class that I am trying to set a RecordTypeId to (see below). I need the record type id because I have a validation rule in production that will prevent the deployment of this test class without the record id set. 

When I hardcode the recordId into the test class, I get 100% coverage. When I try to dynamically assign the id, however, I get 50% coverage. 

Can anyone help with what I am doing wrong? 

Thanks!

Tasia

@isTest
public class UpdateCaseWhenLeadConvertedTest 
{  
    private static testMethod void LeadConvertedTest()
    {
        
        Lead olead = new Lead(LastName='Test',FirstName='Tester',Status='Known',Company='CD Test');
        insert olead;
        
        Case c = new case (Status ='New', Priority = 'Medium', Origin = 'Email');
        c.Lead__c = olead.Id;
        c.RecordTypeId =  Schema.sObjectType.Case.getRecordTypeInfosByName().get('Customer_Service_Record_Type').getRecordTypeId();
        insert c;

        Database.LeadConvert lc = new database.LeadConvert();
        lc.setLeadId(olead.id);
        lc.setDoNotCreateOpportunity(true);
        lc.setConvertedStatus('Converted w/out Opp');

        Database.LeadConvertResult lcr = Database.convertLead(lc);
        System.assert(lcr.isSuccess());
        
        
        List<Case> lstCase = [Select id ,ContactId, Status, Type from Case where id =:c.id ];
        System.assert(lstCase.size() > 0 );
        System.assert(lstCase[0].ContactId !=null );
        System.assertEquals('Closed', lstCase[0].Status);
        System.assertEquals('Web Account Approved', lstCase[0].Type);
        
    }
}

Hi!

I have written a trigger that updates a case when an associated lead is deleted. 

The struggle I am having is I can't seem to figure out how to test the delete part. Below is my trigger and my class. I have 52% coverage. I have bolded the lines that are not covered. The community helped me earlier on a test class, and I thought I had a better handle on it. But, this is stumping me! 

Any help is appreciated. 

Best, 
Tasia

trigger UpdateCaseWhenLeadDeleted on Lead (after delete) {
if(Trigger.isAfter && Trigger.isDelete)
    {
       List<Case> listCase = new List<Case>();
        Set<Id> DeletedLeads = new Set<Id>();
        Map<String,Boolean> mapLeadDelete = new Map<String, Boolean>();
        for(Lead objLead : Trigger.old)
        {
            if(objLead.IsDeleted)
            {
            DeletedLeads.add(objLead.Id); 
           mapLeadDelete.put(objLead.Id, objLead.IsDeleted);  
  
        }
        }    
        for(Case objCase : [SELECT Lead__c FROM Case WHERE Lead__c IN : DeletedLeads])    
        {
            if(mapLeadDelete.containsKey(objCase.Lead__c))
        {       
            objCase.Lead__c = null;
            objCase.Status = 'Denied';
            objCase.Type = 'Web Account Denied';
            listCase.add(objCase);

        }
        }
        update listCase;
    }
}

@isTest
public class UpdateCaseWhenLeadDeletedTest {

    private static testMethod void LeadDeletedTest(){
        //create a Lead
        Lead lead=new Lead(LastName='Test',FirstName='Tester',Status='Known', Company = 'CD Test');
        insert lead;
        // create a Case
        Case cscase=new Case(Status = 'New', Priority = 'Medium', Origin = 'Email');
        cscase.Lead__c = lead.Id;
        insert cscase;
       
        //delete Lead
        delete lead;
        
        List<Case> lstCase = [Select id ,Status, Type from Case where Lead__c =:lead.id ];
        System.assert(lstCase.size() > 0 );
        System.assertEquals('Denied', lstCase[0].Status);
        System.assertEquals('Web Account Denied', lstCase[0].Type);
    }
}
 
Hello!

In our org, we associate customer service cases to leads. I wrote a trigger to update a case associated with a lead with contact information when a lead is converted. However, I am having trouble with the test class. Any help is greatly appreciated. Below is the code. 

Trigger: 

trigger UpdateCaseWhenLeadConverted on Lead (after update) {
    if(Trigger.isAfter && Trigger.isUpdate)
    {
       List<Case> lstCase = new List<Case>();
        Set<Id> convertedLeads = new Set<Id>();
        id convertcontact;
        for(Lead objLead : Trigger.new)
        {
            if(objLead.isConverted)
                convertedLeads.add(objLead.Id);
                convertcontact = objLead.ConvertedContactId;
        }
        for(Case objCase : [SELECT Lead__c FROM Case WHERE Lead__c IN : convertedLeads])    
        {
            objCase.Lead__c = null;
            objCase.ContactId = convertcontact;
            lstCase.add(objCase);
        }
        update lstCase;
    }
}

Test Class:
@isTest
public class UpdateCaseWhenLeadConvertedTest {

    private static testMethod void LeadConvertedTest(){
        //create a Lead
        Lead lead=new Lead(LastName='Test',FirstName='Tester',Status='Known');
        insert lead;
        lead= [SELECT Id, Status FROM Lead Where Id = :lead.Id];
        // create a Case
        Id RecordTypeIdCase = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Customer_Service_Record_Type').getRecordTypeId();
        Case cscase=new Case(RecordTypeId= RecordTypeIdCase, Lead__c = lead.Id);
        //update Lead
        Database.LeadConvert convertlead = new database.LeadConvert();
        convertlead.setLeadId(lead.Id);
        LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true];
        convertlead.setConvertedStatus(convertStatus.MasterLabel);
        Database.LeadConvertResult lcr = Database.convertLead(convertlead);
        System.assert(lcr.isSuccess());
        //test if case is updated
        lead= [SELECT ConvertedContactId, Id FROM Lead Where Id = :lead.Id];
        cscase= [SELECT ContactId FROM Case WHERE Lead__c = :lead.Id];
        System.assertEquals('lead.ConvertedContactId','cscase.ContactId' );
    }
}
 
Hi!

We have customer service cases related to the lead object. I am trying to write a trigger that updates any cases associated to leads that have been deleted. Below is my code. 

I get the error message: System.NullPointerException: Attempt to de-reference a null object: ()".
Any help is greatly appreciated!

Thanks, 
Tasia

trigger UpdateCaseWhenLeadDeleted on Lead (before delete) {
if(Trigger.isBefore && Trigger.isDelete)
    {
       List<Case> listCase = new List<Case>();
        Set<Id> DeletedLeads = new Set<Id>();
        for(Lead objLead : Trigger.new)
        {
            if(objLead.isDeleted)
                DeletedLeads.add(objLead.Id);
        }
        for(Case objCase : [SELECT Lead__c FROM Case WHERE Lead__c IN : DeletedLeads])    
        {
            objCase.Lead__c = null;
            objCase.Status = 'Declined';
            listCase.add(objCase);
        }
        update listCase;
    }
}
I have a visualforce page that calls a flow that creates an opportunity. I would like the finish location to be the multiadd action, so the user can add products to the newly created opportunity. 

Here is my code so far. Any suggestions?

<apex:page standardController="Opportunity" recordSetVar="opportunities">
    <flow:interview name="CreateOpportunityFlow" finishLocation="<apex:outputLink>{!URLFOR($Action.OpportunityLineItem.MultiAdd)}</apex:outputLink>">
        <apex:param name="AccountId" value="{!$CurrentPage.parameters.Id}"/>
    </flow:interview>
</apex:page>
I am looking for a way to copy the emails from a calendar event and returning just the email string, rather than the name and email string. 

Ideally it would look like: john@esource.com,nick@esource.com

I have been playing around with the TRIM and SUBSTITUTE functions but have been struggling to get it just right. 

Any help would be greatly appreciated. 

Thanks!
Tasia
Hi!! 

I have a lightning component that I am using in a flow to search for contacts. It works great on a desktop (see image below) but the search does not work in mobile. 

What am I missing? 

Any help would be greatly appreciated!
Tasia

User-added image

Here is my lightning component code:

Component
<aura:component implements="force:appHostable,lightning:availableForFlowScreens,flexipage:availableForAllPageTypes" access="global">
    <aura:attribute name="Contact" type="String" access="public" />
    <aura:attribute name="ContactLookup" type="String" access="public" />
    <aura:attribute name="ContactLookup__c" type="String" access="public" />
    <aura:attribute name="selectedRecordId" type="String" access="public" />
    
    <lightning:recordEditForm objectApiName="{!v.Contact}">
        <label class="ContactLookup">{!v.ContactLookup}</label>
        <lightning:inputField fieldName="{!v.ContactLookup__c}" onchange="{!c.handleOnChange}" />
    </lightning:recordEditForm>
</aura:component>    

Controller
({
    handleOnChange : function(component, event, helper) {
        component.set( "v.selectedRecordId", event.getParams( "fields" ).value );
    }
})

Style
.THIS label.slds-form-element__label {
    display: none;
}
.THIS .fieldLabel {
    font-size: .75rem;
}​​​​​​​

Design
<design:component>
    <design:attribute name="Contact" />
    <design:attribute name="ContactLookup" />
    <design:attribute name="ContactLookup__c" />
    <design:attribute name="selectedRecordId" />
</design:component>
 
Hi all, 

I am still learning writing apex code and could use some help on a controller I am writing for a visualforce email template. 

What I am trying to do is use a visualforce component to list all active contracts related to an account when a case is declined. 

Everything seems to work EXCEPT the component lists EVERY active contract not just those associated with the account. 

Any help would be greatly appreciated!!

Thanks,
Tasia

My controller looks like this: 

public class FindActiveContracts {
    private final List<Contract> contracts;
    public FindActiveContracts(){
        contracts = [select Name from Contract where status='Activated' AND EndDate > TODAY AND StartDate < TODAY AND AccountId IN (SELECT Id from Account Where Id =:case.accountId)];
        }
    public List<Contract> getActiveContracts() {
        return contracts;
    }
}

My component looks like this: 
<apex:component controller ="FindActiveContracts" access="global">
    <apex:dataTable value="{!ActiveContracts}" var="s_contract">
    <apex:column>
    <apex:facet name="header">Service Name</apex:facet>
        {!s_contract.Name}
    </apex:column>
</apex:dataTable>
</apex:component>

My email template looks like this: 
<messaging:emailTemplate subject="Your Ask E Source request on {!relatedTo.Subject}"
recipientType="Contact" 
relatedToType="Case"
replyTo="emily_hunsicker@esource.com">
<messaging:htmlEmailBody >        
    <html>
        <body>
         <STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
    <p>Hi {!recipient.Name},</p>
    <p>Thanks for your recent Ask E Source request on {!relatedTo.Subject}. We have done research about this topic as part of our E Source {!relatedTo.ProductLookup__r.Name}. Unfortunately, {!recipient.Account_Name__c} is not a member of that service, so we will not be able to answer your question at this time.</p>
        <p>Our <a href="https://www.esource.com/questions-faq">Ask E Source FAQ</a> describes the general topics that are covered under each of our services; you currently have access to these services:</p>
        <c:SetActiveContracts />                 
       <p>If you’d like a personal overview of your membership, please <a href="{!recipient.CSD_Calendly_Link__c}">contact us</a> to sign up for a 30-minute walk-through with your Customer Success Director, {!recipient.CSD_Name__c}. I have copied both {!recipient.CSD_First_Name__c} and {!recipient.BDD_Name__c}, your sales contact, on this message. 
 </p> 
       <p> Best,</p>
       <p> Emily Hunsicker</p>
       <p> Customer Success Coordinator, E Source</p>       
 </font>
       
        </body>
    </html>

Hi all, 

I have a working Visualforce email template, but it lists all the contacts associated to an account rather than just contacts that have a value in the role field. 

Is there a way to filter the related records to just look at contacts with roles? Below is my code!


<messaging:emailTemplate subject="Opportunity has been won, please review roles for this account" recipientType="User" relatedToType="Account">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
                  <font face="arial" size="2">
        <p>Hello,</p>
        <p>{!relatedTo.Name} has closed won opportunities. Please review the contacts with roles related to this account.</p>
        <p><u>Account Information</u></p>
        <b>Account Name:</b> <a href="https://na32.salesforce.com/{!relatedTo.id}">{!relatedTo.name}</a>  
        <br/><b>Account Owner:</b> {!relatedTo.owner.name}
        <p/>                  
       <table border="1px" >
                 <tr > 
                     <th>Contact Name</th> <th>Role</th>
                  </tr>
    <apex:repeat var="contact" value="{!relatedTo.Contacts}">
       <tr>
           <td align="center">{!contact.Name}</td>
           <td align="center">{!contact.Role__c}</td>
       </tr>
    </apex:repeat>                 
       </table>
       <p />
       <table border="1px" >
                 <tr > 
                     <th>Opportunity Name</th> <th>Amount</th>
                  </tr>
    <apex:repeat var="opportunity" value="{!relatedTo.Opportunities}">
       <tr>
           <td align="center">{!opportunity.Name}</td>
           <td align="center">{!opportunity.amount}</td>
       </tr>
    </apex:repeat>                 
       </table>
       <p />
       <p> Thank you</p>
 </font>
       
        </body>
    </html>
</messaging:htmlEmailBody> 
</messaging:emailTemplate>


Thanks so much for your help!
Tasia

Hi team Developer!

I am hoping you can help me with this tricky request. Our org has a custom object called Meeting__c and a related custom object called Attendee__c. These custom objects are used to hold notes about internal meetings and to list everyone who attended the meetings. 

What I want to do is if an Event is associated to a meeting, I want to take all of the Event attendees and create meeting attendees. Below, I believe I have the code needed to look up the Event attendees. But, then I go stuck as to where I go next to create the meeting attendees. 

Any help would be much appreciated! Thank you so much for your help!

trigger CreateAttendeesfromEventInvitees on Event (after insert, after update) {

For (Event EVT:trigger.new){
    List <eventRelation> Erelates =[select RelationId,WhoId from eventRelation where eventID=: EVT.id]; 
    Set<Id> erelateSet = (new Map<Id,eventRelation>(Erelates)).keySet();
    Set<Id> erelateSet = new Set<Id>();
    for(EventRelation evtRel : Erelates){
    erelateSet.add(evtRel.WhoId);
}
Is it possible to
1.create a list button on the related list for opportunity products 
2.call a flow from that list button. 

This is the visualforce page I constructed, but it says that List Controllers are not supported for OpportunityLineItem. If this is the case, is there any way around this, where I could have a list button that allows me to take action on multiple opportunity line items from within the opportunity?

<apex:page standardController="OpportunityLineItem" lightningStylesheets="true" tabStyle="OpportunityLineItem" recordSetVar="AllOpportunityLineItems">
  <apex:repeat value="{!AllOpportunityLineItems}" var="row" rendered="false">
  {!row.id}
  </apex:repeat>
  <flow:interview name="Opp_close_lose"
  finishLocation="{!URLFOR($Action.OpportunityLineItem.Tab, $ObjectType.OpportunityLineItem)}">
  <apex:param name="recordId" value="{!Selected}"/>
  </flow:interview>
</apex:page>

Let me know and thank you in advance for your help!

Tasia
Hi team, 

I have a rich text field on the account object where users can paste links to different pieces of content that they like. I then pulled a report with the rich text in it, and the links are not clickable. 

Is there a way to make these links clickable in the report? 

Let me know!

Thanks,
Tasia
Hi community!

I am having an interesting issue. Our Salesforce instance is integrated with our company website. We are a subscription-model company selling content, so we sync contacts up to our website to determine which contacts have web accounts and also what these contacts have access to. 

I am seeing a weird thing where I am getting errors for leads regarding the state in the state/country codes for leads only. So contacts are syncing all right, but leads seem to be erroring out. 

But, I thought the state/country picklist was universal for the instance so that does not make much sense to me. Am I wrong in that assumption? 

Any thoughts would be greatly appreciated. 

Thanks,
Tasia
Hi all, 

I am trying to write a trigger that posts the old Role value to Chatter when the Role field is udpated. My code is below. 

However, I am getting this error: RoleChangeTrigger: execution of AfterUpdate caused by System.StringException: Invalid id: AMS EB External entry point. 
AMS EB is the role that I was trying to change the field to. The role field is a multi-select picklist field. 

Any help would be greatly appreciated. 


trigger RoleChangeTrigger on Contact (after update) {
    List<FeedItem> posts = new List<FeedItem>();
    for(Contact con: Trigger.new){
        Contact newContact = Trigger.newMap.get(con.Role__c);
        Contact oldContact = Trigger.oldMap.get(con.Role__c);
        if(newContact.Role__c != oldContact.Role__c){
        String status = 'Role has changed. Here is the previous value:' + oldContact.Role__c;
            FeedItem post = new FeedItem(
            ParentId = con.Id,
            Title = 'Role Change',
            Body = status
            );
        }
    }
}
Hello, 

I am having some trouble getting the Lightning stylesheets to stick for the opportunity product Add Product action. I have a visualforce page and custom controller that I use to create an opportunity. Once the opportunity is created, one is redirected to add products to the opportunity. Right now, the redirect works, but sends the user into Classic to add the products and then is redirected back to Lightning. 

Is there a way to keep everything in Lightning? Below is the code for the visualforce page. 

Thanks in advance for your help!
Tasia

<apex:page lightningStylesheets="true" controller="OppCreateController"> <apex:slds > <!-- >> KO << flow:interview name="Testflow3" interview="{!OppCreate}" finishLocation="{!URLFOR($Action.OpportunityLineItem.AddProducts,OppId)}" / --> <flow:interview name="CreateOpportunityFlow" interview="{!OppCreate}" finishLocation="{!BackToOpp}"> <apex:param name="AccountId" value="{!$CurrentPage.parameters.Id}"/> </flow:interview> </apex:slds> </apex:page>