Monday, December 20, 2010

GP Note Index

I have collected this for my reference from following two references and I thank you both for putting this out.
Ref:
from msdn blog
From mbsguru, blogspot


The Note Index (NOTEINDX) field in each record of SY_Company_MSTR (SY1500) table store the next Note Index to be used for that company. Every Master and Transaction record is assigned a Note Index when created. This Note Index is used as a foreign key when looking note against SY_Record_Notes_MSTR (SY03900).

To get Note Index use the following:
For Dexterity: call Get_Next_Note_Index, 'Note Index';
For SQL Scripting, call procedure: smGetNextNoteIndex

Yous SQL script as following:
declare @companyId smallint,
@noteIndex numeric (19, 5)
@errorState int;

-- get company id
select @companyId = CMPANYID
from DYNAMICS..SY01500
where INTERID = DB_Name()

--get and increment the next note index
exec DYNAMICS..smGetNextNoteIndex @companyId, 1, @noteIndex output, @errorState output


print @noteIndex
print @errorState