• Kathleen Lehnigk
  • NEWBIE
  • 10 Points
  • Member since 2014
  • Group CRM Systems Manager
  • LGC Ltd

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 10
    Replies
Hi all,

I've dived more into the Flows in order to create much needed processes for our Service Cloud - case management with clicks instead of code - just because I can't code :-) 

I've created 2 flows that should run, when the case is created.
1) if no contact is associated with the case, create the new contact plus potentially account. Here's I've tried setting up a similar setup like we have in Desk.com, where email domains can be linked to specific accounts and then the new contact gets created into that. It then also checks any old cases with that email address and updates the contact & account. 

2) When any new case is created, check if the email address or the email domain is contained in a custom object that contains spam emails/domains. If so, assign the case to the Spam queue (with potential to delete later). 

Both flows work fine in our sandbox environment. I'm now a bit scared to move it to our Production. We will currently have something around 2000 cases per day with a potential to further increase.The first rule will luckily not apply all the time, but the second will. 

Can any of you please let me know, if flows is the ok-way to approach this? I've read, that there is a limit on "Executed elements at runtime per flow", just not sure, what this actually means.

We also already have over a million cases and 380,000 contacts, so for the first flow I'm worried, that the time limit is exceeded quickly (even though I'll only search through cases not having a contact associated - currently ~45k).

Anyone else who has created something similarly using flows and can share their experiences?

Thanks. 
Much appreciated
Kathleen
Hi there,

We have some apex class, that will pick up the original sender from an email-to-case, if the email is forwarded into Salesforce (so, i.e. subject line starts with FW:

While this works well in English, we have some subsidiaries, who will forward emails and the "From" value will then show in their local language (i.e. "Von" in German or "Fra" in Danish).

Below is the code part, that checks for the From email part on the email to take that email address and then later use it to ass as the SuppliedEmail on the case.

I've tried to find in the forums any way of creating different language versions, but nothing I've tried worked.

So, my hope is, that someone from the Community will be able to help with this part.

Thanks a lot
Kathleen
 
//This class will search through the email bodies to see if
    //we can find something similar to this pattern
    //From: Doe, John <john.doe@test.com>
    private static list<case> parseEmails(list<emailMessage> emList){
        try{
            map<id,case> cMap = new map<id,case>();
            map<id,string> emailMap = new map<id,string>();
            
            for(emailMessage em: emList){
                //looking for this pattern in the email body 'From: Doe, John <mailto:john.doe@test.com>'
                             
                pattern myPattern = pattern.compile('From:[a-zA-Z\\s\\,-]{1,100}[<|\\[][a-zA-Z0-9\\.\\-\\_\\:]{1,100}@[a-zA-Z0-9\\.\\-\\_]{1,100}[>|\\]]');
                matcher myMatcher = myPattern.matcher(em.TextBody);
                
                if(myMatcher.find()){
                    integer start = myMatcher.start();
                    integer stop = myMatcher.end();

                    string match = em.TextBody.substring(start,stop);
                    
                    //At this point you should have a string like this 'From: Doe, John <mailto:john.doe@test.com>'
                    //Now we will parse the name and the email from here
                    if(match.contains('[')){
                        start = match.indexOf('[');
                    }else{
                        start = match.indexOf('<');
                    }
                    
                    
                    string email = match.substring(start+1,match.length()-1).replace('mailto:','');
                    
                    //parse the name
                    string name = match.substring(0,start);
                    name = name.replace('from:','').replace('From:','').trim();
                    
                    //store the email address and case seperate
                    emailMap.put(em.id,email);
                    cMap.put(
                        em.id,
                        new case(
                            id = em.ParentId,
                            SuppliedEmail = email,
                            SuppliedName = name,
                            contactId = null
                        )
                    );
                    
                }

 
Hi everyone,

We have recently started using Service Cloud (Lightning) for one of our divisions. 

For another division we are currently investigating on whether it's worth moving them from Desk.com to Service Cloud as well. Unfortunately Desk.com has a nice feature with coloured labels, where in a list view you'll already see flagged up, what this case is about.

Has anyone been able to implement something similar in Service Cloud?

Formula fields won't work, as there are already lots of labels used and users are allowed to add more (similar to the Topics in Salesforce).

Just want to get an idea, of whether this is possible at all.

Thank you
Best wishes
Kathleen

User-added image

User-added image
Hello everybody,

We've created a new object called Visit Reports in our org. After having created a meeting they will be able to click a button in order to create a new Visit Report record from there. I've created a custom URL-button for that in order to pass on certain values into the new Visit Report Record.

/a18/e?retURL={!Event.What}&CF00ND0000006ECXR={!Account.Name}&CF00ND0000006ECXR_lkid={!Account.Id}&00ND0000006ECXa={!Event.Description}&00ND0000006ECXb={!Event.Location}&00ND0000006ECXY={!Event.ActivityDate}&CF00ND0000006ECXf={!Contact.Name}&CF00ND0000006ECXf_lkid={!Contact.Id}&00ND0000006ECXg={!Contact.Name}&00ND0000006ECXU={!Event.Id}

Unfortunately this does not link the Meeting with the Visit Report record directly, which is why I've created another button on the newly created Visit Report. After clicking this (Javascript) button, the meeting record will be linked with the Visit Report record. For that I'm having an Activity ID field on the visit report record, which the button uses to link the 2 records.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

var EvObj = new sforce.SObject("Event");
var VR = new sforce.SObject("Visit_Report__c");

EvObj.Id = '{!Visit_Report__c.Activity_ID__c}';
EvObj.Visit_Report__c = '{!Visit_Report__c.Id}';
EvObj.WhatID = '{!Account.Id}';
var result = sforce.connection.update([EvObj]);
location.reload(true);

My question now is, whether you know of a nice & easy way to combine the 2 buttons into 1. So, that when you create the New Visit Report from the Meeting, it is automatically linked to the Meeting record.

I've used some code from some dev-website to create the Javascript-button. I'm not very knowledgable in this type of coding.

Thank you already in advance for any advice you can give in this matter.

Kathleen
Hi everyone,

I've created a VF page to replace the "New" button. Unfortunately it didn't pull the account address data plus phone number into the contact as the standard page would do.

After some amending my VF page and writing a controller extension, I'm at least able to get the values from the account shown in the contact, but when saving the record I get the following error message:

System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!Save}' in component <apex:commandButton> in page test
Class.RelatedController.save: line 23, column 1

The code for my VF page is:
<apex:page standardController="Contact" extensions="RelatedController" action="{!AccountPopulated}" title="Contact Edit" showHeader="true" sidebar="true">

    <apex:sectionHeader title="Contact Edit" subtitle="New Contact"/>
    <apex:form id="theform">
              
        <apex:pageMessages escape="false"/>     
              
        <apex:pageBlock title="Main Detail" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}" immediate="false"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>

                <apex:pageBlockSection title="Contact Information" columns="2">
                    <apex:inputField value="{!Contact.Salutation}"/>
                    <apex:inputField value="{!Contact.Account.Phone}" required="TRUE"/>
                    <apex:inputField value="{!Contact.FirstName}"/>
                    <apex:inputField value="{!Contact.Email}" required="TRUE"/>
                    <apex:inputField value="{!Contact.LastName}"/>
                </apex:pageBlockSection>
                     
                <apex:pageBlockSection title="Address Information" columns="2">
                    <apex:inputField value="{!contact.AccountId}" required="true"/>
                    <apex:pageBlockSectionItem > </apex:pageBlockSectionItem> 
                    <apex:inputField value="{!Contact.Account.BillingStreet}" label="Mailing Street" id="MailingStreet"/>
                    <apex:inputField value="{!Contact.OtherStreet}" id="OtherStreet"/>
                    <apex:inputField value="{!Contact.Account.BillingCity}" label="Mailing City" id="MailingCity" required="true"/>
                    <apex:inputField value="{!Contact.OtherCity}" id="OtherCity"/>
                    <apex:inputField value="{!Contact.Account.BillingPostalCode}" label="Mailing Zip/Postal Code" id="MailingPostalCode"/>
                    <apex:inputField value="{!Contact.OtherPostalCode}" id="OtherPostalCode"/>
                    <apex:inputField value="{!Contact.Account.BillingState}" label="Mailing State/Province" id="MailingState"/>
                    <apex:inputField value="{!Contact.OtherState}" id="OtherState"/>
                    <apex:inputField value="{!Contact.Account.BillingCountry}" label="Mailing Country" id="MailingCountry" required="true"/> 
                    <apex:inputField value="{!contact.OtherCountry}" id="OtherCountry"/> 
                </apex:pageBlockSection>
                
        </apex:pageBlock>
    </apex:form>
</apex:page>
my Controller extension is:
public with sharing class RelatedController
{

 public Contact cont{get;set;}
 
 public ApexPages.StandardController controller;
  
 public RelatedController(ApexPages.StandardController controller)
 {
  this.controller = controller;

 }
  
 public void AccountPopulated()
 { 
   Contact con=(Contact) controller.getRecord();
   if(con != null)
   con.Account=[select Account.BillingStreet, Account.BillingCity, Account.BillingPostalCode, Account.BillingState, Account.BillingCountry, Account.Phone from Account where id=:con.AccountId limit 1];
   else this.cont = new Contact (); 
 }
 
    public PageReference save() {
        insert this.cont;
        return null;
  }}

Your help in this is really appreciated.

Thank you
Kathleen
Hi everyone,

We have recently started using Service Cloud (Lightning) for one of our divisions. 

For another division we are currently investigating on whether it's worth moving them from Desk.com to Service Cloud as well. Unfortunately Desk.com has a nice feature with coloured labels, where in a list view you'll already see flagged up, what this case is about.

Has anyone been able to implement something similar in Service Cloud?

Formula fields won't work, as there are already lots of labels used and users are allowed to add more (similar to the Topics in Salesforce).

Just want to get an idea, of whether this is possible at all.

Thank you
Best wishes
Kathleen

User-added image

User-added image
Hi all,

I've dived more into the Flows in order to create much needed processes for our Service Cloud - case management with clicks instead of code - just because I can't code :-) 

I've created 2 flows that should run, when the case is created.
1) if no contact is associated with the case, create the new contact plus potentially account. Here's I've tried setting up a similar setup like we have in Desk.com, where email domains can be linked to specific accounts and then the new contact gets created into that. It then also checks any old cases with that email address and updates the contact & account. 

2) When any new case is created, check if the email address or the email domain is contained in a custom object that contains spam emails/domains. If so, assign the case to the Spam queue (with potential to delete later). 

Both flows work fine in our sandbox environment. I'm now a bit scared to move it to our Production. We will currently have something around 2000 cases per day with a potential to further increase.The first rule will luckily not apply all the time, but the second will. 

Can any of you please let me know, if flows is the ok-way to approach this? I've read, that there is a limit on "Executed elements at runtime per flow", just not sure, what this actually means.

We also already have over a million cases and 380,000 contacts, so for the first flow I'm worried, that the time limit is exceeded quickly (even though I'll only search through cases not having a contact associated - currently ~45k).

Anyone else who has created something similarly using flows and can share their experiences?

Thanks. 
Much appreciated
Kathleen
Hi everyone,

We have recently started using Service Cloud (Lightning) for one of our divisions. 

For another division we are currently investigating on whether it's worth moving them from Desk.com to Service Cloud as well. Unfortunately Desk.com has a nice feature with coloured labels, where in a list view you'll already see flagged up, what this case is about.

Has anyone been able to implement something similar in Service Cloud?

Formula fields won't work, as there are already lots of labels used and users are allowed to add more (similar to the Topics in Salesforce).

Just want to get an idea, of whether this is possible at all.

Thank you
Best wishes
Kathleen

User-added image

User-added image
Hello everybody,

We've created a new object called Visit Reports in our org. After having created a meeting they will be able to click a button in order to create a new Visit Report record from there. I've created a custom URL-button for that in order to pass on certain values into the new Visit Report Record.

/a18/e?retURL={!Event.What}&CF00ND0000006ECXR={!Account.Name}&CF00ND0000006ECXR_lkid={!Account.Id}&00ND0000006ECXa={!Event.Description}&00ND0000006ECXb={!Event.Location}&00ND0000006ECXY={!Event.ActivityDate}&CF00ND0000006ECXf={!Contact.Name}&CF00ND0000006ECXf_lkid={!Contact.Id}&00ND0000006ECXg={!Contact.Name}&00ND0000006ECXU={!Event.Id}

Unfortunately this does not link the Meeting with the Visit Report record directly, which is why I've created another button on the newly created Visit Report. After clicking this (Javascript) button, the meeting record will be linked with the Visit Report record. For that I'm having an Activity ID field on the visit report record, which the button uses to link the 2 records.

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

var EvObj = new sforce.SObject("Event");
var VR = new sforce.SObject("Visit_Report__c");

EvObj.Id = '{!Visit_Report__c.Activity_ID__c}';
EvObj.Visit_Report__c = '{!Visit_Report__c.Id}';
EvObj.WhatID = '{!Account.Id}';
var result = sforce.connection.update([EvObj]);
location.reload(true);

My question now is, whether you know of a nice & easy way to combine the 2 buttons into 1. So, that when you create the New Visit Report from the Meeting, it is automatically linked to the Meeting record.

I've used some code from some dev-website to create the Javascript-button. I'm not very knowledgable in this type of coding.

Thank you already in advance for any advice you can give in this matter.

Kathleen
Hi everyone,

I've created a VF page to replace the "New" button. Unfortunately it didn't pull the account address data plus phone number into the contact as the standard page would do.

After some amending my VF page and writing a controller extension, I'm at least able to get the values from the account shown in the contact, but when saving the record I get the following error message:

System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!Save}' in component <apex:commandButton> in page test
Class.RelatedController.save: line 23, column 1

The code for my VF page is:
<apex:page standardController="Contact" extensions="RelatedController" action="{!AccountPopulated}" title="Contact Edit" showHeader="true" sidebar="true">

    <apex:sectionHeader title="Contact Edit" subtitle="New Contact"/>
    <apex:form id="theform">
              
        <apex:pageMessages escape="false"/>     
              
        <apex:pageBlock title="Main Detail" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!Save}" immediate="false"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>
            </apex:pageBlockButtons>

                <apex:pageBlockSection title="Contact Information" columns="2">
                    <apex:inputField value="{!Contact.Salutation}"/>
                    <apex:inputField value="{!Contact.Account.Phone}" required="TRUE"/>
                    <apex:inputField value="{!Contact.FirstName}"/>
                    <apex:inputField value="{!Contact.Email}" required="TRUE"/>
                    <apex:inputField value="{!Contact.LastName}"/>
                </apex:pageBlockSection>
                     
                <apex:pageBlockSection title="Address Information" columns="2">
                    <apex:inputField value="{!contact.AccountId}" required="true"/>
                    <apex:pageBlockSectionItem > </apex:pageBlockSectionItem> 
                    <apex:inputField value="{!Contact.Account.BillingStreet}" label="Mailing Street" id="MailingStreet"/>
                    <apex:inputField value="{!Contact.OtherStreet}" id="OtherStreet"/>
                    <apex:inputField value="{!Contact.Account.BillingCity}" label="Mailing City" id="MailingCity" required="true"/>
                    <apex:inputField value="{!Contact.OtherCity}" id="OtherCity"/>
                    <apex:inputField value="{!Contact.Account.BillingPostalCode}" label="Mailing Zip/Postal Code" id="MailingPostalCode"/>
                    <apex:inputField value="{!Contact.OtherPostalCode}" id="OtherPostalCode"/>
                    <apex:inputField value="{!Contact.Account.BillingState}" label="Mailing State/Province" id="MailingState"/>
                    <apex:inputField value="{!Contact.OtherState}" id="OtherState"/>
                    <apex:inputField value="{!Contact.Account.BillingCountry}" label="Mailing Country" id="MailingCountry" required="true"/> 
                    <apex:inputField value="{!contact.OtherCountry}" id="OtherCountry"/> 
                </apex:pageBlockSection>
                
        </apex:pageBlock>
    </apex:form>
</apex:page>
my Controller extension is:
public with sharing class RelatedController
{

 public Contact cont{get;set;}
 
 public ApexPages.StandardController controller;
  
 public RelatedController(ApexPages.StandardController controller)
 {
  this.controller = controller;

 }
  
 public void AccountPopulated()
 { 
   Contact con=(Contact) controller.getRecord();
   if(con != null)
   con.Account=[select Account.BillingStreet, Account.BillingCity, Account.BillingPostalCode, Account.BillingState, Account.BillingCountry, Account.Phone from Account where id=:con.AccountId limit 1];
   else this.cont = new Contact (); 
 }
 
    public PageReference save() {
        insert this.cont;
        return null;
  }}

Your help in this is really appreciated.

Thank you
Kathleen

Hi,

 

I have a custom field on the opportunity object named 'contact__c'. This is a simple lookup field.

If populated I want a trigger that creates an Opportunity contact role for that same contact.

 

Any ideas?

 

I can update the contact__c field based on the primary contact role but I need this work the other way round.

 

Any ideas?

 

Thanks