How to get Serial Number in Grid of Form Design

Hi,

I have requirement in the form …

when we click “Ctrl+N” for new record in the form i want to display automatically get Serial Number in the Grid…

(Ex:first record -1,secondrecord-2…etc)

in Form Design

please Help Me…

Hi,

you need to set number sequence for that field.

Refer http://dynamicsuser.net/forums/p/32430/170165.aspx.

Jatin Dave

Hi,

Try the following procedure

  1. For example if the NoobsForm is located in Inventory managment Module you should find the class named NumberSeqReference_Inventory, then go to LoadModule method in that class and write the following at last:

numRef.dataTypeId = typeId2ExtendedTypeId(typeid(NoobEDT)); //Extended datatype related to NoobId.
numRef.referenceHelp = literalStr(“HelpText”); // Your help text to be viewed in Parameters later.
numRef.wizardContinuous = true;
numRef.wizardManual = NoYes::No;
numRef.wizardAllowChangeDown = NoYes::No;
numRef.wizardAllowChangeUp = NoYes::No;
numRef.wizardHighest = 99999999;
numRef.sortField = 1;

this.create(numRef);

2)Then go to Table node and find InventParameters, go to methods node then add a new method and write the following:

server static NumberSequenceReference numRefNoobId()
{
return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(NoobEDT))); //Extended datatype
}

3)Then go to Inventroy managment content pane → Setup → Parameters → Number Sequences Tab
now here you will see the Extended Data type NoobEDT and an empty Sequence number code, right click the empty lookup and click Go to the main table Form.
Add a new number sequence code in the opened form and save it [for example]:
Number sequence code: NoobNumberSeq
Name: NoobNumberSeq
Smallest: 1
Largest: 99999999
Next: 1
Format: Noob_########
InUse: Checked

Return to previous Form “Parameters” and choose NoobNumberSeq that we have just created it from Number sequence code lookup to NoobEDT Reference

3)Last thing to do is Go to NoobsForm → Datasources node → NoobsTable → Methods, and override method (create) and write the following:

public void create(boolean _append = false)
{
;
super(_append);

NoobsTable.NoobId = NumberSeq::newGetNum(InventParameters::numRefNoobId(),true).num(); //numRefNoobId() is a method created in step 2)
}

//End

Finally go to the form and create a new record and you will see your number is generated automatically and sequentially.