AnsweredAssumed Answered

PSOS Insert From URL, local file on Windows 2012 R2 AWS

Question asked by Jason Wood on Dec 16, 2018
Latest reply on Dec 18, 2018 by Jason Wood

I have had this working on a Mac server a while ago (FMS16 I think) but can't get it working on a Windows 2012 R2 AWS Instance with FMS 17.

 

I am saving a PDF to the TemporaryPath using "Save Records as PDF"

 

Then I use "Insert From URL" ("Insert PDF" and similar steps do not work on server) to insert the file from the TemporaryPath into a container. This step generates error 3 (Command is unavailable (for example, wrong operating system or mode)).

 

Script:

//Establish context from ScriptParameter
Set Variable [ $id ; Get ( ScriptParameter ) ]
Go to Layout [ "Print Layout" ( FORMS ) ]
Perform Find [ Restore ]

//Save PDF to TemporaryPath
Set Variable [ $path ; Value: "filewin:" & Get ( TemporaryPath ) & FORMS::uuid & ".pdf" ]
Save Records as PDF [ $path ]

//Insert PDF into Container
Go to Layout [ "Container Layout" ( FORMS ) ]
Set Variable [ $path ; Value: "file://" & Get ( TemporaryPath ) & FORMS::uuid & ".pdf" ]
Insert from URL [ FORMS::containerField ; $path ]
Set Variable [ $test ; Get ( LastError ) ]
Exit Script [ Text Result: $test ]

 

I know that the PDF saves successfully to the temporary folder. I added a long pause after line 8 so I could confirm this.

 

The $path passed to Insert from URL looks like this:

file:///C:/Windows/Temp/S61657/93833D51-EA12-3F46-B759-F663FAA9725F.pdf

 

Also during a long pause after line 8, I tried putting this into Internet Explorer and it loads the file. So the file is definitely there, and the File URI Scheme works on the machine.

 

I get error 3 regardless of whether I supply a valid path.

 

The container field is DEFINITELY on the layout. I checked this 20 different times and 20 different ways!

 

I granted full access to the script to rule out any problem with permissions (also tried running with a Full Access account).

 

Record locking is definitely not an issue - I modified other fields in the record in this script just to be certain.

 

I tried changing Insert from URL to insert into a variable. This was buggy but TSGal confirmed this should work in FMPA17 in this post: Insert from url into a variable fails with file: (FMS is not discussed specifically). Interestingly, the Insert from URL script step returns NO ERROR when inserting into a variable, but the variable is empty.

 

Note: for anyone wondering why I'm not using "Insert PDF" or similar - those do not work on server.

 

The error code of 3 is the oddest part. What's that about?

 

user19752 reports using the above technique on Windows Server 2008 R2 with FMS17 with no problems in this thread: Insert from URL on Windows Server Script - Error 100 (File is missing)

 

Another user seems to have been unable to do the same thing on a Windows AWS instance (unsure of version): Is there a way to save records as PDF files on server?

 

Any ideas?

Outcomes