file upload without Form submission?

Hi All,

I have a requirement to upload attachments to a target folder location and assign them before perform submit on UI screen. Is there ant way I can achieve this?

Thanks in advannce.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Agreed with Stewart, what do you mean by "assign them"?

    The user will need to perform a Submit click - either button submit, or a!submitLink - but this does not mean that they need to "leave" their "current task"; if you set it up correctly, from their perspective, the user can stay in the exact same place and the only apparent difference is that their uploaded files will now be fully added into the system and available for whatever further use you needed.

  • Hi Mike, I'm also having issues with retaining in the same user task (form) after clicking on submit link to upload a file. Because I need to show the uploaded file's data in a grid before they submit the form. When you say ' if you set it up correctly' can you please give an example?

  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    There is no "submit" in portals. The documentation on portals explains how to handle this scenario.

  • Hi @Stefan Helzle

    - Thanks for the response. We are trying to get the doc from user in portal and use that as ri for integration as mentioned below. We won't be able to do the same when the file is not available in Appian. Do you know any other option to handle this scenario?

    Along with that I have checked the documentation and it is suggested to use submitUploadedFiles() function and this have same condition on working only with saveinto of Submit 

    https://docs.appian.com/suite/help/23.1/fnc_system_a_submituploadedfiles.html#example


  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    What are you missing? The docs describe, how you get a file uploaded to Appian.

    But maybe that integration has a secret to it. If you share a few more details ...

  • We are trying to send the document as the request to the integration. If I browse and select the file from the Appian folders I will get the response as below.

    If we try to use the file not available in the Appian (Like temp file uploaded in the interface but nor submitted yet), we are getting the below error. Can you let me know what information would be helpful to clarify this query?

  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju
    we try to use the file not available in the Appian

    Is this after you call submitUploadedFiles()?  Can you share the code snippet of your portal form where you're trying to handle this and/or trying to call the above integration?  Because AFAIK there's no expectation that the file will be accessible until it's been moved to the Appian FS.

  • Hi Mike - Find the below code that is working which have Submit=True on the Button. This code works in the interface level as the flow won't move further even thought Submit=true. So File will be uploaded in the Appian target folder and when I call the integration with another button it is working. Is there a way we can use "submitUploadedFiles" function without submit button?


  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    The first thing I'd be trying here is to call the integration from within the "onSuccess" parameter of the a!submitUploadedFiles function, instead of from its own button.  What happens when you try this?

  • Hi Mike - Tried that & not able to resolve the issue.

    • If I pass the integration call in onSuccess part & submit:True for the button -> File uploaded in Appian & Integration not called
    • If I pass the integration call in onSuccess part & submit: True has been commented for the button -> File not uploaded & Appian Integration not called at all
    • If I pass the integration call in as 2nd saveinto part next to a!submitUploadedFiles function & submit:True for the button -> File not uploaded & Appian Integration not called

    Any other suggestions on this?

  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    The documentation seems a tad unclear on this, but I suspect having the buttonWidget marked as "submit" on the portal form is either irrelevant, or potentially harmful.  Hopefully just the former.

    The different variations you listed seem like they should cover this scenario if anything will work at all.  I would note that you should definitely be testing from the Portal itself as opposed to from the interface designer (at best, both would work, but at worst, the interface designer might give misleading behavior). Sorry if this part seems obvious but you haven't specified.

    Can you post the current state of your button code for, at least, the first bullet point?  I'd like to at least verify it looks like I was thinking it should look.

    And can you confirm also, if you leave the two functions designated as separate buttons, that it *does* correctly perform the behavior you're after, as long as you click the two buttons in the correct sequence?

  • /*If I pass the integration call in onSuccess part & submit:True for the button -> File uploaded in Appian & Integration not called*/

    buttons: {
    a!buttonWidget(
    label: "Button",
    style: "NORMAL",
    saveInto: {
    a!submitUploadedFiles(
    onSuccess: {
    a!save(local!submissionSuccessful, true),
    a!save(
    local!responseData,
    rule!File_Upload_Check(
    doc: local!file,
    doc_Type: "Test_Dummy"
    ).result.body.success
    )
    },
    onError: {
    a!save(local!submissionSuccessful, false),
    a!save(local!errorCode, fv!error)
    }
    )
    },
    submit: true,
    validationGroup: "Test"
    )
    }

    /*If I pass the integration call in onSuccess part & submit: True has been commented for the button -> File not uploaded & Appian Integration not called at all*/

    buttons: {
    a!buttonWidget(
    label: "Button",
    style: "NORMAL",
    saveInto: {
    a!submitUploadedFiles(
    onSuccess: {
    a!save(local!submissionSuccessful, true),
    a!save(
    local!responseData,
    rule!File_Upload_Check(
    doc: local!file,
    doc_Type: "Test_Dummy"
    ).result.body.success
    )
    },
    onError: {
    a!save(local!submissionSuccessful, false),
    a!save(local!errorCode, fv!error)
    }
    )
    },
    /*submit: true,*/
    validationGroup: "Test"
    )
    }

    /*If I pass the integration call in as 2nd saveinto part next to a!submitUploadedFiles function & submit:True for the button -> File not uploaded & Appian Integration not called*/

    buttons: {
    a!buttonWidget(
    label: "Button",
    style: "NORMAL",
    saveInto: {
    a!submitUploadedFiles(
    onSuccess: {
    a!save(local!submissionSuccessful, true)
    },
    onError: {
    a!save(local!submissionSuccessful, false),
    a!save(local!errorCode, fv!error)
    }
    ),
    a!save(
    local!responseData,
    rule!File_Upload_Check(doc: local!file, doc_Type: "Test_Dummy").result.body.success
    )
    },
    submit: true,
    validationGroup: "Test"
    )
    }

Reply
  • /*If I pass the integration call in onSuccess part & submit:True for the button -> File uploaded in Appian & Integration not called*/

    buttons: {
    a!buttonWidget(
    label: "Button",
    style: "NORMAL",
    saveInto: {
    a!submitUploadedFiles(
    onSuccess: {
    a!save(local!submissionSuccessful, true),
    a!save(
    local!responseData,
    rule!File_Upload_Check(
    doc: local!file,
    doc_Type: "Test_Dummy"
    ).result.body.success
    )
    },
    onError: {
    a!save(local!submissionSuccessful, false),
    a!save(local!errorCode, fv!error)
    }
    )
    },
    submit: true,
    validationGroup: "Test"
    )
    }

    /*If I pass the integration call in onSuccess part & submit: True has been commented for the button -> File not uploaded & Appian Integration not called at all*/

    buttons: {
    a!buttonWidget(
    label: "Button",
    style: "NORMAL",
    saveInto: {
    a!submitUploadedFiles(
    onSuccess: {
    a!save(local!submissionSuccessful, true),
    a!save(
    local!responseData,
    rule!File_Upload_Check(
    doc: local!file,
    doc_Type: "Test_Dummy"
    ).result.body.success
    )
    },
    onError: {
    a!save(local!submissionSuccessful, false),
    a!save(local!errorCode, fv!error)
    }
    )
    },
    /*submit: true,*/
    validationGroup: "Test"
    )
    }

    /*If I pass the integration call in as 2nd saveinto part next to a!submitUploadedFiles function & submit:True for the button -> File not uploaded & Appian Integration not called*/

    buttons: {
    a!buttonWidget(
    label: "Button",
    style: "NORMAL",
    saveInto: {
    a!submitUploadedFiles(
    onSuccess: {
    a!save(local!submissionSuccessful, true)
    },
    onError: {
    a!save(local!submissionSuccessful, false),
    a!save(local!errorCode, fv!error)
    }
    ),
    a!save(
    local!responseData,
    rule!File_Upload_Check(doc: local!file, doc_Type: "Test_Dummy").result.body.success
    )
    },
    submit: true,
    validationGroup: "Test"
    )
    }

Children
  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    Respectfully, I'd request you edit this comment and re-paste your code into a code box (make sure indentation is carried over - this works fine at least when you directly copy it from the interface designer); it's really hard to read otherwise.

  • /*If I pass the integration call in onSuccess part & submit:True for the button -> File uploaded in Appian & Integration not called*/
    buttons: {
      a!buttonWidget(
        label: "Button",
        style: "NORMAL",
        saveInto: {
          a!submitUploadedFiles(
            onSuccess: {
              a!save(local!submissionSuccessful, true),
              a!save(
                local!responseData,
                rule!File_Upload_Check(doc: local!file, doc_Type: "Test_Dummy").result.body.success
              )
            },
            onError: {
              a!save(local!submissionSuccessful, false),
              a!save(local!errorCode, fv!error)
            }
          )
        },
        submit: true,
        validationGroup: "Test"
      )
    }
    
    /*If I pass the integration call in onSuccess part & submit: True has been commented for the button -> File not uploaded & Appian Integration not called at all*/
    buttons: {
      a!buttonWidget(
        label: "Button",
        style: "NORMAL",
        saveInto: {
          a!submitUploadedFiles(
            onSuccess: {
              a!save(local!submissionSuccessful, true),
              a!save(
                local!responseData,
                rule!File_Upload_Check(doc: local!file, doc_Type: "Test_Dummy").result.body.success
              )
            },
            onError: {
              a!save(local!submissionSuccessful, false),
              a!save(local!errorCode, fv!error)
            }
          )
        },
        /*submit: true,*/
        validationGroup: "Test"
      )
    }
    
    /*If I pass the integration call in as 2nd saveinto part next to a!submitUploadedFiles function & submit:True for the button -> File not uploaded & Appian Integration not called*/
    buttons: {
      a!buttonWidget(
        label: "Button",
        style: "NORMAL",
        saveInto: {
          a!submitUploadedFiles(
            onSuccess: {
              a!save(local!submissionSuccessful, true)
            },
            onError: {
              a!save(local!submissionSuccessful, false),
              a!save(local!errorCode, fv!error)
            }
          ),
          a!save(
            local!responseData,
            rule!File_Upload_Check(doc: local!file, doc_Type: "Test_Dummy").result.body.success
          )
        },
        submit: true,
        validationGroup: "Test"
      )
    }

    Hi Mike - Thanks for your suggestion. Please find the code & let me know your thoughts

  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    i was more hoping you'd edit your original comment, but this works too i guess Stuck out tongue

  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    So i've recreated something similar in my CE site, and I can't get the form (When viewed as a portal) to call the integration correctly at all - I just get a generic message, "The system has encountered an Error".  This is even when trying to call the integration on a tiny document I pre-loaded into my filesystem and reference via a constant.  The same thing works fine when I try it from the Interface Designer.

  • Hi Mike - Thanks for your response. I made some changes and first button with "Submit: true" will save the doc in Appian & I used 2nd button to call the process model in which I configured the integration as smart service which worked Slight smile

  • 0
    Certified Lead Developer
    in reply to Vaithyanathan Raju

    That's a good idea.  Did you happen to try putting both of those functions in the same button?  I'm curious whether it'll work at this point.  I expect *something* along these lines should.