0

Triggering importFile() without a button? to automate updating of a shareFile()

Is this possible? My goal is to use a shareFile() Link, but the document will update daily. So I am trying to import the document to an image/file field at regular intervals so that the URL is always giving an updated version of the document.

 

Trigger on Update / Create' doesn't seem to work for ImportFile()

2 replies

null
    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Haven't tried it but could it work from a global script?

    • Richard_Bramall
    • 2 yrs ago
    • Reported - view

    Hi Mel,

     

    I'm not familiar with the Global Scripts area of Ninox so this will be a first, but I've read up and given it a try.

    In the Global Script Definitions I added the below:

    function pn() do
    let t := record('Employees',6);
    let pdfname := text("Training Matrix");
    let myPdf := printAndSaveRecord(t, pdfname);
    let myName := "test1.pdf";
    importFile(t, myPdf, myName);
    t.(Image := myName);
    t.(URL := shareFile(t.Image))
    end

    Then on the Global 'Trigger after Open' I have used 'pn()' 

    It half works, as the file will import on open, however strangely when doing this, none of the text fields populate with information from the record.

    I 've tried the openRecord() command on Open (although not ideal) to see if that helps the action, but even with the record open the PDF still doesn't populate any fields (except for an image field)

Content aside

  • 2 yrs agoLast active
  • 2Replies
  • 367Views