You need to sign in to do that
Don't have an account?
imAkashGarg
update trigger only for the first time
i want to write a update trigger. what is the best practise approch to fire this update trigger only for the first time?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
i want to write a update trigger. what is the best practise approch to fire this update trigger only for the first time?
Hello,
You may use this also:
triegger xyz on myobject(before update)
{
if(triggenr.new[0].createddate == trigger.new[0].LastModifiedDate )
{
put your entire code here.
}
}
Think this will help you.
All Answers
Hello,
Well you can achieve through by creating a new customfield inside your object and assign a value to that field whenever a record is created or updated. You may write a workflow to update that field. For example supoose you have assign that field value i.e. 1 at the time of creation.Now write a workflow for upation of that object and update that field value with one. So now inside your trigger mention that condiotion like this:
triegger xyz on myobject(after update)
{
if(triggenr.new[0].yourcustomfield == 1)
{
put your entire code here.
}
}
Think this will help you.
Hello,
You may use this also:
triegger xyz on myobject(before update)
{
if(triggenr.new[0].createddate == trigger.new[0].LastModifiedDate )
{
put your entire code here.
}
}
Think this will help you.
Thanks Ashish,
i was trying with the first approch you told. But i think, the second one you told should be the best practice approach.
Hello,
Yeah r8.In second case you dont have to create any custom field and make sure that you are using before update not after update,for after update you have to use the first one.Any way happy to know that it resolve your issue.Cheers