Jump to content

SC Plugin Help


This topic is 5068 days old. Please don't post here. Open a new topic instead.

Recommended Posts

No filemaker plugin can trigger a file to be uploaded on your clients machine if they are not running FileMaker, or without any interaction on the part of the person receiving the PDF you are attaching and emailing. That would border on virus behavior!

You can, however, use the SuperContainer Companion Plugin upload a file to SuperContainer on your end in the same script you are using to email your customers (or a different script if you prefer). You can use the SCSetContainer function to script an upload from your local machine to a SuperContainer URL.

Link to comment
Share on other sites

Thank you Dave!

That is what I was looking for. This is my first time using SuperContainer for a project and I am in learning mode. I just didn't know what function to use.

The email is being sent by FM and I just want a record of the email PDF within the FM file inside a SC web viewer.

Link to comment
Share on other sites

  • 2 weeks later...

Dave,

I will bother you again if I may, for a small amount of direction.

After some trial and error, I have written a test script that performs the following:

1] sets a variable to the pdf path and name

2] saves the records as a pdf using the variable

3] inserts the saved pdf into a container field

4] sets the $base variable using the SCSetBaseURL function

5] sets the $result variable using the SCSetContainer function

6] sets the web viewer to reload itself

The web viewer is set to the name and path of the file that would be created with step 5.

My problem is the SCSetContainer function always overwrites the file at the location even when the file has a different name. I am adding an ID from a field to each pdf.

Is there a way to have SCSetContainer NOT overwrite the file each time?

My goal is to generate a pdf which will be attached to an email. I then want that pdf also saved into SuperContainer, rather than the standard FM container field as I believe this will be a better solution for the client. I want the loading of the pdf into the SC web viewer to be automatic for the user, not something they will have to search for and load into the SC WV.

Thanks,

Michele

Link to comment
Share on other sites

Solved it, I did. :)

The resolution involved writing the SCSetContainer step correctly so that a folder to hold each new pdf file was created.

Changed

Set Variable [$result; Value:SCSetContainer(

        "Test/Testfiles" ;

       TEST_SC::acontainer ;

     

    )]

to

Set Variable [$result; Value:SCSetContainer(

        "Test/Testfiles/" & TEST_SC::acontainer ;

       TEST_SC::acontainer ;

     

    )]

and it works perfectly.

The difference is a folder for each of the PDFs is generated inside of the Testfiles folder and that holds the individual PDF file.

Folder Test1.pdf holds the file Test1.pdf

Folder Test2.pdf holds the file Test2.pdf

and the SCSetContainer function automatically places the files correctly. The web viewer is set to the web address:

"http://192.168.0.4:8020/SuperContainer/Files/Test/Testfiles/Test" & TEST_SC::recordID & ".pdf"

and it auto loads for the client.

Perfect.

I know I finally solved this myself, but thought I'd share the solution in case it helps someone else trying to do the same. Nothing like figuring a problem out the hard way to give you a charge!

Link to comment
Share on other sites

Hey Michele - if you do it that way (using the filename from the container field as the upload key), be sure to store a reference to that filename in some FileMaker text field. That way, if you ever decide to delete the container fields, you won't lose the reference to where the file is stored in SuperContainer.

For this reason, we usually recommend using the record primary key instead of the filename, so your plugin function might look like this:

Set Variable [$result; Value:SCSetContainer(

"Test/Testfiles/" & TEST_SC::primaryKey ;

TEST_SC::acontainer ;

)]

Instead of this:

Set Variable [$result; Value:SCSetContainer(

"Test/Testfiles/" & TEST_SC::acontainer ;

TEST_SC::acontainer ;

)]

That way you never have to know the filename to store or retrieve documents.

Link to comment
Share on other sites

Hi Jesse,

Nice to hear from you!

Thanks for the tip. I did plan on deleting the container item after it is stored in the SC files folder, so that is probably a good idea - to store the name of the file and its location in another field.

The file name of the PDF is generated with the unique ID of the record as part of its name in the preceding steps in the script, but it would be a good idea to store that name and the SC location as well, in case there is a change in the future.

Thanks for the idea. I have really enjoyed learning a bit about SC. Nice tool.

Thanks,

Michele

Link to comment
Share on other sites

This topic is 5068 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.