Speed up Project Planning With the VJS: Start From a Dynamics NAV Page

Posted by Frank Köhnen on Mar 9, 2016 4:51:00 PM

Microsoft Dynamics NAV project planning is your day-to-day business? Moreover, you enjoy working with the the Visual Jobs Scheduler (VJS), the Gantt chart add-in for Microsoft Dynamics NAV, since it lets you visualize your jobs, job tasks, job planning lines and resources in a straightforward and uncomplicated manner? Then you'd surely love to see how you can use the VJS in an even more effective and practical way.

Read this blog post to learn how to directly start the VJS from a NAV page already containing specific filters or jobs. This way, you can bypass the filter request page popping up when starting the VJS the usual way, saving you from re-entering the filter settings you have already made. This should enable your users to start the VJS with data that is meaningful for the task they currently work on.

Requirements

Visual Jobs Scheduler version 1.2 onward:

Proceed as shown in the examples below

 Visual Jobs Scheduler version 1.1 or below 

Follow the steps as described in the next paragraph to create the function on the VJS Page first.

Create the function on the VJS Page

  • Start the development environment of Microsoft Dynamics NAV
  • Open the page "NETRONIC VJS" and click the Design button
  • Click View -> C/AL Globals
  • Open the Functions tab
  • Add a new function SetJobFilter to the list
  • Make sure the function is not local
    Open the properties by right-clicking on the row and set local to No.

Visual Jobs Scheduler - Set Job Filters I

  • Mark the new function and click the Locals button.
  • The function needs a job Record as a Var (click the Var column for the check mark to appear) parameter to pass the filters to the VJS. In our example, the parameter is called jobRecPar

Visual Jobs Scheduler - Set Job Filters II

  • Now close the Locals and Globals windows and check the C/AL code (F9). The body of the new VJS function should look like below (you can use Copy/Paste):

    IsFilterSet:=TRUE;
    JobRec.COPYFILTERS(jobRecPar);

Now that you are done on the VJS Page you can open the page from where we want to start the VJS and proceed according to the below examples.

Example 1

In this example, we will add an action to the Page 88 “Job Card”, so that the VJS will show only the job in the Job Card.

  • Design Page 88 “Job Card” and click View -> “Page Actions” (Ctrl + Alt + F4).
  • Now add a new Action to the page.
  • With the new action marked press F9 or click View àC/AL Code.

The VJS only passes filters used on the job Record so to get a job Record with filters on it we need a local variable in our new action.

We also need a VJSPage variable to call our new function and to RUN. 

  • Click View -> C/AL Locals to open the Locals dialog for the action.
    Here you can add the two needed variables.
Visual Jobs Scheduler - Set Job Filters III
  • Enter the action code:

     job.SETFILTER(job."No.","No.");
    VJSPage.SetJobFilter(job);
    VJSPage.RUN;

    With that, the action will put a filter on our local job variable, so that the “No.” field is the same. Then it passes that filter on to our new VJS function and when the page is run, the filter is used to load only that one job Record.

 Please note that Jobs with “completed” status will not be loaded by default!

Example 2

In this example we will add an action to the Page 89 “Job List”, so that the VJS shows the jobs that are shown in the list.

  • Design Page 89 “Job List” and the click View -> Page Actions (Ctrl + Alt + F4).
  • Now add a new action to the page.
  • With the new action marked press F9 or click View àC/AL Code. 

The VJS can use the filters set in the “Job List” Page so we only need a VJS Page variable to call our new function and to RUN.

  •  Click View ->C/AL Locals to open the Locals dialog for the action.
    Here you can add the needed variable.

Visual Jobs Scheduler - Set Job Filters IV

  • The code needed for the action:

    VJSPage.SetJobFilter(Rec);
    VJSPage.RUN;

    These code lines ensure the filters currently used in the “Job List” Page to be passed to the VJS.

Please note that jobs with completed status will not be loaded by default, but can be activated on the Setup page!

Please also note that as of Visual Jobs Scheduler version 1.3, the function SetResourceFilter is available on the VJS Page, allowing to filter resources in the same way.

 

More about visual scheduling

Professional project planning with NAV - how milestones can contribute

Templates: More transparency and agility for project planning in NAV

What is Good Scheduling? An Interview with Mercurius IT’s Lee Cridland

Topics: Business Central Project & Resource Scheduling, Dynamics NAV Visual Scheduling Add-in