Skip to main content
Nintex Community Menu Bar

There are many posts about this, but they’re all pretty old and the architecture has shifted around quite a few times.

Pretty simple request with a lot of complexity underneath: I want an unauthenticated user to be able to create a custom object record, and then upload a file related to that record.

I’m trying to do this in a Lightning Aura Exp Cloud site (if I’m not mistaken, LWR is not yet supported).

I’ve got Skuid showing up and the fields in a form. File Upload is rendering - the only configuration that works is Content Document with no model selected. I cannot seem to figure out how to relate it to the record that’s being created.

I tried having the File Upload component inject a custom file name or description, which could then theoretically be used by a Flow or Apex to go find and then relate the two records on the backend, with system context. But no dice yet - the custom values do not get saved on the file in Salesforce.

It looks like this is a problem for folks even in Flow. From what I can tell, if I can get the ContentVersion Id from the uploaded file, and then create another record that includes that ContentVersionId and the record Id of the custom object that’s created, we could then use Apex or Flow to associate them after the fact.

https://salesforce.stackexchange.com/questions/396284/guest-user-unable-to-upload-file-from-flow


Follow-up question: is there a way to get the record Id of the ContentDocument record that gets created as a result of the File Upload?

I’m sure there’s an API response from Salesforce somewhere that could be exposed; if I can store the returned ContactDocument Id on a field in the new custom object record, then Flow or Apex can take care of the rest, server-side.


Hey,

My dev has accomplished a similar request, by using a VF page and iframing it on site

VF Page: 
 

<apex:page showHeader="false" sidebar="false" standardController="your_object__c">    <apex:includeLightning />    <!--Lightning Container-->    <div style="width:100%;height:100px;" id="LightningContainer"/>    <script type="text/javascript">    //get account Id from URL    var recordId = "{!$CurrentPage.parameters.id}";         //Create Lightning Component UploadFileVfpage    $Lightning.use("c:sampleAuraFromVF", function() {        $Lightning.createComponent("c:uploadFileComponent",                                    { "parentID" : recordId }, //Pass Parameter                                   "LightningContainer", function(component) {                                       console.log('Component created');                                   });    });    </script></apex:page>


then on a template field:
<iframe src="/apex/c__UploadFileVfpage?Id={{{Id}}}&isdtp=vw" width="100%" height="140px" frameborder="0"/>


Dang. Ok. Welp, good to know. Thanks David!


Alright, so I’d rather *not* do an iframed VF page - kudos to y’all for making it work, but I’d really like to keep this as code-lite as possible, and we’re already in an Aura site - meaning that this would be a Lightning component inside a VF page inside an iframe inside a Lightning Aura site. 

Main question for the Nintex folks is this - the File Upload component is “using” the Lightning File Upload, which presumably makes a POST call to Salesforce to create a ContentDocument record. Is there any way to capture the response from that POST call, which I believe would include the new ContentDocument record’s Id? Then we could include that in the form data, which could then be used to run a Flow server-side to associate the custom object record and the new ContentDocument file.


Reply