Editing codeunit 414 — Dynamics NAV 2009 R2

You must add the appropriate Insight code changes to the codeunit design. Carefully editing codeunit 414 can preserve any changes that may have already been made to it.

The file COD414.txt resides in the NAS working directory subfolder that holds the Dynamics NAV localization, database version, and build (for example: ..\Microsoft Dynamics NAV\60\Application Server\ScribeModifications\W1.6.02.32012).

To edit the codeunit, use the .txt file that matches your version of Microsoft Dynamics NAV. TIBCO suggests that you review COD414.txt before editing codeunit 414.

To edit codeunit 414

  1. In Microsoft Dynamics NAV, click Tools > Object Designer. The Object Designer appears.
  2. Click Codeunit (Codeunit Icon).
  3. From the list of codeunits, select the codeunit with the ID number 414, Release Sales Document.
  4. Click Design. The C/AL Editor appears.
  5. Click anywhere in the OnRun section of the open codeunit.
  6. In Microsoft Dynamics NAV, click View > C/AL Locals.
  7. Click the Variables tab, then add the following local variables:
    NameDataTypeSubtypeLength
    ScribePublisher Codeunit Scribe Publisher 
    RecRefRecordRef  
    xRecRefRecordRef  
  8. Close the C/AL Locals window. You return to the C/AL Editor.
  9. In the OnRun section, after the statement IF Status = Status::Released THEN EXIT; add the following:

    // Get RecordRef of original record
    xRecRef.GETTABLE(Rec);

  10. At the end of the OnRun section, add the following:

    // Trigger ScribePublisher
    RecRef.GETTABLE(Rec);
    ScribePublisher.PublishModification(RecRef,xRecRef);

  11. In the C/AL Editor, click the Reopen section of the codeunit, then open the C/AL Locals window. Click the Variables tab, then add the following variables:
    NameDataTypeSubtypeLength
    ScribePublisher Codeunit Scribe Publisher 
    RecRefRecordRef  
    xRecRefRecordRef  
    LineRecRef RecordRef  
    xLineRecRef RecordRef  
  12. In the Reopen section:

    After:

    IF Status = Status::Open THEN EXIT

    Add:

    //Get RecordRef of original record
    xRecRef.GETTABLE(SalesHeader);

    In the WITH SalesHeader statement, before:

    END;

    Add:

    //Trigger ScribePublisher
    RecRef.GETTABLE(SalesHeader);
    ScribePublisher.PublishModification(RecRef,xRecRef);

    After:

    IF SalesLine.FINDSET THEN REPEAT

    Add :

    //Get RecordRef of original record
    xLineRecRef.GETTABLE(SalesLine);

    Before the corresponding:

    UNTIL SalesLine.NEXT = 0

    Add:

    //Trigger ScribePublisher
    LineRecRef.GETTABLE(SalesLine);
    ScribePublisher.PublishModification(LineRecRef,xLineRecRef);

  13. When you are done, save the codeunit and make sure that it compiles without errors.

    Make a note of the codeunit's new revision level.

  14. In the Object Designer, in the Version List column, edit the Release Sales Document codeunit's version to reflect the new revision level.

Next step

See also

Editing the codeunits — Dynamics NAV 2009 R2