Saving PDF and Viewing Them

In summary:

  1. I create a PDF via bot
  2. Save the full path to the sheet
  3. Go to the invoice’s details & click the link to view the PDF
    or
  4. Go to the invoice’s details & click on the action..
  5. File can’t be found?

I’m probably missing something simplistic here.

So I have a bot that saves my invoice as a PDF, which works flawlessly

Here is the invoice saved to my drive in the correct directory.

PDF is correct

I am saving the full path to a column (non virtual) in the same bot after the PDF is created. Here you can see invoice 1274

Here is the data, showing that it’s saved.

When I go to the view, the link is active

I even created an action to open the PDF externally

but when I click on it in the detail or click the action button, I get the following error.

        <html>
        <body style="margin:20px">
          <div>'CRM-5099355/Invoices/Invoice_1274.pdf' not found</div>
          <div>Probable cause: N/A</div>
          <div><ul><div>
   <div>Path: Root</div>
   <div>Result: FAILURE</div>
   <div>Message: N/A</div>
   <details>
<ul>
<li><div>
      <div>Path: Root</div>
      <div>Result: FAILURE</div>
      <div>Message: N/A</div>
      <details>
<ul>
<li><div>
         <div>Path: Root</div>
         <div>Result: Success</div>
</div>
</li>
<li><div>
         <div>Path: Root</div>
         <div>Result: FAILURE</div>
         <div>Message: N/A</div>
         <details>
<ul>
<li><div>
            <div>Path: Root</div>
            <div>Result: FAILURE</div>
            <div>Message: N/A</div>
            <details>
<ul>
<li><div>
               <div>Path: Root</div>
               <div>Result: FAILURE</div>
               <div>Message: N/A</div>
               <details>
<ul>
<li><div>
                  <div>Path: Root</div>
                  <div>Result: FAILURE</div>
                  <div>Message: N/A, Searching for 'CRM-5099355', File entry not found</div>
                  <details>

While saving the file name in the backend, please try starting with just

“Invoices/…” rather than "“Appsheet/data/appname/Invoices…”

try “/Invoices/”

Didn’t work.

The data save as:

Didn’t work…

This is what I was following originally: https://youtu.be/kgp-mnsUQPQ?si=0d5Pb97BWNy_7N38&t=611

One thing you may want to share is why it was necessary to create the action “View Invoices” .

Typically if the [Invoice File Path] is a file type column, you would have a system generated action to view that file.

In the example below, the column [Report_File] is of “File” type and stores the file path as the screenshot below shows.

The column in table is as follows

Once a column is designated as file type, AppSheet automatically creates an associated system generated action as shown below to view that file in detail and summary views

Please try making the [Invoice File Path] column as “File” type and test if not already done so.

I figured out the solution to this!

So my db file is NOT in appsheet/data/appname directory, it’s in a different location that I call DBs. I have other files there, so it was only fitting that I keep everything in one place.

The solution is that when I’m saving the file I’m using the expression “./appsheet/data/”&CONTEXT(“appname”)&“/Invoices/Invoice_” & [_thisrow].[invoice number] & “.pdf”

By setting the “.” at the base of the path, it’ll take me to the root “My Drive”.

So I can have my DB anywhere and now access everything I need. Keeping all attachments at the app level but sourcing the DB somewhere else.

Thanks everyone for all your insight!!

1 Like