Mobile Number Series Management
The Anveo Mobile App allows you to create new records, without using a direct communication to Microsoft Dynamics NAV 2015. Due to this fact it is important to avoid conflicts with the assignment of numbers for orders, quotes, customers, etc., that have been created on the device and sent to Microsoft Dynamics NAV 2015 by the synchronization. This allows the mobile devices have their own number series that are separated by the number series of Microsoft Dynamics NAV 2015. You can set up mobile number series using the page Mobile App No. Series Setup in the main menu of the Anveo Client Suite:
The Code specifies the unique identifier of the mobile number series. Using this code, a mobile number series can be referenced via Anveo Script.
In the field Prefix you can specify which prefix obtain the numbers of the mobile number series. The prefix are characters in front of the digits of a number.
In the field Suffix you can specify which suffix obtain the numbers of the mobile number series. The suffix are characters behind the digits of a number.
In the field Length you indicate how many digits should contain the number of the mobile number series.
In the field Incrementation you indicate how many steps a number of the mobile number series to be incremented.
If you want to use mobile number series in Anveo Script, please use the predefined function Get-NextNo(NoSeriesCode) of the library LIB_NOSERIES.
Option 1: Separate Number Series per User
You can handle number series management in different ways: First option is to assign every user a separate, unique number series. Set-up a Mobile No. Series in Anveo for every user. Best way is to give your code of the number series a prefix or suffix by Anveo User Code. If you do so, add this prefix or suffix to your GetNextNo call in Anveo Script where you add new records. It is recommended to update your synchronization packages to send out only number series that belong to the corresponding users. Also take care your number series are unique, even with number series from Microsoft Dynamics NAV 2015.
Option 2: Temporary Number Series
Alternatively, Anveo Mobile App allows you to use temporary number series just for mobile devices. On synchronization, the mobile number series code will be deleted in codeunit ACF App Events, and the number series from Microsoft Dynamics NAV 2015 will be used. In this case, you can use one mobile number series for all Anveo Mobile App users because the record using the mobile number series will be deleted and resent to the mobile device using the final number series code from Microsoft Dynamics NAV 2015.
To activate this option, insert the following code in to the codeunit ACF App Events. Put the code into the OnInsertRec trigger before you run INSERT. In our template, this can be easily done using the funtion OnBeforeInsert.
CASE RecRef.NUMBER OF
DATABASE::"Sales Header": BEGIN
SalesHeader."No." := '';
SalesHeader."Document Date" := TODAY;
Probably, the user has added some sales lines to the new sales header. These lines will still have the mobile number series code of the sales header. This means, a translation of the sales header number series code of all incoming sales lines must be done in codeunit ACF App Events as well. Use translation function GetMatchedRecRef in codeunit
ACF App Events for a translation of a mobile sales header code to the final number series code.
CASE RecRef.NUMBER OF
DATABASE::"Sales Line": BEGIN
SalesHeader."Document Type" := SalesLine."Document Type";
SalesHeader."No." := SalesLine."Document No.";
// Lookup a translation between mobile no. and final no.
IF GetMatchedRecRef(LocalRecRef) THEN BEGIN
// A translation exists for this Anveo User and Device
// Assign correct, final Sales Header No.
SalesLine."Document No." := SalesHeader."No.";
Anveo Client Suite automatically detects primary key changes in codeunit ACF App Events and saves translation entries in table ACF Mobile No. Matching for each user and device. This table is used for automatic translation of all incoming data. The mapping is stored individually for each user and device, so the same mobile numbers will be used for all Anveo Users. This is alright because they are temporary. This way, you cannot give these numbers to external users as a reference. If this is required, choose a combination of option 1 and 2.
If a mobile user is able to add other sales header-related data like sales header comments or sales line comments, you have to add a translation code for these tables as well. Please use the sales line code above as a template.
Due to a change of primary key during synchronization, the Anveo Mobile App cannot stay on an Anveo Page using the old number series code. In our example: If the user presses synchronize on the sales header or sales line and the number series is still a mobile, temporary one, the Anveo Page will be closed automatically after synchronization. Of course, the final sales header is available on the mobile device after synchronization, if it fits the users filter criteria in synchronization packages.