Saturday, November 17, 2012

Creating file dependency process in PeopleSoft

In this doodle we will discuss about how to have the PeopleSoft process to keep polling for a file and make the process to run based on the availability of the file.

Sometimes you may have to implement file watcher functionality  for your processes (i.e) process should keep looking for a file and a process should be run as soon as the file becomes available in the path.PeopleSoft process scheduler has provided the below options to achieve the file polling functionality:

File Dependency setup in Process Definition

In process definition options page (PeopleTools > ProcessScheduler > Processes > Process  Definition Options Tab), you can enable the file dependency for a process by selecting the "File Dependency" check box.

If this option is activated, Process Scheduler checks for the existence of the file. If the file is found and no other process is using it, the process will run. If the file is not found or is in use, the process does not run but enters a Blocked state. Time counting starts at this point. Process Scheduler continues to check for the file. If the file is not found or it is in use even after the time interval specified in Time Out Max Minutes, the process will go to Error state.

If the Max Time Out Minutes field is left blank, the process scheduler does not schedule the process as long as the file is not found in the specified location.




File Dependency through PeopleCode


You can use the PrcsApi class methods for detecting files associated with a process.The PrcsApi class is an Application Package class that you must import into your PeopleCode in order to use its methods.

After you have list of files associated with a process, you could create a file dependency (using the FileName ProcessRequest property) and make the process dependent on the file.

FileName property contains the name of a file to be used with file dependent processing, that is, processes which are initiated only after a file becomes available.

The following code example initiates QE_AETESTPRG once the c:\import\ediData.dat file becomes available on PSNT server.

Local ProcessRequest &rqst1;

&rqst1 = CreateProcessRequest();
&rqst1.RunControlId = "2";
&rqst1.ProcessType = "Application Engine";
&rqst1.ProcessName = "QE_AETESTPRG";
&rqst1.RunLocation = "PSNT";
&rqst1.FileName="c:\import\ediData.dat";
&rqst1.Schedule();




1 comment:

  1. Where to write this code to Trigger process?

    ReplyDelete