function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jonathan Wolff 7Jonathan Wolff 7 

Get Id from URL into aura component

Hi, I have a Site with the URL of this form:
https//: MySite.com/FSR/s/?RecordID=0027a00003JsuTW

I also have a custom flow component within the Site which creates a rich text field. I would like to use the ID from the URL into the Component. I pass the RecordID with an email so its not possible to just query it. Could you tell me how to change my code to get the Id from the URL?

My custom flow component:
 
<aura:component implements="lightning:availableForFlowScreens,force:hasRecordId, force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="label" type="String" access="global" />
     <aura:attribute name="value" type="String" access="global" />
     <aura:attribute name="required" type="Boolean" access="global" />
     <aura:attribute name="placeHolder" type="String" access="global" />
    
    <aura:handler name="init" value="{!this}" action="{! c.doInit }" />
    
    <aura:attribute name="validate" type="Aura.Action" />
    
    <lightning:inputRichText value="{!v.value}"
                             required="{!v.required}"
                             placeHolder="{!v.placeHolder}"
                             labelVisible="true"
                             variant="bottom-toolbar"
                             label="{!v.label}">
        <lightning:insertImageButton/>
    </lightning:inputRichText>
</aura:component>

Controller
({
    doInit: function(component, event, helper) {
        component.get("v.recordId");
      
       component.set('v.validate', function() {
           var userInput = component.get('v.value');
           if(userInput) {
               return { isValid: true };
           } else if(!userInput &&  component.get("v.required")){
                     
                      return { isValid: false, errorMessage: 'A value is required.' };
       }else{
                     return{ isValid: true};
                     }
              
           });
	}
})