Monday, 19 September 2016

Cory Cowgill - Achievement Unlocked: Generating a PDF in an Apex Trigger

Cory Cowgill - Achievement Unlocked: Generating a PDF in an Apex Trigger



Hi Cory,



In the trigger some of the fields values are come to NULL how to check the conditions if the field having null no need to display in the pdf

Friday, 24 October 2014

How to write a DeDuping for Lead or Contact Object.

In this scenario to avoid duplicate email in Lead or Contact object.



I have two object one is standard object and another one is custom object here my question is I am create a new record standard or custom its clone of another record. How u can implements this one.


trigger CloneRecOnAccount on Account (after insert) 
{
list<Account> setAccList = new list<Account>();
set<string> accNameSet = new set<string>();
for(Account newAcc : Trigger.new)
{
accNameSet.add(newAcc.name);
}

list<Account> getAccRec = [ select name,TimeStamp__c from Account where name in : accNameSet];

for(Account getAcc : Trigger.new )
{
if(getAccRec.size() < 2)
{
Account acc = new Account();
acc.name = getAcc.name;
acc.TimeStamp__c = getAcc.TimeStamp__c;
setAccList.add(acc);
}
}
insert setAccList;
}