/
How to Start a Workflow from a File
How to Start a Workflow from a File
$rootDirectory must be set to the directory that contains the files. Then, iterate through the directory (skipping the ‘.’ and ‘..’ Linux directories). The task UID and the Process UID must be set to the UID of the specific process’ starting task and the specific process, respectively. This will create x number of cases for x number of files.
1. //MUST CONFIGURE
2. $rootDirectory = "/mnt/testing/";
3. foreach(scandir($rootDirectory) as $file) {
4. if ('.' === $file) continue; //'continue' skips the current loop iteration
5. if ('..' === $file) continue;
6. //set to the starting task's unique ID
7. $taskUID = '1285193425af0d00c9c2813013416687';
8. //set to the process UID that this case will be spawning
9. $processUID = ‘4431893765aff0994befc74091400782’;
10. $newCaseUID = PMFNewCase($processUID, @@USER_LOGGED, $taskUID, array('file' => $file));
11. //if a new case was created, display a message in the next screen:
12. if ($newCaseUID) {
13. $c = new Cases();
14. $aCaseInfo = $c - > LoadCase($newCaseUID, 1);
15. $msg = 'New Case #'.$aCaseInfo['APP_NUMBER'].
16. ' is assigned to '.$aCaseInfo["CURRENT_USER"];
17. $g = new G();
18. $g - > SendMessageText($msg, 'INFO');
19. } else {
20. $msg = "Unable to create new case.".isset(@@__ERROR__) ? @@__ERROR__ : '';
21. $g = new G();
22. $g - > SendMessageText($msg, 'ERROR');
23. }
24. }
, multiple selections available,
Copyright© 2024 IFS AB. Copying prohibited. All rights reserved.