How to enable purchase of Resources (updated for NAV 2017)

It is a common request for users to be able to purchase Resources. This document details the steps in the modification. With this modification, entries with type Resource will post to the G/L Entry table, the Resource Ledger Entry table, and, if applicable, the Job Ledger Entry table.

Change Type, No. fields.

Add resource as an option for the Type field, entering it after Item (there is a blank placeholder for it). Add it to all Multilanguage captions.

Change No. field properties to set the table relation to resource if the type is resource. Do this for tables below:

Table 39 Purchase Line

Table 121 Purch. Rcpt. Line

Table 123 Purch. Inv. Line

Table 125 Purch. Cr. Memo Line

Table 246 Requisition Line

Table 5110 Purchase Line Archive

Table 6651 Return Shipment Line


Modify the Table 39, No., OnValidate trigger.

Add RES as a local variable, type Record, Resource, then modify/insert the below code.

//  ERROR(Text003);




  RES.TESTFIELD(“Gen. Prod. Posting Group”);

  Description := RES.Name;

  VALIDATE(“Unit Cost”,RES.”Unit Cost”);

  VALIDATE(“Direct Unit Cost”,RES.”Direct Unit Cost”);

  “Gen. Prod. Posting Group” := RES.”Gen. Prod. Posting Group”;

  “VAT Prod. Posting Group” := RES.”VAT Prod. Posting Group”;

  “Tax Group Code” := RES.”Tax Group Code”;

   “Allow Item Charge Assignment” := FALSE;

  “Unit Price (LCY)” := RES.”Unit Price”;

  “Unit of Measure Code” := RES.”Base Unit of Measure”;



If using Jobs, make the below modifications to Table 39.

Modify Job No., OnValidate trigger per below:

//IF NOT (Type IN [Type::Item,Type::”G/L Account”]) THEN

IF NOT (Type IN [Type::Item,Type::”G/L Account”,Type::Resource]) THEN


Modify Function CreateTempJobJnlLine

//IF Type = Type::”G/L Account” THEN

//  TempJobJnlLine.VALIDATE(Type,TempJobJnlLine.Type::”G/L //Account”)


//  TempJobJnlLine.VALIDATE(Type,TempJobJnlLine.Type::Item);


Type::”G/L Account”:   TempJobJnlLine.VALIDATE(Type,  TempJobJnlLine.Type::”G/L Account”);

Type::Item: TempJobJnlLine.VALIDATE(Type,TempJobJnlLine.Type::Item);

Type::Resource:  TempJobJnlLine.VALIDATE(Type,  TempJobJnlLine.Type::Resource);



Tables 203 and 207

Add Vendor as an option after Customer for the field Source Type.

Add Purchase as an option after Sale for the field Entry Type.

Change Source No. field properties to set the table relation to Vendor, if Source Type is vendor.


Codeunit 90

Add ResJnlLine as a Local Variable, type Record, table Res. Journal Line. Add ResJnlPostLine  as a Local Variable, type Codeunit, Res. Jnl.-Post Line. Then modify/insert the code below.


//3: ERROR(Text015);



IF PurchLine.”Qty. to Invoice” <> 0 THEN BEGIN


ResJnlLine.”Posting Date” := “Posting Date”;

ResJnlLine.”Document Date” := “Document Date”;

ResJnlLine.”Reason Code” := “Reason Code”;

ResJnlLine.”RESource No.” := PurchLine.”No.”;

ResJnlLine.Description := PurchLine.Description;

ResJnlLine.”Source Type” := ResJnlLine.”Source Type”::Vendor;

ResJnlLine.”Source No.” := PurchLine.”Buy-from Vendor No.”;

ResJnlLine.”Job No.” := PurchLine.”Job No.”;

ResJnlLine.”Unit of Measure Code” := PurchLine.”Unit of Measure Code”;

ResJnlLine.”Shortcut Dimension 1 Code” := PurchLine.”Shortcut Dimension 1 Code”;

ResJnlLine.”Shortcut Dimension 2 Code” := PurchLine.”Shortcut Dimension 2 Code”;

ResJnlLine.”Gen. Bus. Posting Group” := PurchLine.”Gen. Bus. Posting Group”;

ResJnlLine.”Gen. Prod. Posting Group” := PurchLine.”Gen. Prod. Posting Group”;

ResJnlLine.”Entry Type” := ResJnlLine.”Entry Type”::Purchase;

ResJnlLine.”Document No.” := GenJnlLineDocNo;

ResJnlLine.”External Document No.” := GenJnlLineExtDocNo;

ResJnlLine.Quantity := PurchLine.”Qty. to Invoice”;

ResJnlLine.”Unit Cost” := PurchLine.”Unit Cost (LCY)”;

ResJnlLine.”Total Cost” := PurchLine.”Unit Cost (LCY)” * ResJnlLine.Quantity;

ResJnlLine.”Source Code” := SrcCode;

ResJnlLine.”Posting No. Series” := “Posting No. Series”;

ResJnlLine.”Qty. per Unit of Measure” := PurchLine.”Qty. per Unit of Measure”;

ResJnlLine.”Dimension Set ID” := PurchLine.”Dimension Set ID”;


IF (PurchLine.”Job No.” <> ”) THEN BEGIN;

CreateJobPurchLine(JobPurchLine,PurchLine,”Prices Including VAT”);

JobPostLine.InsertPurchLine(PurchHeader, PurchInvHeader, PurchCrMemoHeader,     JobPurchLine,SrcCode);




If using Job Cost, you need to also do below. Thanks to Tino Ruijs for pointing this out.


In codeunit 1001 Job Post-Line, function PostJobOnPurchaseLine:


//IF (PurchLine.Type <> PurchLine.Type::Item) AND (PurchLine.Type //<> PurchLine.Type::”G/L Account”) THEN

//  EXIT;

IF (PurchLine.Type <> PurchLine.Type::Item) AND

(PurchLine.Type <> PurchLine.Type::”G/L Account”) AND

(PurchLine.Type <> PurchLine.Type::Resource) THEN



In codeunit 1004 Job Transfer Line, function FromPurchaseLineToJnlLine:


//IF Type = Type::”G/L Account” THEN

//  JobJnlLine.VALIDATE(Type,JobJnlLine.Type::”G/L Account”)


//  JobJnlLine.VALIDATE(Type,JobJnlLine.Type::Item);


Type::”G/L Account”: JobJnlLine.VALIDATE(Type,JobJnlLine.Type::”G/L Account”);

Type::Item: JobJnlLine.VALIDATE(Type,JobJnlLine.Type::Item);

Type::Resource: JobJnlLine.VALIDATE(Type,JobJnlLine.Type::Resource);



That’s it.