Generating a PDF file and storing it in a container field seems straightforward enough, but if you are using FileMaker Go, you'll want to keep the following in mind:
When the PDF is created, it needs to be temporarily stored on the file system, so that it can then be inserted into the container field. However, the Insert PDF script step doesn't seem to work properly in FileMaker Go when the PDF that was created is saved to the temporary path: Get(TemporaryPath). The local variable used to specify the file name and path is ignored, and instead the user is prompted to select one of the PDFs that's stored in the documents folder: Get(DocumentsPath).
By the way, when using FileMaker Go, you can see the PDFs that are in the Get(DocumentsPath) location, if there are any there at all, by selecting "Device" from the left side of the screen. If you have an fmp12 file currently open, you will need to go to your Home view first (tap the icon in the upper-left) and then select "Device" on the left side. The PDF files are listed below the FileMaker files, so you may need to scroll down first.
We would like to use the temporary path to store the PDF file, because then it would automatically be deleted once FileMaker closes. But because this doesn't seem to work properly in FileMaker Go, we are forced to use the Documents path. However, now we need to delete the file after it's inserted into the container field, so that it doesn't linger there after we're done. There is no "Delete File" script step, but there is a workaround we can use. If we run the Export Records script step, making sure to empty out the found set first, then the file will be deleted.
Note, in FileMaker Pro, you can also delete a file using the Export Field Contents step if you specify the file name and path but don't specify a field. But this method doesn't seem to work in FileMaker Go.
Note: The above was tested using FileMaker Pro 13 Advanced with Mac OS X 10.8.5, FileMaker Pro 13 Advanced with Windows Server 2008 R2, and FileMaker Go 13.0.5 with iOS 7.1.2.
Soliant Consulting employs the largest FileMaker development team in the world. We have a deep bench of talent starting with our CEO, Bob Bowers: he's co-authored seven books, led the team that has written six editions of the Authorized Training Series for FileMaker, Inc., spoken at more than a dozen FileMaker Developer Conferences, and has taught literally thousands of students spanning two decades of leadership in the field. Certified Expertise Soliant's team is certified in every version of FileMaker Pro and are specialists in building high-performance databases, hybrid web-FileMaker applications, integrations with a range of technologies including SQL, and conversions from prior versions. We work with your solution as is or can build from scratch. Find out how we can take your FileMaker databases to the next level.Website: www.soliantconsulting.com/filemaker