You need to sign in to do that
Don't have an account?
venkata someswara rao vejju
update contact using trigger on conntact object
Hi all,
I have contact trigger like
trigger contacttrigger on Contact (before insert){
for(Contact c:Trigger.new)
{
if(exist)
{
//update contact
}
else
{
//creating contact and account
}
}
}
i am using external form for inserting contact records when ever a record is inserted inside contact object it fires the trigger . if already contact is exist i am updating contact that's fine at the same time new contact is created.I want to prevent that new contct creation if contact is already exist i am taking as email is unique.
Please suggest me.
Thank you
I have contact trigger like
trigger contacttrigger on Contact (before insert){
for(Contact c:Trigger.new)
{
if(exist)
{
//update contact
}
else
{
//creating contact and account
}
}
}
i am using external form for inserting contact records when ever a record is inserted inside contact object it fires the trigger . if already contact is exist i am updating contact that's fine at the same time new contact is created.I want to prevent that new contct creation if contact is already exist i am taking as email is unique.
Please suggest me.
Thank you
Please find the below link.Which is already solved in forum.
Best Regards,
Manasa.
https://developer.salesforce.com/forums/?id=906F0000000AzlvIAC
Thank You for your suggestion.But my question is once email is exist next time onwards it needs to update,above link shows like verifying email is exist or not.
here my sample code
trigger contacttrigger on Contact (before insert){
for(Contact c:Trigger.new)
{
if(email is exist)
{
//I want to update that contact here
Contact con=[select Id,firstname,lastnam from contact WHERE Email=:email];
con.firstname='salesforce';
update con;
}
}
}
upto here is fine but again it creates a new contact after completion of trigger becuse every insertion i am firing trigger so that is my issue can you please suggest .
Thank You