• Jack Volkov
  • NEWBIE
  • 55 Points
  • Member since 2014
  • Director, CRM


  • Chatter
    Feed
  • 1
    Best Answers
  • 8
    Likes Received
  • 2
    Likes Given
  • 13
    Questions
  • 37
    Replies
I can't seem to find any examples where I want to include fields in my query from the Lead table and the related Account table where the ConvertedAccountId matches.  I have tried writing queries but nothing is working.  Isn't this possible?  I can do two queries but I want to only do one and include some fields found in each table.
  • February 24, 2016
  • Like
  • 0
Is it possible to iterate through a collection multi-select picklist values on a single record using a flow loop element?
Assume the following:

Developer sandbox A:  process builder flow version 1 + version 2 (active version) with new changes 
Developer sandbox B:  process builder flow version 1 + version 2 with new changes + version 3 (active version) with new changes 
Version 1 is the same in both sandboxes
Version 2 is different in both sandboxes

How can version 2 & 3 be merged together to create a new version that includes differences in both without overwriting anything?

Can source control be used some how for this?
We'd like to create a custom log each time a workflow rule or process builder completes.  What is the most scalable way to do this?
In this apex class the logic is to update a custom lead field with a math.random() value.
public class leadRandomNumber {
	
	/* update lead status for leads related to the tasks */
    public static void updateRandomNumber (List<Lead> leadsFromTasks) {
    	
    	system.debug ('***** entering method leadRandomNumber.updateRandomNumber class *****');
    	
    	List<Lead> leadsToUpdate = new List<Lead>();
    	
    	List<Lead> leads = new List<Lead>([select Id, RandomNumber__c from Lead where Id IN :leadsFromTasks and Status='Attempting' and createddate = this_year and RandomNumber__c = null]);
    	system.debug('updateRandomNumber leads queried:' + leads.size());
    	// for leads related to the tasks apply a random number to the leads if they do not yet have one
    	for(lead ld: leads) {
    		if(ld.RandomNumber__c == null) {
    			Double rand = math.random();
    			ld.RandomNumber__c = rand;
    		}
    		leadsToUpdate.add(ld);
		}
		
		update leadsToUpdate;
		system.debug('updateRandomNumber leadsToUpdate: ' + leads.size());
    	
    }
    
}

This unit test verifies that inserting the task causes the logic in the apex class above to run and update the leads as expected.
 
/*
- For leads whose lead status was just updated as the result of an attempting call
- check that the random number was set
 */
 
@isTest
private class leadRandomNumberTest {

    static testMethod void insertAttemptingCall() {
    	
    	system.debug('Inserting outbound preview call tasks as a new logo rep...');
    	
    	User newLogoRep = [select id from user where isactive = true and profile.name = 'Inside Sales User' limit 1];
    	
    	QueueSobject smbQueue = [select queue.id from queuesobject where queue.name = 'SMB AE Queue'];
    	
    	Lead l = new Lead(Company='Company',LastName='Test',Phone='8885551234',Status='Open',LeadSource='Marketing', ownerid=smbQueue.queue.id);
        insert l;
        
        // bulk insert a list of calls related to the lead
        Task task = new Task(WhoId=l.Id, OwnerId=newLogoRep.Id, Type = 'Call', Five9__Five9CallType__c='Outbound Preview', Subject='Call Attempting', Status='Completed', Five9__Five9SessionId__c='fb3636336363', ActivityDate=date.today(), Five9__Five9HandleTime__c = '00:01:59', Five9__Five9WrapTime__c = '00:00:29');
        
        test.startTest();
        
        system.RunAs(newLogoRep) {
        	insert task;
        }
        
        system.debug('Asserting that the leads status was updated to Attempting and it now has a RandomNumber value...');
        
        Task insertedTask = [select Id, Status from Task where Id =: task.id];
        System.assertEquals('Completed',insertedTask.Status);
        
        // check that the lead was updated as expected
        Lead insertedLead = [select Id, Status, RandomNumber__c from Lead where Id =: l.Id];
        System.assertEquals('Attempting',insertedLead.Status);
    	System.assertNotEquals(null,insertedLead.RandomNumber__c);
    	
    	system.debug('random number set to: ' + insertedLead.RandomNumber__c);
    	
    	test.stopTest();
    
    }

}
However the test coverage for the apex class is only 56% as the updates inside the for loop are not covered.

code that needs coverage

What is the best practice for test coverage for the lines that are missing?
Since reading Advanced Apex Programming I've been a propenent of the "one trigger to rule them all" framework.  I then carried that philosophy over to process builder using a single upsert process for each object (Lead Upsert process, Account Upsert process, etc.).  The primary reason was to better control execution context of when flows will run within that object.  Winter 17' release now allows for the building of process builder hierarchies which seems like it eliminates the need to bunch everything up into a single process.

What do you think?  What does your process builder framework look like?
Sharing this in case anyone else needs it.  Here is a formula field for clean company name. 
TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Company, 
",", " ") /*remove commas*/,
".", " ") /*remove periods*/,
" inc", "") /*remove inc*/,
" Inc", "") /*remove Inc*/,
" INC", "") /*remove INC*/,
" llc", "") /*remove llc*/,
" Llc", "") /*remove Llc*/,
" LLC", "") /*remove LLC*/,
" Ltd", "") /*remove Ltd*/,
" LTD", "") /*remove LTD*/,
"Corporation", "") /*remove Corporation*/
)

If you have an improved version please post :)
How can a Flow's Wait Logic Offset Unit be set in minutes?  Is there a way to convert hours or days to minutes using decimals?  For example does 0.1 = 6 minutes?

User-added image
Is it possible to create a global picklist in a dev sandbox then deploy to production through a change set?  

If so, what is the component type of a global picklist?

Thanks
Ever since I updated Eclipse I can no longer connection to production.  Password and security token are correct and work with apex data loader.

But getting this error when attempting to deploy to server from Eclipse.  Before updating to the latest Force.com IDE I was able to connect.

User-added image

How do you fix this?
The logic in an apex trigger and apex class has been written to account for all known errors so that an exception will not be thrown.  But for those unknown errors that will occassionally popup, exception error handling has been written in order to better understand what caused the exception.

How can test coverage be provided for the exception handling example below if it is not yet known how an error can be caused in the first place?
try {
        // calling an apex class method so the logic runs
    } catch (System.Exception e) {
        trigger.new[0].addError('There was an error caused by an apex trigger calling an apex class.  Please contact your administrator.    '
        						+ ' *** exception type: ' + e.getTypeName()
        						+ ' *** cause: ' + e.getCause()
        						+ ' *** line number: ' + e.getLineNumber()
        						+ ' *** stack trace: ' + e.getStackTraceString());
        // send an email with error details
        Messaging.SingleEmailMessage mail=new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {'apexdevs@example.com'};
        mail.setToAddresses(toAddresses);
        mail.setReplyTo('apexdevs@example.com');
        mail.setSenderDisplayName('Apex Error Message');
        mail.setSubject('Error from Org : ' + UserInfo.getOrganizationName());
        mail.setPlainTextBody(e.getMessage());
        system.debug(' Exception message displayed for the user: ' + e.getMessage());
    }

 
When attempting to convert a lead, that has related tasks assigned to an inactive owner, a task trigger is being fired.  This then throws the following error:  
System.DmlException: Insert failed. First exception on row 0; first error: INACTIVE_OWNER_OR_USER, operation performed with inactive user: []
What is causing the task trigger to fire?  How can this be prevented?
How can a Google Site be viewed from a tab in SFDC?  The goal here is to create a new Tab in SFDC.  Then when a user clicks on that tab an internal Google Site is shown within the page with the sidebar displayed.

Thanks
Since reading Advanced Apex Programming I've been a propenent of the "one trigger to rule them all" framework.  I then carried that philosophy over to process builder using a single upsert process for each object (Lead Upsert process, Account Upsert process, etc.).  The primary reason was to better control execution context of when flows will run within that object.  Winter 17' release now allows for the building of process builder hierarchies which seems like it eliminates the need to bunch everything up into a single process.

What do you think?  What does your process builder framework look like?
Sharing this in case anyone else needs it.  Here is a formula field for clean company name. 
TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Company, 
",", " ") /*remove commas*/,
".", " ") /*remove periods*/,
" inc", "") /*remove inc*/,
" Inc", "") /*remove Inc*/,
" INC", "") /*remove INC*/,
" llc", "") /*remove llc*/,
" Llc", "") /*remove Llc*/,
" LLC", "") /*remove LLC*/,
" Ltd", "") /*remove Ltd*/,
" LTD", "") /*remove LTD*/,
"Corporation", "") /*remove Corporation*/
)

If you have an improved version please post :)
How can a Flow's Wait Logic Offset Unit be set in minutes?  Is there a way to convert hours or days to minutes using decimals?  For example does 0.1 = 6 minutes?

User-added image
Is it possible to iterate through a collection multi-select picklist values on a single record using a flow loop element?
Message: Uncaught Error in $A.getCallback() [Invalid date value]
Callback failed: apex://sortablegrid.sdgController/ACTION$GetSDGInitialLoad

In the sortable data grid i created there is no date field 

component descriptor:
markup://sortablegrid:sdg

File Name:
auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js

Function:
Action.$finishAction$

Skip trace:

Action.$finishAction$()@https:/auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js:13728:22
QueuedActionsMetricsPlugin.$actionFinishOverride$()@https:/auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js:27804:24
Object.Aura.$Utils$.$Override$.$continuation$()@https:/auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js:7021:20
Action.bound [as $finishAction$]()@https:/auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js:6958:29
AuraClientService.$singleAction$()@https:/auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js:15570:14
AuraClientService.$processResponses$()@https:/auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js:17134:14
QueuedActionsMetricsPlugin.$actionsProcessResponses$()@https:/auraFW/javascript/9cP17KDqrLzgsg8CdQTfjw/aura_proddebug.js:27823:23

The sortable data grid i created doesn't have a date field at all
Assume the following:

Developer sandbox A:  process builder flow version 1 + version 2 (active version) with new changes 
Developer sandbox B:  process builder flow version 1 + version 2 with new changes + version 3 (active version) with new changes 
Version 1 is the same in both sandboxes
Version 2 is different in both sandboxes

How can version 2 & 3 be merged together to create a new version that includes differences in both without overwriting anything?

Can source control be used some how for this?
We'd like to create a custom log each time a workflow rule or process builder completes.  What is the most scalable way to do this?
In this apex class the logic is to update a custom lead field with a math.random() value.
public class leadRandomNumber {
	
	/* update lead status for leads related to the tasks */
    public static void updateRandomNumber (List<Lead> leadsFromTasks) {
    	
    	system.debug ('***** entering method leadRandomNumber.updateRandomNumber class *****');
    	
    	List<Lead> leadsToUpdate = new List<Lead>();
    	
    	List<Lead> leads = new List<Lead>([select Id, RandomNumber__c from Lead where Id IN :leadsFromTasks and Status='Attempting' and createddate = this_year and RandomNumber__c = null]);
    	system.debug('updateRandomNumber leads queried:' + leads.size());
    	// for leads related to the tasks apply a random number to the leads if they do not yet have one
    	for(lead ld: leads) {
    		if(ld.RandomNumber__c == null) {
    			Double rand = math.random();
    			ld.RandomNumber__c = rand;
    		}
    		leadsToUpdate.add(ld);
		}
		
		update leadsToUpdate;
		system.debug('updateRandomNumber leadsToUpdate: ' + leads.size());
    	
    }
    
}

This unit test verifies that inserting the task causes the logic in the apex class above to run and update the leads as expected.
 
/*
- For leads whose lead status was just updated as the result of an attempting call
- check that the random number was set
 */
 
@isTest
private class leadRandomNumberTest {

    static testMethod void insertAttemptingCall() {
    	
    	system.debug('Inserting outbound preview call tasks as a new logo rep...');
    	
    	User newLogoRep = [select id from user where isactive = true and profile.name = 'Inside Sales User' limit 1];
    	
    	QueueSobject smbQueue = [select queue.id from queuesobject where queue.name = 'SMB AE Queue'];
    	
    	Lead l = new Lead(Company='Company',LastName='Test',Phone='8885551234',Status='Open',LeadSource='Marketing', ownerid=smbQueue.queue.id);
        insert l;
        
        // bulk insert a list of calls related to the lead
        Task task = new Task(WhoId=l.Id, OwnerId=newLogoRep.Id, Type = 'Call', Five9__Five9CallType__c='Outbound Preview', Subject='Call Attempting', Status='Completed', Five9__Five9SessionId__c='fb3636336363', ActivityDate=date.today(), Five9__Five9HandleTime__c = '00:01:59', Five9__Five9WrapTime__c = '00:00:29');
        
        test.startTest();
        
        system.RunAs(newLogoRep) {
        	insert task;
        }
        
        system.debug('Asserting that the leads status was updated to Attempting and it now has a RandomNumber value...');
        
        Task insertedTask = [select Id, Status from Task where Id =: task.id];
        System.assertEquals('Completed',insertedTask.Status);
        
        // check that the lead was updated as expected
        Lead insertedLead = [select Id, Status, RandomNumber__c from Lead where Id =: l.Id];
        System.assertEquals('Attempting',insertedLead.Status);
    	System.assertNotEquals(null,insertedLead.RandomNumber__c);
    	
    	system.debug('random number set to: ' + insertedLead.RandomNumber__c);
    	
    	test.stopTest();
    
    }

}
However the test coverage for the apex class is only 56% as the updates inside the for loop are not covered.

code that needs coverage

What is the best practice for test coverage for the lines that are missing?
Sharing this in case anyone else needs it.  Here is a formula field for clean company name. 
TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Company, 
",", " ") /*remove commas*/,
".", " ") /*remove periods*/,
" inc", "") /*remove inc*/,
" Inc", "") /*remove Inc*/,
" INC", "") /*remove INC*/,
" llc", "") /*remove llc*/,
" Llc", "") /*remove Llc*/,
" LLC", "") /*remove LLC*/,
" Ltd", "") /*remove Ltd*/,
" LTD", "") /*remove LTD*/,
"Corporation", "") /*remove Corporation*/
)

If you have an improved version please post :)
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. 

Thank you again for your patience and assistance. And thanks for using salesforce.com! 

Error ID: 622001247-7550 (-697924050)

*****************************************************************

I receive this error message when trying to load the change set details page.

I tried to log a case with Salesforce.  Seems as though I was directed here and wasn't able to edit any of the case content to fill out the required fields... like Description.  Not sure how you guys could help me.  But if anyone has some insight, that'd be great.  Deployments were working fine yesterday.  I cloned my changeset to upload to production, that didn't work.  Create a brand new change set to upload to production and that didn't work.  So I went to the partial sandbox and created a new change set from there and uploaded it as well, and that also didn't work.  

Thanks

Hello,

I created a new flow with the following criteria:

ISCHANGED([Case].Status) && [Case].BA_Owner_with_lookup__c <> [Case].bl_Assigned_To_User__c && !ispickval([Case].Status,'Closed') &&NOT(ISNULL([Case].BA_Owner_with_lookup__c))
&&OR([Case].BA_Owner_with_lookup__c.Profile.Name = 'Cloud Community', [Case].BA_Owner_with_lookup__c.Profile.Name='Exlibris Partner User' )

I keep getting the following error:

"The flow failed to access the value for myVariable_current.BA_Owner_with_lookup__c.Profile.Name because it hasn't been set or assigned"

Any suggestions?

Thanks,

Udi
Hi,
I have a live agent with pre chat form but I want to hide a url bar in chat box and pre form.
Is it possible? and how?


Thanks
Ahmad
 
I have a flow where I tried to add the multiselect picklist values to a collection variable but this simply added all values as one value (e.g. "x;y;z" rather than "x";"y";"z". How do I add these as individual values to the collection so that I can use them in a loop? 
  • October 30, 2014
  • Like
  • 0
We have a contact merge process outside of Salesforce that calls the Contact merge API.  We've seen several examples where this happens:
  • The last created Contact record is selected as the Master record (survivor)
  • The Contact record being deleted (merged into the Master) has data in FieldA, but the Master doesn't
  • After the merge, the data in FieldA on the Master is null
My understanding of the merge process is that it evaluates the field level last update date to determine which record to use data from.  However, wouldn't it also evaluate null vs. non-null?
  • February 11, 2016
  • Like
  • 1
Why does this result in duplicate values for a single owner change event?
select Id, CreatedDate, Field, LeadId, NewValue, OldValue 
from LeadHistory
where (field = 'ownerAssignment' or field = 'Owner')
The lead history object has one record where the newvalue/oldvalue is the actual owner/ namequeue name, and then a duplicate record with the exact same CreatedDate time stamp that shows newvalue/oldvalue as the owner id/queue id.

What is going on here?  Why does lead history have 2 records for the exact same event?

User-added image
  • September 04, 2015
  • Like
  • 2