WorkflowsWorkflows JOBSCOPE Page 2 Workflows The Workflow functionality is based on entering,...
Transcript of WorkflowsWorkflows JOBSCOPE Page 2 Workflows The Workflow functionality is based on entering,...
Workflows User’s Guide JOBSCOPE ®
JOBSCOPE Workflows Copyright, Jobscope, LLC, 1996 - 2011 JOBSCOPE® Information in this document is subject to change without notice. Jobscope LLC makes no warranty of any kind regarding this material, and shall not be held liable for errors contained herein or for damages resulting from the use and performance of this material. The information in this document is protected by copyright. No part of this manual may be reproduced in any form without the expressed written consent of Jobscope LLC.
Workflows
JOBSCOPE Page 1
Table of Contents
Workflows ..................................................................................................................................................... 2
Setting Up For Workflows ......................................................................................................................... 3
Enabling the Message Broker ............................................................................................................... 4
Creating the Workflow Service ............................................................................................................. 5
Creating the Actual Workflows ............................................................................................................. 9
Workflow Browse .................................................................................................................................... 10
Creating a New Job Workflow ................................................................................................................ 11
The Conditional Step ........................................................................................................................... 12
Sending an Email ................................................................................................................................. 15
Sending an Alert .................................................................................................................................. 20
Running a Report ................................................................................................................................ 22
Creating an Audit Workflow ................................................................................................................... 28
Creating a Workflow to Run VB.Net Code .............................................................................................. 29
Grouping in the Select Statement (Default) ........................................................................................... 33
Workflows
JOBSCOPE Page 2
Workflows
The Workflow functionality is based on entering, changing, or deleting information in the database. It
allows you to do four things, send emails, send alerts, run reports and log table audits. A workflow
consists of a workflow header and one or more workflow steps. If a workflow has an audit step, it may
not have any other steps. If you want to send an alert and an email to a certain user when a new job is
received, then you would need two steps, one to send the alert and one to send the email.
There is another type of step that you may find useful, and that is a conditional step. A conditional step
defines whether the “child” steps for the conditional step should be executed. For example, if you only
want to send an email for a job greater than $5000. So if you wanted to send an alert and an email to a
certain user when a job over $5000 is entered, then you would need three steps, the conditional step,
then a child step for the alert, then a child step for the email. If you wanted to send an alert to an
additional three people, then you would need six steps.
Alerts are posted on the To Do List on the homepage of the user to which the alert is sent. A service
runs every five minutes to refresh the homepage. The homepage also refreshes when it is opened, so
logging off and back on will show you the latest alerts.
The purpose of an audit workflow is to record when a record in a database table is created, changed, or
deleted. An audit workflow has only one step, and that step is an Audit step. If the audit is for the
Vendor Master, IPVENDM, the audit data will be stored in table IPVENDM_AUDIT. That table does not
exist until you create an audit step for IPVENDM. Creating the step creates a database trigger on table
IPVENDM, and creates the new table IPVENDM_AUDIT.
Workflows
JOBSCOPE Page 3
Setting Up For Workflows
In order for Workflows to work, the database must have an owner. Sometimes Restore and other
processes can delete the database owner. To check this, open SQL Server Management Studio and
connect to the server where your Jobscope database resides. Open the Databases listing and write click
on the Jobscope database. Click on Properties in the menu. The Database Properties screen will display.
Click on Files and the display will look like this. Be sure that the Owner field is not blank.
Workflows
JOBSCOPE Page 4
The Workflow Service must be configured and started. This is described in the following section.
Enabling the Message Broker
You need to enable the SQL Server Message Broker. you can enable it using the Query window in
Microsoft SQL Server Management Studio with the following command. Set the database to master.
alter database jobscope set enable_broker
(where “jobscope” is your database name)
To do this, you need exclusive access to the database. If you don’t have exclusive access it will just sit
there indefinitely. The command should execute in less than a minute.
If you need to break the existing connections, you can use this version of the command:
alter database jobscope set enable_broker WITH ROLLBACK IMMEDIATE
If you can’t get this to work, the reason may be that the enable_broker command was issued on a
database and then that database was backed up and restored to a new database, such as you might do
to create a test database. You will need a different command on the new database. If this is the case,
you need to use this command:
alter database jobscope set new_broker WITH ROLLBACK IMMEDIATE
Workflows
JOBSCOPE Page 5
Creating the Workflow Service
On the server, open Server Admin Utility, then go to Configure Services.
Workflows
JOBSCOPE Page 6
When the screen opens, immediately click on the Work Flow button and a template workflow will
display in the grid. Double click the one with the Name Jobscope Workflow Service.
The intent here is to give you a template to copy for the service for each of your databases.
Workflows
JOBSCOPE Page 7
When it displays, change the name to something distinctive. Most include the database in the name.
Change the location of the Auto Config file, and the server name and the database and save it.
Workflows
JOBSCOPE Page 8
Check the way you want the service to interact with the desktop. If you are unsure, select Use Local
System Account. You will need to enter a valid JEE user/password. We would recommend that you
create a user called WORKFLOW so you do not “break” this if a user changes their password.
Now go to Start - Control Panel – Administrative Tools – Services. You should now have one called
“Jobscope Workflow Service”. Start that service by right clicking on it.
Note – if the service starts then stops, you will need to look in the Event Viewer to see what issue
caused this to happen.
You can set how often the service should run using the Options button on the toolbar. Set the number
of milliseconds.
Workflows
JOBSCOPE Page 9
Creating the Actual Workflows
The workflows themselves are set up in System Supervisor. From the homepage, click on System
Management, System Utilities, and Workflows.
The first thing you should know is how to work with data. If you right click on File at the top left, you will
get options for New, Open, Save, and Delete. Alternately, you can do <CTRL> N, or <CTRL> O, or <CTRL
S>. To delete, you must use the File button. Be careful when deleting. If you click on File and Delete,
the whole workflow will be deleted.
Workflows
JOBSCOPE Page 10
Workflow Browse
If you select Open, the Workflow browse screen displays, where you can browse for the workflow that
you want to work with.
Workflows
JOBSCOPE Page 11
Creating a New Job Workflow
Let’s create a workflow for the example where we want to send a notification to a certain user via alert
and email when a new job is entered for $5000 or over. We want to send the notification to user
BPARROTT.
This is what we would enter on the header screen. The table is IPJOBM, which is the job master.
We will save it, and then we are ready for the first step, which will be a conditional step.
Workflows
JOBSCOPE Page 12
The Conditional Step
We click on the dropdown beside Actions and click on New Conditional Step.
Workflows
JOBSCOPE Page 13
The Workflow Step screen displays. We start by clicking on the green plus sign.
The first field dropdown allows us to select a table. The job master, IPJOBM is selected. The second
field allows us to select a column in that table, and PRICE_SALES has been selected. The next field lists
comparisons. We have selected “Is greater than or equal to”, and then the amount. The last field is for
grouping the lines. That will be discussed later.
The red minus sign is to delete and start over. We’ll click on OK and it’s done.
Workflows
JOBSCOPE Page 14
Now the front screen looks like this.
Workflows
JOBSCOPE Page 15
Sending an Email
With the new conditional step highlighted, we click on Child step from the drop down beside Actions.
The system will ask us to select Conditional Step (to allow for “cascading” these conditions), or Send
Email or Send Alert.
Workflows
JOBSCOPE Page 16
Now we can enter the email step. We start with the name and the to/from/subject information.
We want the message to be something like “New Job 116895 for $21637.00 from customer Bayline
Manufacturing Company has been entered.”
So, in the body, we typed the first part of the message “New Job”. Now we want the job number, so we
right click at the point where we want it, and the screen looks like this.
Workflows
JOBSCOPE Page 17
The dropdown looks like this.
After we select job number, it looks like this.
Workflows
JOBSCOPE Page 18
We’ll do the rest of it until it looks like this, and we’ll click on OK to save it.
Workflows
JOBSCOPE Page 19
After we select the fields, the front screen looks like this.
Workflows
JOBSCOPE Page 20
Sending an Alert
We want to send an alert to Jane, but not just for jobs over $5000, so we won’t highlight the conditional
step, but just click on the down arrow beside Actions and click on Send Alert.
Workflows
JOBSCOPE Page 21
The entry here will be exactly the same except we select a user from the drop down rather than
entering an email.
Workflows
JOBSCOPE Page 22
Running a Report
We might want to run a report when a new job is entered. To do this, we’ll highlight the conditional
step and click on the down arrow by Actions. This time we’ll select Report.
Workflows
JOBSCOPE Page 23
The report we want to run is the sales acknowledgment, so we’ll put that in the name.
For Module, we’ll select Job Management and Control from the dropdown, and then we’ll select the
Sales Acknowledgement.
When we select Sales Acknowledgments, the system brings in the parameters for that report. We’ll
right click in this area, and get the Insert dropdown, where we’ll select Job Number.
Workflows
JOBSCOPE Page 24
So then it looks like this.
When we save it, it will uncheck the date boxes, which will take the date consideration out of the
selection.
Workflows
JOBSCOPE Page 25
Finally, we need to tell the system where to deliver it, so we’ll click on the Delivery tab and make these
entries and click on OK to save it.
Workflows
JOBSCOPE Page 26
Finally, when the workflow is ready to go into service, check the Active flag. The workflow will not run
unless the Active flag is checked.
When we exit, we get this message, which we’ll answer Yes.
Workflows
JOBSCOPE Page 27
The report will come as an attachment to an email, and might look like this.
Workflows
JOBSCOPE Page 28
Creating an Audit Workflow
This one is very simple. Everything is on the front screen. This says that anytime a record is added,
changed, or deleted from the Fixtures table, write an audit record in table Fixtures_AUDIT.
This is all there is to it.
Workflows
JOBSCOPE Page 29
Creating a Workflow to Run VB.Net Code
You can add code to a work flow to actually do database updates.
To do this, highlight the step in which you want to run the code and click on the down arrow beside
Actions and click on the Run Code option.
Workflows
JOBSCOPE Page 30
Let’s look at an example of a coded workflow. This example will close all the scheduling milestone steps
when the last step is closed.
This is what the complete workflow looks like.
The Recurrence section allows you to define a regular schedule for running the workflow. If the
workflow is to run based on some database activity, then the Recurrence would be None, as shown
above. If you want the workflow to run on a regular schedule, you can check one of the other
Recurrence selections. The Recurrence here works exactly like it does for the Report Scheduler, which
you can learn about in the video “Scheduling Reports in Jobscope”.
Workflows
JOBSCOPE Page 31
To move along with the example, we’ll double click on the SM Milestones step.
This shows the selection. Although you can’t see it in this picture, this field is Milestone Code.
This field is Date Complete. So, the selection is saying,” If SchedulingMile.MilestoneCode = SM and
SchedulingMilestone DateComplete is not null”. This company uses a milestone code of SM for the last
milestone step.
That’s why the Recurrence is set to None. The workflow will run when the last milestone step of any set
of milestones is changed from not complete to complete.
Workflows
JOBSCOPE Page 32
If we double click here, we can see the code.
This is the code.
Workflows
JOBSCOPE Page 33
Grouping in the Select Statement (Default)
The last field on each line displays with the word “Default”. You can change it to anything you like.
What it does is group the lines together. The screen below shows two groupings, Default and A. We
could just as well called them A and B by changing the word Default to A. Notice the parentheses. The
value in the grouping field determines where they will be.
September 6, 2016