Newbies Fredrik Arntzen Posted June 16, 2020 Newbies Posted June 16, 2020 Hi everyone. I´m running a setup with the FM18 Server ( 18.0.1.123) on Win, ODBC mySQL tables and clients using Wed Direct both on Win and OSX through Chrome. Part of the solution is creation of contracts, so the clients use Web Direct and I´m using a server-side script to create the PDF and send the PDF on mail to the client who made it. I would like the script to insert the newly created file into a container for archive, but I´m fairly new to writing scripts on the server, and doest now exactly how I can debug them as I can with FM Advanced on my MacBook. Please advice. The script now sucessfully creates the PDF to the temp folder on the server, and sends it as an attachment on mail. That works fine, and the path to the file is file:///C:/Windows/Temp/S467/342_Arnfinn_Moseng_avtale.pdf saved in the $outputfile Its the Insert from URL script step thats not entirely correct set up I suspect, and I´m not sure if I need to take into consideration that the client could be on OSX/Win, or if it doesnt matter when the server is on Win, path wise. Nevertheless, since the script can locate the file for the Send mail script step, I reckoned the path is good enough for Insert from URL as well. The container field is visble in the layout, set to browse mode and interactive content. What am I missing..? #Purpose: FM18 Server import PDF into container #Dependencies: None #Script Parameters: contracts_id, filename #Results: contracts::file container with PDF #VARS Set Variable [ $contracts_id; Value:GetValue ( Get ( ScriptParameter ) ; 1 ) ] Set Variable [ $filename; Value:GetValue ( Get ( ScriptParameter ) ; 2 ) ] Set Variable [ $outputfile; Value:Get ( TemporaryPath ) & $filename ] #$outputfile result : file:///C:/Windows/Temp/S467/342_Arnfinn_Moseng_avtale.pdf #NAVIGATE Go to Layout [ “hr_contracts_printing” (contracts) ] Perform Find [ Specified Find Requests: Find Records; Criteria: contracts::id: “==$contracts_id” ] [ Restore ] #SAVE PDF TO TEMP DIR ON SERVER Save Records as PDF [ File Name: “$outputfile”; Create folders:Yes; Current record ] [ Document - Title: "Contract " & qa_employees::shortname; Subject: "Contract"; Author: "Qvisten Animation" ] [ Pages - Number Pages From: 1; Include: All pages ] [ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ] [ Restore; No dialog ] #INSERT PDF TO CONTAINER Enter Browse Mode Go to Object [ Object Name: "filecontainer" ] Insert from URL [ contracts::file; "file://"&$outputfile ] [ Do not automatically encode URL; Select; No dialog ] #SEND PDF ON MAIL Send Mail [ Send via SMTP Server; To: ""; Subject: "The contract"; Message: "file://"&$outputfile; Attachments: “$outputfile”; Name: "Qore"; Email Address: ""; SMTP Server: ""; Port: ""; Authentication Type: None ] [ No dialog ] Thanks! 1
Newbies Fredrik Arntzen Posted June 16, 2020 Author Newbies Posted June 16, 2020 Wops, typo. The result from $outputfile was suppose to be #$outputfile result : /C:/Windows/Temp/S467/342_Arnfinn_Moseng_avtale.pdf Its only in the Insert from Url I´m adding the "file://" Fredrik 20 minutes ago, Fredrik Arntzen said: Hi everyone. I´m running a setup with the FM18 Server ( 18.0.1.123) on Win, ODBC mySQL tables and clients using Wed Direct both on Win and OSX through Chrome. Part of the solution is creation of contracts, so the clients use Web Direct and I´m using a server-side script to create the PDF and send the PDF on mail to the client who made it. I would like the script to insert the newly created file into a container for archive, but I´m fairly new to writing scripts on the server, and doest now exactly how I can debug them as I can with FM Advanced on my MacBook. Please advice. The script now sucessfully creates the PDF to the temp folder on the server, and sends it as an attachment on mail. That works fine, and the path to the file is file:///C:/Windows/Temp/S467/342_Arnfinn_Moseng_avtale.pdf saved in the $outputfile Its the Insert from URL script step thats not entirely correct set up I suspect, and I´m not sure if I need to take into consideration that the client could be on OSX/Win, or if it doesnt matter when the server is on Win, path wise. Nevertheless, since the script can locate the file for the Send mail script step, I reckoned the path is good enough for Insert from URL as well. The container field is visble in the layout, set to browse mode and interactive content. What am I missing..? #Purpose: FM18 Server import PDF into container #Dependencies: None #Script Parameters: contracts_id, filename #Results: contracts::file container with PDF #VARS Set Variable [ $contracts_id; Value:GetValue ( Get ( ScriptParameter ) ; 1 ) ] Set Variable [ $filename; Value:GetValue ( Get ( ScriptParameter ) ; 2 ) ] Set Variable [ $outputfile; Value:Get ( TemporaryPath ) & $filename ] #$outputfile result : file:///C:/Windows/Temp/S467/342_Arnfinn_Moseng_avtale.pdf #NAVIGATE Go to Layout [ “hr_contracts_printing” (contracts) ] Perform Find [ Specified Find Requests: Find Records; Criteria: contracts::id: “==$contracts_id” ] [ Restore ] #SAVE PDF TO TEMP DIR ON SERVER Save Records as PDF [ File Name: “$outputfile”; Create folders:Yes; Current record ] [ Document - Title: "Contract " & qa_employees::shortname; Subject: "Contract"; Author: "Qvisten Animation" ] [ Pages - Number Pages From: 1; Include: All pages ] [ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ] [ Restore; No dialog ] #INSERT PDF TO CONTAINER Enter Browse Mode Go to Object [ Object Name: "filecontainer" ] Insert from URL [ contracts::file; "file://"&$outputfile ] [ Do not automatically encode URL; Select; No dialog ] #SEND PDF ON MAIL Send Mail [ Send via SMTP Server; To: ""; Subject: "The contract"; Message: "file://"&$outputfile; Attachments: “$outputfile”; Name: "Qore"; Email Address: ""; SMTP Server: ""; Port: ""; Authentication Type: None ] [ No dialog ] Thanks!
Recommended Posts
This topic is 1631 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now