You need to sign in to do that
Don't have an account?
imishra
Auto Increment a field
Hi,
I have an object, and there is a field called revision no. which i want to increment by itself everytime the particular record is edited.
Is it possible to do..???
Thanks in Advance.
Try this Trigger:
trigger RevisionNumber on Object__c (Before Insert,Before Update) {
for(Object__c ob:Trigger.New)
{
if(ob.Revision_No__c==NULL)
{
ob.Revision_No__c=1;
}
else
{
ob.Revision_No__c+=1;
}
}
}
Replace Object__c with your Standard or Custom object.
Madhan Raja M
All Answers
Hi Imishra,
Yes, we can do this by writing a trigger.
Madhan Raja M
Try this Trigger:
trigger RevisionNumber on Object__c (Before Insert,Before Update) {
for(Object__c ob:Trigger.New)
{
if(ob.Revision_No__c==NULL)
{
ob.Revision_No__c=1;
}
else
{
ob.Revision_No__c+=1;
}
}
}
Replace Object__c with your Standard or Custom object.
Madhan Raja M
Thanks Madhan for your quick reply.
The code works fine..