12
votes
Accepted
Trigger not updating field in Test Class
The error is in your Status. In the trigger you've got:
if (l.Status =='Open- Not Contacted')
(note the n- N), and in your test class you create it as:
ld.Status='Open -Not Contacted';
(note the n ...
6
votes
Can't create Apex Class, need to convert lead via REST
The Partner API SOAP method convertLead() is at its core an HTTP POST request where the Body is XML that conforms to to the WSDL.
There is nothing stopping you from building up that XML string and ...
6
votes
Accepted
Address field: Set Address via Apex
You set the individual fields, such as BillingStreet, BillingCity, BillingState, BillingPostalCode, and BillingCountry (plus the geolocation codes, as well, if you prefer). The address complex field ...
6
votes
Cannot get Unit Test to pass in order to push trigger to production
Steve, I'm guessing the problem is that you don't have any Zip_Code__c objects defined in the test environment! Remember, tests run with no standard SObjects, they don't have access to your data. You ...
6
votes
Accepted
'Unexpected syntax: 'mismatch input 'insert' expecting RCURLY' on apex test class for trigger
You can't put "executable" code outside of a method. Also, to actually have a unit test, you need a method marked with @isTest or testMethod. You also have a few other minor issues.
@isTest
public ...
5
votes
Accepted
When one merges accounts, contacts or leads what happens to lookup relationships?
According to this documentation, they will move:
Any related items from any of the duplicate accounts will be associated with the newly merged account.
5
votes
Accepted
How does Pardot Prospect Sync work?
Found it - at least the closest I could find:
If you're using a custom field in Salesforce on both leads and contacts, we pull the name of the Salesforce field from the contact field ID.
...
We ...
5
votes
Lead Status Converted Value to Contact Status
From the docs:
When you convert a lead, data in standard lead fields is transferred
into standard account, contact, and opportunity fields. For custom
lead fields, the data is mapped to custom ...
5
votes
Accepted
Visualforce customization isn't displaying multiple fields
The reason for this issue is that the relatedList is not named "Campaign Histories"
Use:
<apex:relatedList list="CampaignMembers"/>
apex:relatedList list= values have to be valid relationship ...
5
votes
Is there a way to hide/disable standard Salesforce button clicked
To hide the button
This can be done with record types and page layouts
Create two record types -
one for Leads with stages up to but not including the stage that allows conversion
one for Leads in ...
5
votes
Can anyone suggest a good Mass Duplicate Leads Merge Free tool?
This is probably one of those situations where you have a tradeoff between cost and time.
When I (well, me and my intern) needed to sort through roughly 30,000 Contact records to 'deduplicate' and '...
5
votes
Lead before update runs on insert
A typical reason for this is that you have Lead Assignment rules. Once those execute, a new owner is assigned and hence the Lead object is updated. You can see this in the debug log if you enable ...
5
votes
Accepted
Prevention of Lead conversion as it has a time based action queued
I think, you are creating time based action based on created date and this time based action is getting queued.
I would suggest you to create a separate datetime field, let's say Action DateTime ...
5
votes
Is Lead.Name 100% predictable?
The documentation on Lead seems pretty clear:
Name
Description
Concatenation of FirstName, MiddleName, LastName, and Suffix up to 203 characters, including whitespaces.
4
votes
Accepted
REST api Post lead got invalid field when post to group edition
This error is specific to a user that doesn't have access to a particular field. As far as I'm aware, Website is a standard field that appears in all editions that support leads (all but personal ...
4
votes
Accepted
Can i get the Lead ID once it has already been converted?
You can use a standard report type of 'Leads with converted lead information'.
Add a filter of Converted = true
This will give you all your converted leads, the contact, opportunity, and account ...
4
votes
Accepted
New leads bypass assignment rules because of SOAP API
When using the SOAP Partner API you will need to set the AssignmentRuleHeader.
With this you can control if the default assignment rule should be applied, or if an alternative rule, identified by the ...
4
votes
Accepted
How to view converted Lead info?
In the Reports tab, create a new report using "Leads / Leads with converted Lead information" if you want to get account, contact, and opportunity information side-by-side with the lead, or you can ...
4
votes
Accepted
How can I get the Campaign IDs of Leads through triggers?
[SELECT Id, CampaignId, LeadId FROM CampaignMember WHERE LeadId IN :leadsInTrigger ]
Using this query you get all campaign member for the leads that are in your trigger scope. From that you should be ...
4
votes
Accepted
How to convert a LEAD to Person-Account directly (without any API or code)?
From this answer at Salesforce Developer Forums, it appears that when Person Accounts are enabled in your Org you can make the Company on Lead optional and remove it from the page layout.
Do you ...
4
votes
Accepted
Why is LastModifiedDate not listed as a standard field in the UI?
Its a system generated date that is not listed in the standard field list. You will also notice that Created Date is not listed there. These field still exist. You can confirm by doing a simple ...
4
votes
Trigger not updating field in Test Class
Among the other answers here you will still need to move this line to be after you insert your task.
Lead Getleadupdated = [SELECT Status FROM Lead where ID = : createlead.id];
Otherwise the value ...
4
votes
Accepted
How can I modify the layout of the Leads Home Page?
Shortest answer: you can't do this with customization.
Shorter answer: It has been rumored that this might be something you can customize in Lightning (in a future release), but there's no way to do ...
4
votes
Accepted
Trigger Process Builder when user receives lead, not queue
In your Process Builder criteria diamond check the Lead OwnerId starts with 005
This will tell you whenever a Lead is assigned to a User instead of a Queue
4
votes
Query Only Duplicated Records
You must have got a success file stored on your local machine after insertion of records. Take the last files from the two record insertion files and take the id's from them. Delete those id's via the ...
4
votes
Query Only Duplicated Records
I would recommend in an urgent scenario like this (and assuming you have the "power" to be so decisive) using the Developer Console to run some Anonymous Apex to draw out a list and delete the ...
4
votes
Accepted
How to add a map widget to a Lead object?
Supporting @Adrian's comment, I am providing my answer.
Rather than using "Google Maps API" (which is not fully FREE), I have used <apex:map> component which is in-build in Salesforce and takes ...
4
votes
Assign leads from few queues as per round robin rule
You can look for the options to use Omni-Channel for lead assignment.
Use Omni-Channel to create work items from Salesforce records and route them to the most qualified, available agents in your ...
4
votes
Accepted
Avoiding creating duplicate Contacts in Marketing Cloud when using Sales Cloud records
Generally speaking, we create Automations that do a Query/Extract/Import to All Subscribers for any email address that's associated with an unsubscribed Subscriber Key. This obviously doesn't prevent ...
4
votes
Accepted
Automation on lead merge
Using the after delete trigger via MasterRecordId is documented to be the only way to trigger on a merge:
If your application requires special handling for deleted records that occur as a result of ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
leads × 628apex × 105
lead-conversion × 104
trigger × 74
web2lead × 33
contact × 32
rest-api × 30
campaign × 30
visualforce × 28
account × 27
assignment-rules × 27
opportunity × 23
email × 22
duplicate-management × 19
soql × 18
reporting × 18
lightning × 17
workflow × 17
campaign-member × 16
marketing-cloud × 14
visual-workflow × 14
validation × 14
community × 11
api × 11
formula × 11