AL, BC18, Business Central, Code, Codeunit, Combinations, Development Tips, Dimension, Dynamics 365, Environment, Events, Extension, Extension Package, How To, Online, Page, Sandbox, Subscription, Table, Tip & Tricks, VS Code

Walkthrough Extension Development in Online Sandbox – Business Central

I have my Sandbox environment as below:

Details of the Sandbox as below:

Connecting VS code to above environment.

When you try to Publish the extension, it will ask you to authenticate.

Copy the Link and open in the browser and paste the code in the box as shown below.

Next it will ask for your Online Instance User Id & Password provide it and on confirmation close the page. It will start deploying the extension.

In this walkthrough I am using below scenario:

Requirement is we need to be able to define some code for dimension combinations. Let me say it will be Sales Code, you can choose name of your choice, this is not Salesperson code.

I am assuming these dimensions will follow the sequence as defined on my General Ledger Setup as below:

On Sales Order & Invoice user should be able to select this Sales Code and dimensions should be populated on order accordingly.

For tracking purpose this Sales Code should flow to Posted Sales Invoice and Customer Ledger.

So, Let’s Start with the development process:

Step-1 We will Create the Table

Here is the code for LookupDimValue Function, it will set filter for Dimension Code on Dimension Value table, as per the Dimension No passed. (1 is for Shortcut Dimension defined on General Ledger Setup, similarly for other 8 dimensions)

Step-2 Next, we will create the Page for this Setup

Step-3 Next, we will add the Sales Code field to all required Tables & Pages

Here is the code for AddDim Function. It is assumed that only combination provided in Sales Code Setup will be used. If you have defined Default dimensions or Combinations, those need to be preserved else this code will overwrite them. You will have to find the Data Set Entry, store them in temporary table used in below code and then add all the dimensions from the setup.

When you Select Sales Code on the Order or Invoice it will populate all the dimensions defined in the Setup.

Code for other Tables & Pages

Step-4 Next, we need to take care to flow the Sales Code to the Ledger and Posted documents.

For posted documents we need not to worry it will flow automatically provided we have defined the fields on same Id.

However, for ledger we will require to use Events to pass the data to their destinations. In this case we are only passing to Customer Ledger Entry. For this we will create a Codeunit.

To Add Event Subscriptions, Use the new Shift+Alt+E shortcut in the AL code editor to invoke a list of all events.

Search for the even you are looking for.

When pressing Enter to select an event entry, an event subscriber for the event will be inserted at the cursor position in the active AL code editor window.

Here is the Codeunit Code:

This is not the final code; much more can be done or need to be done before it can be delivered to customer for their use. Purpose of this walkthrough was to demo the way we can customize the solution using extensions and publishing to Online tenant in Sandbox.

Hope you enjoyed the information. Will come with more similar information in my next posts. Till then keep exploring, learning and sharing your knowledge with others.

Remain safe, take care of your loved ones, put your mask, maintain safe distance and don’t forget to get vaccinated.

Add, Add by Dimension, Add by Filter, Add Related Entries, Analysis Views, BC18, Business Central, Change, Combinations, Completed, Correction, Correction Setup, Delete, Dimension, Dimension Corrections, Draft, Dynamics 365, Functional Tips, G/L Entries, G/L Register, General Ledger Entries, History, How To, Information, Modify, Posted General Journal, Reversing, Run, Schedule, Select Manually, Tip & Tricks, Trace, Undo, Updating, Validate, What's New

How can we Correct Dimension in Microsoft Dynamics 365 Business Central?

You can do correction by reversing the journal or creating a credit memo for the document, which will be time consuming and can attract to even more errors.

Now you can correct dimensions for general ledger (G/L) entries to ensure your financial reports is providing you with accurate insights. For G/L entries, you can now

  • change the dimension values
  • add new dimensions
  • remove wrong ones

You can also trace a history of the corrections that you have done and can undo corrections in case you had made a mistake in the corrections itself.

Before you continue let me remind you:

Although the Dimension Correction feature only updates general ledger entries, still it can be helpful in many cases with creating accurate financial reports.

You must decide when to use the corrections because when you perform correction, it will result in differences between the dimensions in finance and sub-ledgers. The earlier you decide on what corrections to use, the less manual corrections you’ll need to do in the future.

I am using BC18 Demo database.

 How to run the Dimension Correction

General Ledger Entries. You can change the dimensions for single or multiple entries just by selecting the entries.

G/L Register. You can change the dimension per batch posting. By using “From Entry No.”, “To Entry No.” as a filter for General Ledger Entries.

Posted General Journal. You can use “Document No.” and “Posting Date” as filters for General Ledger Entries.

Search for Dimension Corrections Page.

Draft Dimension Correction Screen:

Depending upon from where you Launched the Dimension Correction, it may come with pre-filled or as blank screen.

You have several options to work with dimensions:

  • You can Add New Dimensions
  • You can Remove existing Dimensions
  • You can Change the existing Dimensions

For Selecting Entries to which above changes applies you have different options to work with.

  • Add related entries. This requires at least 1 G/L Entry already to be selected, and then it adds all other G/L Entries with the same “Transaction No”.
  • Select Manually. You can manually select in the G/L Entries by just choosing them.
  • Add by Filter. Here you have all freedom of choice, how to filter your G/L Entries for the dimension corrections.
  • Add by Dimension. This can be useful if you want to change the dimension value Sales to Admin for all G/L entries. So, you find all G/L Entries with the Dimension Sales.

You can omit/remove selected entries, or change selection criteria for your entries to be applied with changes.

Updating Dimension Values

Above we create a Dimension Correction, the Status is initially DRAFT, it means the G/L Entries Dimension is NOT yet updated.

Once you are done in the Dimension change to move forward you have two option to go thru:

  • Click the Validate dimension change then click RUN.
  • Click RUN.

Validate change

This will check if it’s possible to make the dimension changes you specified.

  • Check Dimension Correction Setup.
  • Check Dimension Combinations.

Once the validation run successfully you can see it in the Validation status.

You can choose to run the job immediately or schedule in case you are operating on larger data set.

Next you can now use the Run action button. This will Apply changes to the General Ledger Entry Dimensions.

How to trace the correction

General Ledger Entries. You can see all the dimension corrections that you’ve done for the selected entries.

Search the Dimension Corrections. You can see all the Dimension corrections that you’ve done even the ongoing dimension corrections will be listed here.

Undo a Correction


In the dimension correction page just click the UNDO. This will be executed as a Job. The user will have to choose, how he wants to apply changes: running the job immediately or schedule it.

It is recommended to run the schedule if you are working with larger data set, to avoid the table locking during posting of other transactions.

Once the Job execution completes, you will see the status change to UNDO COMPLETED.

How to Update the Analysis Views

From the Dimension Correction page, you can also update you’re Analysis Views by clicking the Update Analysis Views button. This will be executed as a Job. You will have to choose, how you want to apply changes: running the job immediately or schedule it.

It is recommended to run the schedule if you are working with larger dataset, to avoid the table locking during posting of other transactions.

Hope you enjoyed the information. Will come with more similar information in my next posts. Till then keep exploring, learning and sharing your knowledge with others.

Remain safe, take care of your loved ones, put your mask, maintain safe distance and don’t forget to get vaccinated.

Assist Setup, Assisted Setup, BC18, Business Central, Change Log, Cues, Data, Data Classifications, Dynamics 365, Email, Field Monitoring, Fields, Functional Tips, High-Risk, How To, Information, Monitor Field Change Setup, Notification, Office 365, Office Integration, Outlook, Role Center, Settings, Smtp, Start, Stop, Tip & Tricks

Monitor Field Change in Business Central

Field Monitoring is one of great help for superusers in Business Central. You can now configure a list of fields that contain high-risk and business-critical data that you want to be notified about when they are changed.

Changes to high-risk settings in Business Central can be tracked using the Change Log functionality. But sometime only tracking changes is not sufficient and you expect more like you should be notified of changes in fields that contain high-risk and business-critical data, such as bank account numbers, company name, and addresses.

Now setting a list of fields that contain high-risk and business-critical data is possible and you can be notified about when they are changed.

To start with this feature, Look for Assist Setup, I am using BC18 demo database for below steps.

Although it is not necessary to follow Assist Setup, you can do setup from individual pages. But this will ensure you don’t miss any steps.

Click on Next to start with setup. And follow the steps in leading wizard pages.

If you wish to use Data Classification and already have performed data classification you can enable or continue with individual fields using Monitored Fields Worksheet, in upcoming Wizard pages.

It is necessary to have the Sending and user e-mail setup is completed. Here you can select the email ids as required.

You need to add Fields for monitoring enable and click finish, or you can open the Page later and configure. This will Start the Monitoring and Notification service.

In Next step or you can open this page Monitored Fields Worksheet from Tell Me.

Add your table & fields that you wish to Monitor.

If notify is enabled you will receive the mail, else you can view in Monitored Field Log page. You can use Field Monitoring Setup Page from Action bar, or you can separately open this page from Tell Me.

You need to Start the Field Monitoring Setup, if not already done. If you have used Assist setup it will be Started, in case you are doing Manually from each Page, you will need to visit this Page, Setup your Emails and Start the Service.

Before we Start with Testing, it is strongly recommended you Log Off and Login again to Business Central. As logging starts and ends on Login & Logout of user.

Open the Customer Page and make changes to Name, as above we have setup to log Name field of Customer.

If your all setup is OK you should Receive a mail as below.

Some Pages helpful for Field Monitored Service are:

You can Monitor the Mails Status from your Role Centre Cues:

What else you can do for monitoring your data and notifications:

  • If there is a problem sending the email, you can check the detailed information on Email Outbox page.
  • You can view the mail sending record on Sent Emails page.
  • You can view the log of Field Monitoring Setup and Monitoring Fields on Monitored Field Log Entries page.

Hope you enjoyed the information. Will come with more similar information in my next posts. Till then keep exploring, learning and sharing your knowledge with others.

Remain safe, take care of your loved ones, put your mask, maintain safe distance and don’t forget to get vaccinated.

BC18, Business Central, Customer, Document Layout, Dynamics 365, Email, Functional Tips, How To, Information, Office 365, Purchase Documents, Sales Documents, Smtp, Tip & Tricks, Vendor

Customer and Vendor Document Layout in Business Central

In this post we will discuss how to setup sending documents to different contacts, specific contacts to use with certain documents.

I am using BC18 Demo Database.

On Customer Card select Related-> Customer-> Document Layouts.

Here we are setting up different type of document should go to different contacts/e-mail ids.

In above example: Quote will go to my personal id, and Order Confirmation to my organization id.

It is important that email setup is done to use this feature, either is Office 365 or SMTP which ever you use.

Let’s quickly Check the output:

1. Sales Quote

On Quote select Print/Sent-> Send by Email.

2. Order Confirmation

On Sales Order select Print/Send-> Email Confirmation.

You can see different type of documents are picking different e-mail ids of contacts as per our setup done above.

Similarly, you can do for Vendors too:

Hope you enjoyed the information. Will come with more similar information in my next posts. Till then keep exploring, learning and sharing your knowledge with others.

Remain safe, take care of your loved ones, put your mask, maintain safe distance and don’t forget to get vaccinated.

Always Ask, Autoinsert, Automatic, BC18, Business Central, Customer, Dynamics 365, Functional Tips, Get Recurring Lines, How To, Information, Lines, Manual, Notification, Purchase Documents, Recurring, Sales Documents, Tip & Tricks, Vendor, What's New

Auto-insert Recurring Sales and Purchase Lines in Business Central

Today in this post we will see how you can automatically insert frequently used sales and purchases more quickly and conveniently in Dynamics365 Business Central.

I am using BC18 Demo Database.

If your company uses repeat orders for customer and vendors, this feature can be helpful to you.

Open your Vendor Card, Select Related-> Purchases-> Recurring Purchase Lines.

In Recurring Purchase Line Setup, Create Code and way you want them to be available on your Purchase Documents.

Next you need to setup the Card for lines that will be part of this code for Purchase Lines.

Navigate to the Recurring Code Setup Page.

Choose the Card.

Enter the lines associated with this Code, that should be entered on Purchase Lines.

Options on Recurring Code Setup.

** Manual, Will be normal Std. Behavior

** Automatic, Lines will be inserted automatically.

Key in the Vendor Code and press Enter.

This will be helpful if you have single Recurring code setup, as automatic, rest all as manual.

Else Notification will be raised and you have to choose from the list.

** Always Ask, will give you Notification to add.

Key in the Vendor Code and press Enter.

This is helpful when you have multiple setups, and want to choose from the list.

From Notification click on Get Recurring Lines, and select desired code.

Once Lines are inserted on Purchase Lines you can edit the lines as usual in any open orders. Add or Remove Lines, Change the other field values etc.

Similarly, you can setup for Sales Documents too.

Hope you enjoyed the information. Will come with more similar information in my next posts. Till then keep exploring, learning and sharing your knowledge with others.

Remain safe, take care of your loved ones, put your mask, maintain safe distance and don’t forget to get vaccinated.

BC18, Business Central, Dynamics 365, Functional Tips, How To, Information, Sales Documents, Track Package, Wave 2, What's New

Track Packages from Sales Documents in Business Central

Today in this post we will see how you to track items on shipping documents in Business Central.

I am using BC18 demo database.

Before we begin, we need to ensure our Shipping Agent is configured:

Open your Shipping agent and fill the Package Tracking URL you received from your agent.

It is obvious if agent do not provide this feature to track package from website, this will be of no use for that particular agent.

Save the changes and go to Sales Order.

Scroll to Shipping and Billing Fast Tab and fill agent details, as in above screenshot.

Next you post your shipment.

Navigate to your shipment and update tracking information you obtained from your agent.

On Posted Sales Shipment Select Process-> Update Document.

Update the Package Tracking No. you received after shipment from your agent, and save the information.

Now you can track the status of the shipment and keep informed to your customer regarding delivery status.

From Posted Shipment page select Process-> Track Package.

This will land you to the agent web page and update you about the current status of delivery.

Since we are using invalid Tracking Information, you will get your actual status if you provide valid Information.

This feature is available on other Sales Documents type too.

Hope you enjoyed the information. Will come with more similar information in my next posts. Till then keep exploring, learning and sharing your knowledge with others.

Remain safe, take care of your loved ones, put your mask, maintain safe distance and don’t forget to get vaccinated.

Background, BC18, Business Central, Check Financial Journals, Cues, Dynamics 365, Functional Tips, How To, Information, Tip & Tricks, Wave 2, What's New

Check Financial Journals in Background in Business Central

Today we learn how to check financial journals in the background in #Dynamics365 #BusinessCentral in this post.

First thing first, you need to ensure the check mark for the batch in question for Background Error Check should be checked.

If this is enabled, when you open the batch on right side above Journal Line Details you will see Journal Check Section, which will let you know if Journal have any errors.

Let’s enter few Lines and see how it looks like

To see all errors, you can click on Cue Issues Total to bring summary page of all Issues.

If you have several Lines and you want to focus on lines with issues, you can do it by:

This will filter the lines on journal with issues.

Hope you enjoyed learning this feature, will come up with new post on new topic. Till then keep exploring, learning and sharing with others.

BC18, Business Central, Copy Journal, Functional Tips, How To, Information, Posted General Journals, Tip & Tricks, Wave 2, What's New

Copy Journal function on Posted General Journals in Business Central

Working with large journals can be cumbersome to correct if you make mistakes.

Earlier we used to do customizations for our customers to get this done. But now this feature is available in the product.

Now with the Wave 2 release of Dynamics Business Central you can use the copy journal function on Posted General Journals.

User have ability to reverse the entries based on posted General Journals.

I am using Accountant Profile.

Search for General Journal Template, make sure you have check mark under Copy to Posted Jnl. Lines for template which you wish to use for this purpose.

Journals-> General Journal

Similarly, the Check mark on Batch which you will use for this purpose.

Search for Posted General Journal

You will find no entries as you can see in previous screenshot for Default Batch Copy to Posted General Journal check mark is clear and any entries posted using that batch is not available.

Now put the Check mark and post the entries.

Now re-open Posted General Journal after posting few entries.

Select the Lines you wish to reverse

Select Copy Selected Line to Journal

Fill the request page, Your Template & Batch to Use, if you wish to change the Posting Date & Document No. If you wish to change the Sign and then press OK.

Your Journal Lines will be created as per the information provided on request page:

Below is the Screenshot after posting the entries:

I have exported to Excel and hidden few columns to show the output.

Entries marked in red rectangle is the entries posted post above operation and options selected on request page.

So now you know how to use this feature, share with your customers and help to make their life easy. Hope you liked and enjoyed learning this feature.

See you in next post, till then keep exploring, learning and sharing with others.

Now we have YouTube channel too, you can find link on Menu, first ever Dynamics Navision & Business Central Channel in Hinglish. You will get videos of demonstration in Mixed Language English as well as in Hindi. This will help both those who are comfortable with English and also with Hindi. Don’t forget to Subscribe and post your suggestions to improve the channel.

Channel Link

https://www.youtube.com/channel/UCm1JWr26UO5GqXiOHWhVD4A

BC14, BC15, BC16, BC17, Business Central, Cumulative Updates, How To, Information, Instalation & Configuration, Install, NAV 2016, NAV 2017, NAV 2018, on-premises, Updates, Wave 1, Wave 2, What's New

Cumulative Updates for Microsoft Dynamics NAV 2016/2017/2018 And BC Released in Mar 2021

Update 17.5 for Microsoft Dynamics 365 Business Central 2020 Release Wave 2 (Application Build 17.5.22499.22546, Platform Build 17.0.22463.22540)

This update replaces previously released updates. You should always install the latest update.

It may be necessary to update your license after you install this hotfix to gain access to new objects that are included in this or a previous update. (This only applies to customer licenses.)

For a list of updates that were released for Microsoft Dynamics 365 Business Central 2020 Release Wave 2, see released updates for Microsoft Dynamics 365 Business Central 2020 Release Wave 2. Updates are intended for new and existing customers who are running Microsoft Dynamics Released Updates for Microsoft Dynamics 365 Business Central 2020 Release Wave 2.

How to obtain the Microsoft Dynamics 365 Business Central 2020 Release Wave 2 files

This update is available for manual download and installation from the Microsoft Download Center.

Update 17.5 for Microsoft Dynamics 365 Business Central  2020 Release Wave 2

How to install a Microsoft Dynamics 365 Business Central on-premises 2020 Release Wave 2 update

See How to install a Microsoft Dynamics 365 Business Central 2020 Release Wave 2 update.

Prerequisites

You must have Microsoft Dynamics 365 Business Central 2020 Release Wave 2 installed to apply this hotfix.

Update 16.11 for Microsoft Dynamics 365 Business Central 2020 Release Wave 1 (Application Build 16.11.22526, Platform Build 16.0.22511)

This update replaces previously released updates. You should always install the latest update.

It may be necessary to update your license after you install this hotfix to gain access to new objects that are included in this or a previous update. (This only applies to customer licenses.)

For a list of updates that were released for Microsoft Dynamics 365 Business Central 2020 Release Wave 1, see released updates for Microsoft Dynamics 365 Business Central 2020 Release Wave 1. Updates are intended for new and existing customers who are running Microsoft Dynamics Released Updates for Microsoft Dynamics 365 Business Central 2020 Release Wave 1.

How to obtain the Microsoft Dynamics 365 Business Central 2020 Release Wave 1 files

This update is available for manual download and installation from the Microsoft Download Center.

Update 16.11 for Microsoft Dynamics 365 Business Central  2020 Release Wave 1

How to install a Microsoft Dynamics 365 Business Central on-premises 2020 Release Wave 1 update

See How to install a Microsoft Dynamics 365 Business Central 2020 Release Wave 1 update.

Prerequisites

You must have Microsoft Dynamics 365 Business Central 2020 Release Wave 1 installed to apply this hotfix.

Update 15.16 for Microsoft Dynamics 365 Business Central 2019 Release Wave 2 (Application Build 15.16.46612, Platform Build 15.0.46600)

This update replaces previously released updates. You should always install the latest update.

It may be necessary to update your license after you install this hotfix to gain access to new objects that are included in this or a previous update. (This only applies to customer licenses.)

For a list of updates that were released for Microsoft Dynamics 365 Business Central 2019 Release Wave 2, see released updates for Microsoft Dynamics 365 Business Central 2019 Release Wave 2. Updates are intended for new and existing customers who are running Microsoft Dynamics Released Updates for Microsoft Dynamics 365 Business Central 2019 Release Wave 2.

How to obtain the Microsoft Dynamics 365 Business Central 2019 Release Wave 2 files

This update is available for manual download and installation from the Microsoft Download Center.

Update 15.16 for Microsoft Dynamics 365 Business Central 2019 Release Wave 2

How to install a Microsoft Dynamics 365 Business Central 2019 Release Wave 2 update

See How to install a Microsoft Dynamics 365 Business Central 2019 Release Wave 2 update.

Prerequisites

You must have Microsoft Dynamics 365 Business Central 2019 Release Wave 2 installed to apply this hotfix.

Cumulative Update 22 for Microsoft Dynamics 365 Business Central April’19 on-premises (Application Build 14.23.46611, Platform Build 14.0.46607)

This cumulative update replaces previously released cumulative updates. You should always install the latest cumulative update.

It may be necessary to update your license after you install this hotfix to gain access to new objects that are included in this or a previous cumulative update. (This applies only to customer licenses.)

For a list of cumulative updates that were released for Microsoft Dynamics 365 Business Central Spring 2019, see released cumulative updates for Microsoft Dynamics 365 Business Central Spring 2019. Cumulative updates are intended for new and existing customers who are running Microsoft Dynamics Released Cumulative Updates for Microsoft Dynamics 365 Business Central Spring 2019.

How to obtain the Microsoft Dynamics 365 Business Central Spring 2019 files

This update is available for manual download and installation from the Microsoft Download Center.

Cumulative update CU 22 for Microsoft Dynamics 365 Business Central Spring 2019 Update on-premises

How to install a Microsoft Dynamics 365 Business Central Spring 2019 cumulative update

See How to install a Microsoft Dynamics 365 Business Central Spring 2019 cumulative update.

Prerequisites

You must have Microsoft Dynamics 365 Business Central Spring 2019 installed to apply this hotfix.

Cumulative Update 39 for Microsoft Dynamics NAV 2018 (Build 46609)

This cumulative update includes all hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2018, including hotfixes and regulatory features that were released in previous cumulative updates.

This cumulative update replaces previously released cumulative updates. You should always install the latest cumulative update.

It may be necessary to update your license after you install this hotfix to gain access to new objects that are included in this or a previous cumulative update. (This applies only to customer licenses.)

For a list of cumulative updates that were released for Microsoft Dynamics NAV 2018, see released cumulative updates for Microsoft Dynamics NAV 2018. Cumulative updates are intended for new and existing customers who are running Microsoft Dynamics NAV 2018.

How to obtain the Microsoft Dynamics NAV update files

This update is available for manual download and installation from the Microsoft Download Center.

Cumulative update CU 39 for Microsoft Dynamics NAV 2018

How to install a Microsoft Dynamics NAV 2018 cumulative update

See How to install a Microsoft Dynamics NAV 2018 cumulative update.

Prerequisites

You must have Microsoft Dynamics NAV 2018 installed to apply this hotfix.

Cumulative Update 52 for Microsoft Dynamics NAV 2017 (Build 30477)

This cumulative update includes all hotfixes and regulatory features that have been released for Microsoft Dynamics NAV 2017, including hotfixes and regulatory features that were released in previous cumulative updates.

This cumulative update replaces previously released cumulative updates. You should always install the latest cumulative update.

It may be necessary to update your license after implementing this hotfix to gain access to new objects included in this or a previous cumulative update (this only applies to customer licenses).

For a list of cumulative updates released for Microsoft Dynamics NAV 2017, see released cumulative updates for Microsoft Dynamics NAV 2017. Cumulative updates are intended for new and existing customers who are running Microsoft Dynamics NAV 2017.

How to install a Microsoft Dynamics NAV 2017 cumulative update

See How to install a Microsoft Dynamics NAV 2017 cumulative update.

Prerequisites

You must have Microsoft Dynamics NAV 2017 installed to apply this hotfix.

Cumulative Update 65 for Microsoft Dynamics NAV 2016 (Build 52121)

This cumulative update replaces previously released cumulative updates. You should always install the latest cumulative update.

It may be necessary to update your license after you install this hotfix to gain access to new objects that are included in this or a previous cumulative update. (This applies only to customer licenses.)

For a list of cumulative updates that were released for Microsoft Dynamics NAV 2016, see released cumulative updates for Microsoft Dynamics NAV 2016. Cumulative updates are intended for new and existing customers who are running Microsoft Dynamics NAV 2016.

How to obtain the Microsoft Dynamics NAV update files

This update is available for manual download and installation from the Microsoft Download Center.

Cumulative update CU 65 for Microsoft Dynamics NAV 2016

How to install a Microsoft Dynamics NAV 2016 cumulative update

See How to install a Microsoft Dynamics NAV 2016 cumulative update.

Prerequisites

You must have Microsoft Dynamics NAV 2016 installed to apply this hotfix.

AL, BC14, BC15, BC16, BC17, Business Central, Codeunit, Development Tips, Enum, Extension, How To, Install, JSON, SOAP, Tip & Tricks, V1, V2, Visual Studio Code, Wave 1, Wave 2, Web Client, Web Services, XML

Update Tracking Line, Post Shipment using Web Services in Business Central

Hi, today I will discuss Web Service with below requirement. You can check other earlier post on this topic using search on right side of this blog page.

I got one request on topic from one of my customer cum blog follower, case study is as follows:

a) Will update Qty to Ship on document using Web Service from other application

b) Update Tracking Line for the Shipment using Web Service from other application

c) Post the Shipment using Web Service from other application

To get this we will create an Extension using VS Code which will have:

a) Codeunit with some functions which will be called using Web Service

b) A XML file to automatically expose above codeunit upon publishing this extension

Let us start how to achieve above requirement:

I have created this in BC16, will be same for other versions too.

Creating a AL Project:

Update your app.json & launch.json as per your environment, authentication, dependencies, port etc.

Creating a Codeunit: (TrackingCodeWS.al)

This function will be used to update “Qty. to Ship” on Sales Line

InitLot function as name suggests.

GetNextEntryNo function as name suggests.

It will depend on how you design your codeunit, you may require or not depends on logic how you use them.

AssignLotSalesLine is function which fills the lot details to temp Reservation Entry Table.

CreateReservationEntrySalesLine is the main function which actually makes your Tracking Lines and assign to Sales Line as per information filled in TempReservationEntry table in above function.

PostSalesOrder function is used for posting your Shipment.

Creating XML file to Publish Web Service

This XML file will ensure publishing of Web Service on Install of the Extension. You can directly make entry to Web Service table but benefit of using XML is when to Uninstall your extension the Web Service too will be removed, else if entry made to table you will have to take care to same yourself.

After Install of Extension, your Web Service is automatically Published.

Consume Web Service from Visual Studio

Below is the C# code to consume Web Service created above, you can modify code as per your requirement.

In above code we added Service Reference to Web Service and called functions created in Codeunit.

You can see earlier posts for step wise instruction how to add Web Reference to the Web Service in Visual Studio.

UpdateQtyToShipSalesLine:

Here “1” is used for Document Type = Order,”1008″ is my order no, 10000 is the Line No., 2 is the Quantity to Ship.

AssignLotSalesLine:

“L0001” & “L0002” is my Lot No, Serial No. is blank in this case, 1 is the Quantity, last three parameter is same as in above function call.

PostSalesOrder:

First 2 Parameter is same as above function call Document Type & Order No, third parameter is Ship = TRUE, Fourth Parameter is Invoice = FALSE.

Conclusion

This post gives you overall Idea how you can use Web Service to handle Sales Document from Web Service, you can make required modification to achieve exactly as per your requirement.