Unique Number generation

I think you must have encountered this requirement very often… But the Solution always seems to be tricky… We recently had a requirement to have a unique Id for a contact.

Option 1:

“Yeah”, the best solution would be to use the Row Id. But the challenge with us was Business required it to be a number.

Option 2:

Siebel “Sequence” BC and User Properties.

1)Name=Sequence Field,Value=Fieldname(ex=line item).
2)Name=Sequence Use Max,Value=Y.
Note=On applet propeties Set Insert Position=LAST.

This was not working for us because of a inherent Siebel Product Bug. (The Auto increment was not happening in server Bug # 10505489)

Option 3:

Using Scripting.Logic is to store the latest value in a LOV and keep updating that LOV value using Scripting. The challenge with this was if 2 people creating at a same time, have a remote chances that the same number is assigned.

Option 4:

Converting Row_Id from Alphanumeric to number.( Base 30 to Base 10)

BC : Contact, new Calculated Field :Name = ConRowNumCalc, Value = RowIdToRowIdNum ([Id]), this will convert the Row_Id to a number. We need to remove the “-” which will be present in the RowID and we had additional requirement to append some characters (Eg : ABC), that was accomplised by a code in WriteRecord() event.

var sCnum = this.GetFieldValue(“ConRowNumCalc”);

if(Clib.strchr(sCnum,’-‘))
{
sCnum = sCnum.replace(“-“,””);
sCnum = “ABC-” + sCnum;
this.SetFieldValue(“ConRowNum”,sCnum);
}

This worked perfectly without any duplications or performance issues. only the only challenge with this is the numbers will not be in a order. But that was fine for us, as long as it was unique.. 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: