• Swarnalata Maruvad
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi,
I have a flow as an action on an SObject. This flow creates a child record for this record on another SObject with values prefilled from the calling record. Once this record is created, I need to display it in edit mode for user to enter more required fields. If user enters these and clicks 'Save' the record is saved. However, if the user clicks 'Cancel' the record created in flow needs to be delete.

I used Lightning component for displaying created record in edit mode, force:editRecord and I am trying to set a variable based on whether the user saves the record or cancels it. Based on this value which I am accessing in the Flow, I am either displaying a 'Saved' screen or deleting the created record and displaying a 'Cancelled' screen.

I am new to this and  have coded based on various examples I found online.

However, when executing, once the record is displayed for editing and the user either saves or cancels, control is not returning to the Flow. I am taken back to the original record which called the flow. Thus I am not able to delete the child record that was created in Flow when user chooses 'Cancel' Below is my code. I don't know what am I missing. Any help is most appreciated. Thanks!

Component
<aura:component implements="force:lightningQuickAction,lightning:availableForFlowActions" access="global">
    <aura:attribute name="recordId" type="string"/>
    <aura:attribute name="saveState" type="string" default="UNSAVED"/>
    <aura:handler name="onSaveSuccess" event="force:recordSaveSuccess" action="{!c.handleSaveSuccess}"/>
     <ui:button label="Save" press="{!c.save}"/>
    <ui:button label="Cancel" press="!c.cancel}"/>
</aura:component>

Controller
    invoke : function(component, event, helper) {
        //Get the record ID attribute
        var record = component.get("v.recordId");
        
        //Get the Lightning event that opens a record in new tab
        var redirect = $A.get("e.force:editRecord");
        
        //Pass the record ID to the event
        redirect.setParams({
            "recordId": record
        });
        //Open the record
       
        redirect.fire();
        
    },
    
    save : function(cmp, event, helper){
        //save the record
        component.find("edit").get("e.recordSave").fire();
        
    },
 
     handleSaveSuccess : function(cmp, event, helper){
        //Gets called once save is done 
        cmp.set("v.saveState","SAVED" );

    },
        
    cancel : function(cmp, event, helper){
        cmp.set("v.saveState", "CANCELLED") ;
    }
})


 
WARNING: Your dataflow definition contains errors that will cause your dataflow to fail. The dataflow definition validation failed for the MyFirstDataFlow dataflow. The dataflow can't have an empty list for parameter [right_select] in node [augment_Account_User].
Hello , File related list & attchment  related list is available in all the objects . But in Email message object only attachment related list is available .
My requirement in email Service is that I need to process attchment of incoming email as file .
So now I am able to attach email attchment to case object as a file using "Content Document" Object  and attchment is visible as file related list and attchment related list as well.
  BUt when it comes to attch incoming attchment to Email message , then Its not working .
Email message do not have file related list only attchment related list .
Can you please suggest anything ??