- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Discussions
- Announcements
- General Development
- Schema Development
- New to Cloud Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules Discussion
- Security
- Mobile
- Force.com Sites
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby Development
- Adobe Flash Builder for Force.com
- Desktop Integration
- REST API Integration
- Streaming API
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- Excel Connector
- AJAX Toolkit & S-controls
- Force.com Builder & Native Apps
- AppExchange Directory & Packaging
- Force.com Labs Projects
- Open Source
- Site.com
- Jobs Board - Administrators
- Jobs Board - Developers
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- General Development
- :
- Re: Autonumber+WO generated
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Autonumber +WO generated
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-01-2011 11:05 PM
Hi,
I am facing problem in the below functionality can you suggest me a solution:
My customer is generating Work order from the quotes page when the opportunity is closed.He wants the workorder number to be sequential.
I have created an auto-number field on the opportunity page and this autonumber field i have referenced to a formula field where i have written condition that (If(ispickval(Stage,"opportunity won",Autonumber__c,"NA"), will this generate the numbers in a sequential order? If not can you suggest a workaround.
Solved! Go to Solution.
Re: Autonumber +WO generated
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-01-2011 11:25 PM
This does not seem to work as the autonumber will keep on ticking and when the stage is set to opportunity won then the formula will just show th present number for the record..,.. any ideas or solution please help me.
Re: Autonumber +WO generated
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-02-2011 04:28 PM
Santro652,
An Autonumber is a bit different than other fields. When you create a record, then autonumber is generated for that record instantly, and stored on the record. So what you describe doing will only hide or display an already assigned autonumber.
Another thing to recognize about autonumbers, is that while they most likely will be sequential, they are not guaranteed to be so. If a save action gets far enough for the autonumber to be created, but then the save is cancelled (though an error, or through some other function) we do not reclaim the used autonumber. So it is possible to have gaps in the numbers (especially if you use Apex Triggers and other post save logic).
Finally, autonumbers are defined such that the system admin can go in and reset or change the autonumber whenever they desire. The result can be duplicate numbers or gaps in the numbers.
What you are describing is a bit different. In order to guarantee sequential numbers, there are a few ways you can do it (all requiring a varying level of coding):
1. You can have an Apex Trigger which determines the last number used and assigns the next number. The idea would be that you would have the Work Order Number field (either on a Work Order object or as a field on the Opportunity). You then create a trigger that will query the work order numbers and only bring back the last record (something like select work_order_number__c from Opportunity ORDER BY work_order_number__c DESC LIMIT 1). You will then have the last number used and you can increment it as desired.
2. You can create a new object to hold the Work Order Numbers. You can use this object to simply store the last number used. The object will have a single record and a single field. When you need a new work order number, you query the number field from tyhat record, increment it as desired, save the incremented record to the custom object (so that it will be incremented the next time the query runs), and use the number in the Opportunity or Work Order as needed.
3. You can store the number in some other system and then query for it as needed and increment.
Depending on your usage, #1 is probably the most straightforward, though you may want to go with #2 for more control over what is stored along wit hthe number (history tracking, etc...). #3 is probably not feasible, but I wanted to add it here for completeness.
Hope this helps.
Jay
Re: Autonumber +WO generated
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-02-2011 10:55 PM
Thanks for the suggestion Jay, but the problem is i am using Professional Edition any suggestion for this edition.
Re: Autonumber +WO generated
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-03-2011 11:16 AM
With Profession Edition, it will be very difficuly, and I do not think that you will be able to 100% guarantee sequential. You would have to do a similar thing, where you would create a new object type "Work Order" That would be the detail side of a Mater Detail with Opportunity. Work Order would have a Name field of Type AutoNumber. When the customer creates a new Work order, the AutoNumber should be sequential (if there is no commit logic like Apex).
The user would then only create the work order when the Opportunity is of the certain stage.

