I'm using a simple lightning component to upload a file to a record.

I would like for the file to uploaded with a certain custom field set. (ie. on upload, set "File Status" to "Signed" - this would be a custom field within the Files object)

Is this possible? And if so, is it a tall task? I'm only moderately experiened with apex.

Would it be just a line or two I could pop into the existing code?


   <aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <aura:attribute name="recordId" type="Id" description="Record to which the files should be attached" />
            <lightning:fileUpload label="Add attachment"           multiple="true"          accept=".pdf, .png, .docx, .xlsx"          recordId="{!v.recordId}"            onuploadfinished="{!c.handleUploadFinished}"           />



    handleUploadFinished : function(component, event, helper) {

        // Get the list of uploaded files
        var uploadedFiles = event.getParam("files");

         var toastEvent = $A.get("e.force:showToast");
        "title": "Success!",
        "message": "File "+uploadedFiles[0].name+" Uploaded successfully."


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.