Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

automatically generated customer ID upon registration


Go to End


2 Posts   1404 Views

Avatar
janulka

Community Member, 80 Posts

21 January 2011 at 8:06am

Hello,

I have custom member class with extra fields and nice working registration forms - one for users and another for customers (adding users to group "Customers")

I would like to add automatically generated customer ID to each customer (auto increment, working like an ID, but since there are other users which are NOT customers, these should not get this unique customer ID)

Is this possible to do?

Thanks in advance

Avatar
Nivanka

Community Member, 400 Posts

1 February 2011 at 2:43pm

whats your database? in MYSQL obviously you cant have two auto increment fields for the same table.

but you will be able to run some formula to get this done using the onBeforeWrite or onAfterWrite functions of dataobjects, and with the help of DataObjectDecorator