Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Joey S
2021-09-16T19:03:05Z
I have a job that is triggered by files that are created in a number of "failed" folders. Basically another automation is running that processes files through SQL but if the file does not meet the correct naming pattern or the sql results come back bad then the file is placed into a folder labeled "Failed". There are a number of these folders and each folder is a trigger for the VC job.

Ok, so when the failed file comes in I am running a powershell script as the first task to determine the owner of the file. Essentially, who created the file. With this info I can tell them that their file failed.

It was working but now is not.

Here is my PS script
$Path = get-childitem "{TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Folder)}\{TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Result.Name)}" -recurse -force
Get-ChildItem $Path -force -Recurse | Select FullName | format-table -AutoSize
Get-ChildItem $Path -force -Recurse | Select CreationTime | format-table -AutoSize
Get-ChildItem $Path -force -Recurse | Select @{N="Owner";E={ (Get-Acl $_.FullName).Owner }} | format-table -AutoSize

So, to translate.
the setting of $Path is just for convenience in the rest of the script. The trigger and variable is correct. If I place that into the VC variables window it does translate to the last file to trigger the job
The next three lines provide that output for a subsequent email. The Full Name of the file, the time it was created and the Owner

All of this works if I pass a folder and file name through but {TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Folder)}\{TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Result.Name)} does not work.

The result is shown below

Standard Out and Error
Screenshot 2021-09-16 140051.jpg Screenshot 2021-09-16 140121.jpg

Any ideas?
Sponsor
Forum information
Gary_W
2021-09-16T20:11:29Z
The direct ID in the first trigger has to be incorrect. Did you copy/paste this code thus the ID is wrong? I do this all the time! lol The error message of "cannot find trigger..." is the first thing get-childitem is trying to follow.

$Path = get-childitem "{TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Folder)}\{TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Result.Name)}" -recurse -force
Joey S
2021-09-16T20:15:30Z
What I see is that the powershell execution is using the literal words in the variable and VC is NOT translating the variable and passing the path

If I simply copy the line out of the script and put it into the variable window it does translate. SO really the question is why VC is not translating the variable and using the translation in the script

image.png


Translation
image.png
Joey S
2021-09-16T20:23:58Z
I ran just this

Write-Output "{TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Folder)}\{TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Result.Name)}"

And receive this

[Could not find trigger for: TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Folder)]\[Could not find trigger for: TRIGGER(398894c7-a91d-4d6d-b47f-0883752f9a07|LastTrigger|File.Result.Name)]
Joey S
2021-09-16T21:11:47Z
I recreated the task and it is ok now
Support
2021-10-12T18:28:56Z
Thanks for confirming that it works now.
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Scroll to Top