Insight codeunit modifications cause the Insight Adapter Hooks codeunit to run when NASHandler is called with parameter of 'SCRIBE'. This allows communication with Insight through the NAS. The trigger functions are also modified to publish inserts, modifies, and deletes to Insight.
Add the appropriate Insight code changes to the codeunit design. Carefully editing codeunit 1 can preserve any changes that have already been made to it.
The file COD1.txt resides in the NAS working directory subfolder that holds the Dynamics NAV localization, database version, and build, for example: ..\Microsoft Dynamics NAV\110\Service\Add-Ins\Scribe\W1.11.0.19394.
To edit the codeunit, use the .txt file that matches your version of Dynamics NAV. TIBCO suggests that you review COD1.txt before editing codeunit 1.
To edit codeunit 1
Global trigger functions must have these local variables.
Name | DataType | Subtype | Length |
---|---|---|---|
ScribePublisher | Codeunit | Scribe Publisher |
|
Name | DataType | Subtype | Length |
---|---|---|---|
NASID | Text | 260 |
Name | DataType | Subtype | Length |
---|---|---|---|
Parameter | Text | 260 | |
ParamStr | Text | 260 | |
SepPosition | Integer |
In the NASHandler function, add the following lines:
NASHandler(NASID : Text[260])
ParamStr := UPPERCASE(NASID);
REPEAT
SepPosition := STRPOS(ParamStr,',');
IF SepPosition > 0 THEN
Parameter := COPYSTR(ParamStr,1,SepPosition - 1)
ELSE
Parameter := ParamStr;
CASE Parameter OF
'JOBQUEUE':
CODEUNIT.RUN(CODEUNIT::"Job Queue Start Codeunit");
//*****SCRIBE BEGINS*****
'SCRIBE':
CODEUNIT.RUN(CODEUNIT::"Scribe Adapter Hooks");
//*****SCRIBE ENDS*****
END;
ParamStr := COPYSTR(ParamStr,SepPosition + 1);
UNTIL SepPosition = 0;
GetDatabaseTableTriggerSetup(TableID: Integer; VAR OnDatabaseInsert: Boolean; VAR OnDatabaseModify: Boolean; VAR OnDatabaseDelete: Boolean; VAR OnDatabaseRename:Boolean)
After:
ChangeLogMgt.GetDatabaseTableTriggerSetup(TableId,OnDatabaseInsert,OnDatabaseModify, OnDatabaseDelete,OnDatabaseRename);
IntegrationManagement.GetDatabaseTableTriggerSetup(TableId,OnDatabaseInsert,OnDatabaseModify, OnDatabaseDelete,OnDatabaseRename);
Add:
//****Scribe Begins *****
ScribePublisher.GetTableTriggerSetup(TableId,OnDatabaseInsert,
OnDatabaseModify,OnDatabaseDelete,OnDatabaseRename);
//****Scribe Ends *****
OnDatabaseInsert (RecRef : RecordRef)
After:
ChangeLogMgt.LogInsertion(RecRef);
IntegrationManagement.OnDatabaseInsert(RecRef);
Add:
//****Scribe Begins *****
IF RecRef.GET(RecRef.RECORDID) THEN
ScribePublisher.PublishInsertion(RecRef);
//****Scribe Ends *****
Note: | This added statement prevents Inserts from being published, reducing the clutter that may occur when creating records. For example, Dynamics NAV counts an Insert as both an Insert and a Modify for most entities and generates two messages. However, this line also prevents some other entities, such as Sales Line, from publishing Inserts. If you require Inserts to be published, comment out the following line from the added code: IF RecRef.GET(RecRef.RECORDID) THEN |
OnDatabaseModify (RecRef : RecordRef)
In the View menu, click C\AL locals.> Variables tab and enter:
Name | DataType | Subtype | Length |
---|---|---|---|
publishUpdate | Boolean |
|
Before:
ChangeLogMgt
Add:
// *****Scribe Begins*****
IF xRecRef.GET(RecRef.RECORDID) THEN
BEGIN
publishUpdate:=True
END;
//*****Scribe Ends*****
In the View menu, click C\AL locals.> Variables tab and enter:
Name | DataType | Subtype | Length |
---|---|---|---|
xRecRef | RecordRef |
|
After:
ChangeLogMgt.LogModification(RecRef);
IntegrationManagement.OnDatabaseModify(RecRef);
Add:
//****Scribe Begins *****
if publishUpdate THEN
ScribePublisher.PublishModification(RecRef,xRecRef);
//****Scribe Ends *****
OnDatabaseDelete
After:
ChangeLogMgt.LogDeletion(RecRef);
IntegrationManagement.OnDatabaseDelete(RecRef);
Add:
//****Scribe Begins *****
IF RecRef.GET(RecRef.RECORDID) THEN
ScribePublisher.PublishDeletion(RecRef);
//****Scribe Ends *****
OnDatabaseRename (RecRef : RecordRef;xRecRef :
After:
ChangeLogMgt.LogRename(RecRef,xRecRef);
IntegrationManagement.OnDatabaseRename(RecRef,xRecRef);
Add:
//****Scribe Begins *****
IF RecRef.GET(RecRef.RECORDID) THEN
ScribePublisher.PublishRename(RecRef,xRecRef);
//****Scribe Ends *****
Make a note of the codeunit's new revision level.
Note: In the Object Designer, in the Version List column, edit the ApplicationManagement codeunit's version to reflect the new revision level.
See also
Editing the codeunits — Dynamics NAV 2018