1

Is there any way to direct read the param from the community URL.

For example I have a custom page with URL like https://abc.com/s/testing?testingAttribute=abc and I want to get the passed testingAttribute attribute and pass the same to the flow added in that community page.

Using lightning:isUrlAddressable I can set the value : var pageReference = { type: 'type to do', attributes: { componentName: 'c__helloTarget', }, state: { "c__firstname": "John" } }; component.set("v.pageReference", pageReference);

and get the same in other component like `var myPageRef = cmp.get("v.pageReference");

However when i am trying to access the values directly Its not working.On the JS side I am using like this :

({
    init : function (component) {

        // Find the component whose aura:id is "flowId"
        var flow = component.find("flowId");
        // In that component, start your flow. Reference the flow's Unique Name.
        flow.startFlow("flowname");
       console.log(component.get("v.pageReference").state.testAttribute);

    },

Getting the below error on running : A cookie associated with a cross-site resource at https://2o7.net/ was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.

2

You can use design time attributes to bind the query string parameters to your component. Define these in your component's .design file.

<design:component>
    <design:attribute name="myAttribute" default="{!myAttribute}" description="Automatically bind the url parameter to the component variable" />
</design:component>

You will need a corresponding attribute in your component's .cmp file.

<aura:component implements="forceCommunity:availableForAllPageTypes">
    <aura:attribute name="myAttribute" type="String" access="global" />

    {!v.myAttribute}
</aura:component>

Important: You must remove and re-add your component onto the community page, then publish the site for new attributes to take effects.

| improve this answer | |
  • Need to have attribute marked as global – AvengerSF Mar 19 at 1:45
  • Thanks @sdfc-neta. Have updated the answer with the global modifier. – akiradev Mar 19 at 9:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.