function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SfDc@123.ax1389SfDc@123.ax1389 

Formula field for auto labeliing

Hi Force.com board,

 

                                       My requirement is creation of a formula field for the existing  auto number field. In detail If the auto number is 1 Formula field should retain the value 'A'.If it is 2 formula field should give 'B' and similarly upto 26 'Z'.And after that It should be given as 'AA' and should continue.I cant find a solution for this, So help in any form would be really appreciated.

 

Thanks in Advance,

Developer

salesforce86salesforce86

   Dear new Bie,

 

   Here I need to clarify you between Autonumber and the Formula Field.

 

   Auto number and Formula fields are only generated upon saving the record.

   It's not possible to formulize your solution.

 

 

 

   Thanks

Navatar_DbSupNavatar_DbSup

Hi,

 

I don’t think you can do this through formula field because inside the formula fields you have to individual define all the value and after some time you will hit the max character limit used inside the formula field. So, I would suggest writing a trigger to achieve this.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

SfDc@123.ax1389SfDc@123.ax1389

Hi

 

here auto number is only for reference for the formula field. For example, the auto number on saving the record will give as 1 and formula field will show as A .I had taken CASE functionality inorder to check itand it worked fine upto 'Z'.But after that the sequence has to move on like 'AA'.So please help me on this.

 

 

Thanks in advance

Newbie.

SfDc@123.ax1389SfDc@123.ax1389

HI ankit,

 

                 As you said I had created a trigger for the requirement but we cant increase the Alphabets in the order.If its number we can give   for(i=0;i<maxvalue;i++)  . BUt my requirement is to increase the alphabets in an order.Can you please explain this in an elaborated way

 

 

Thanks in Advance,

Newbie.

Pravesh RanaPravesh Rana

Hi,

 

I think using Trigger in this condition is more appropraiate here.

 

Why...

 

Because for  calculating respective code for a digit say 90, you have to execute some loops, the number will keep on increasing and there will come a time when executed code will get higher than the code limit of a Formula field.

 

So what you should do is right a Trigger which execute on after INSERT of the record.

 

For Logic....

 

You can use something like dividing the auto number value by 26 and finding out how many thimes it get divided by it and the reminder..

 

Hope this helps