Create SQL Job – Stored Procedure

 

Hey Friends,

Sometimes a situation comes were NAV Job stops and we keep on debugging but yet unable to stump the real cause. Even after continuously tracing in Event Viewer we dint found any solid reason for this. So to solve my scenario I decided to write a SP(Stored Procedure) which eventually I attached it as a SQL Job which is supposed to be one of the best scheduler in Programming World.

So here I am to just share with all you as How to Make a SQL Job. 

Login to your SQL Management Studio. In Object explorer you will find SQL SERVER AGENT. Make sure you have a level of Permission in SQL otherwise you wont be able to see this. Right Click on Job and make a new Job.

1

Now you will be able to see a separate Page – Here you have to fill some Information as Name of your JOB, Owner(By Default it will be yours) etc. – Make it enabled as shown in the below Screenshot.

Capture

Now you have to click on Steps – Here you need to fill some mandatory information as Database Name, Command – Procedure Name.

This EXEC command is going to execute your Procedure on regular Intervals.

Capture1

You may click on Advanced on the left Panel and make your Job some more conditional based as what you want to do on Success or on failure of the Job.

Capture2

Now you need to navigate to Schedule menu(Second Screenshot). This is the place where you need to define what will be the recurring timing your Job OR at what intervals or conditions you need to execute your Job.

Capture3

Now you may navigate to Alert menu if you want to make your Job a level more customized. Here you can define Job to raise an alert if the message contains some specific value. If not needed you can skip this. I dint mentioned this in my Job.

Capture4

Now there is a separate menu for notification which you can use use for mail transmissions if Job fails with additional more services.

Capture5

Now simply press OK. Open the first Screenshot page and press View History. Here you can see the logs of your running Job.

CHEERS.

Advertisements

Update FlowFields at Runtime – No Need to Refresh

 

Hey Friends,

I believe many of you have experienced a situation where you have added a FlowField to calculate say Sum of Quantities from the Sales Line for each and every respective Orders. Though the requirement seems very simple but every time you need to refresh the Page to see it’s effect if you are adding any new line to the Order. See the below Screenshot.

FlowField Calculation at Runtime

Every time you will add a new line you need to refresh the Page to get the Header values updated, But just adding a few lines of Code you can make FlowFields effective without even Refreshing the Page. It will reflect you at the Run-time only. Have a look on the below Screenshot.

JPEG2

You just need to add the above  piece of code which is actually affecting the FlowField, like in this case its Quantity of the Sales Line.

WshShell        Automation        ‘Windows Script Host Object Model’.WshShell

NOTE – You Don’t Need to do this for NAV 2016 as it’s been already handled there in itself. 🙂