options.files[] missing in PreSavePage script when evaluated by "flow editor"

Comments

2 comments

  • Sree Vani Amara Principal Product Manager
    Engaged
    Answer Pro
    Celigo University Level 4: Legendary

    Hi Steve Klett,

    Thank you for reporting this, we'll have our team look into it and fix it in a future release. Appreciate the help!

    0
  • Emmanuel Marian Mathew Software Engineer
    Celigo University Level 4: Legendary

    Hey Steve,

    Could you please ensure that you also return the "files" field from the onPreSavePage function? You could also make the necessary changes to the data and return the "options" JSON as it is, so that nothing is missed, like the function below. Please let us know if this is working for you.
    Thanks,

    Emmy

    function onPreSavePage (options) {
      
      //  Copy the export filename to the record so it's part of the retry data and maybe we'll 
      //  save on the record in NetSuite in case we need to investiage what happened.
      options.data.forEach(record => {
        
        //  There should always be a filename, if there isn't we want to throw because that's completely unexpected
        if (options.files.length !== 1) {
          throw `Expected exactly 1 file record but found ${options.files.length}`
        }
        record._ediFilename = options.files[0].fileMeta.fileName
      })
      
    return options
    }
    0

Please sign in to leave a comment.