You need to sign in to do that
Don't have an account?
![Devendra@SFDC Devendra@SFDC](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Requirement to Achieve AutoNumber functionality
Hello,
Managed Package Functionality:
I am developing on managed package app which will be used by different customer.In this app, I am using one object called Job. I need to use one field as Job Number. This Job Number field is populated based on Customer's demand.
For example,
Customer 1 has requirement to populate it as YYYY_MM_AutonumberValue.
Customer 2 has requirement to populate it as MM_YYYY_AutonumberValue.
Customer 3 has requirement to populate it as only AutonumberValue.
Customer needs to have ability to to provide different criteria to set this value.
I also want to use this field on visualforce pages, apex code.
What would be suggestion to handle such scenarios?
Thanks,
Devendra
There are several options to store these criteras,
You can store those in some custom object, best ways to store those value in Custom setting or Custom Label.
If you store them in Custom setting [These acts similar to custom object ]
you can fetch them in trigger code and update object Name value as per your requirement.
You need to do
Keep Name as text
Add one more autonumber field on object
By some trigger, Name = Autonumber + your custom logic
Thanks,
bForce
All Answers
Don't make the Name field an auto-number, keep it as text.
Write a trigger that picks up on this criteria and names the record appropriately.
Wizrad, Thanks for the reply!
These criterias can be different for different customer. The criteria is not fixed.
How to handle those criterias as well?
Does Custom settings helps to do this?
Thanks,
Devendra
There are several options to store these criteras,
You can store those in some custom object, best ways to store those value in Custom setting or Custom Label.
If you store them in Custom setting [These acts similar to custom object ]
you can fetch them in trigger code and update object Name value as per your requirement.
You need to do
Keep Name as text
Add one more autonumber field on object
By some trigger, Name = Autonumber + your custom logic
Thanks,
bForce
Thanks b-Force,
--------------------------------------------------------------------------------------------------------------------------------
Keep Name as text
Add one more autonumber field on object
By some trigger, Name = Autonumber + your custom logic
--------------------------------------------------------------------------------------------------------------------------------
I did the same what you mentioned.
Instead of using extra AutoNumber field on object, Can we fetch number from last record, increment that number and use it for next record?
Will this work?
Thanks,
Devendra
Yes you can do this.
Thanks,
bForce
Hi b-Force,
I did the same, Thanks a lot..!!
Cheers,
Devendra