Use a Job as Step of Another Job

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Job Configuration Examples >

Use a Job as Step of Another Job

This example shows you how to use a previously defined job as a step of another job. Since this example requires a previously created job, you should complete the Creating a Job from a MapForce Mapping example before completing this example.

 

As you may recall from the Creating a Job from a MapForce Mapping example, the CompletePO.job generates an XML file in a temporary folder every time when it runs. This example shows you how to do the following:

 

1.Create a job that copies the generated file from the temporary folder to an archive folder (we will call this job copy2archive).
2.Modify the CompletePO.job to include the copy2archive job as an additional execution step.

 

Prerequisites

Required licenses: MapForce Enterprise or Professional edition, MapForce Server or MapForce Server Advanced Edition, and FlowForce Server
FlowForce Server is running at the configured network address and port (see Setting the Network Address and Port)
You have a FlowForce Server user account with permissions to one of the containers (by default, the /public container is accessible to any authenticated user).
The mapping job created in this example copies files from one directory to another. Therefore, on the operating system where FlowForce Server runs, ensure that both directories exist and that you have rights to create files in both directories (this example uses the C:\temp and C:\archive directory).
Complete the steps described in the Creating a Job from a MapForce Mapping example.

 

Demo files used

CompletePO.job available in the /public container of FlowForce Server administration page.

 

 

Creating the job

1.Click Configuration, and then navigate to the /public container.
2.Click Create, and then select Create Job.
3.Enter the name of the job (in this example, "copy2archive").
4.Under Execution steps, add the first execution step, as follows:
a.Next to Execute function, navigate to the system/filesystem/copy function (for further information about functions, see Built-in Functions).
b.In the Source text box, type the path of the file to be copied (for example, "C:\temp\CompletePO.xml").
c.In the Target text box, type the destination path (for example, "C:\archive"). This must be an existing directory on the operating system where FlowForce Server runs. If you want to rename the file when it is copied, add the file name to the path, for example "C:\archive\PurchaseOrders.xml".
d.Click to select the Overwrite check box. This instructs FlowForce Server to overwrite any file with the same name found at the destination path.
e.Leave the Abort on error option as is.

 

This Boolean parameter determines what should be the return value of the function if the job fails. If Abort on error is FALSE, the function will return Boolean FALSE as well. If Abort on error is TRUE, the job execution is aborted. The default value is TRUE.

 

f.In the Working directory box, type the working directory (for example, "C:\temp").

fs_subjob_01

5.Under credentials, select an existing credential record or specify a local credential (see Credentials).
6.Click Save.

 

As you may have noticed, the job we just created does not have any trigger. We did not define any trigger because we will call this job from another job.

 

 

To add the "copy2archive" job as a step of "CompletePO" job:

1.In the /public container, click to open the CompletePO.job record.
2.Under Execution Steps, click new Execution step to add a new step after the existing one.
3.Next to Execute function, browse for the location of the copy2arhive job. Now the execution steps look as follows:

fs_subjob_02

4.Update the time trigger, and then click Save.
5.At the time entered in the trigger, FlowForce Server executes the job and copies the CompletePO.xml file from the temporary location to the archive location. To see whether the job executed successfully, refer to the job log (see Viewing the Job Log).

© 2019 Altova GmbH