I am very much a Salesforce newbie (I'll apologise in advance :) ), and need some help with some Javascript in our Professional Edition.

I have created a custom auto number field in our Opportunites. What I'd like to do is have the field remain empty until a button is clicked thus activating the auto number.

It's preferable if the numbers could remain sequential, but not essential. They do however need to retain a prefix (Pf).

Any help on this would be very greatly appreciated.

Cheers, Kay

  • 1
    as the field type indicates, its an auto generated number. you cannot populate it. you can define the format in the field definition so that it carries a prefix and the number gets incremented. refer the auto number salesforce help for details. Aug 6, 2015 at 23:43

2 Answers 2


Unless you've upgraded to take advantage of the API or gain access to Apex Code, your idea is pretty much not possible. Auto-number fields count by one, automatically, upon creation of a record. There is some assurance that such numbers will be globally unique (unless you reset the counter), but skips may occur without table locks (an optional feature that slows down writes). You need either Apex Code or API access to do conditional auto-number fields.


Yeah. Not possible. However, You can write run JavaScript on button click or calling the apex method from the button to update the Text field on Opportunity. To make it easy , make a auto Number field on Opp and copy it's value to new text field whenever button is clicked.In both the cases, it's a API call to Apex. Thanks .

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .