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
Rajat Mahajan 28Rajat Mahajan 28 

Passing attributes to a dynamically created component not working in NAMESPACE org

Hi All,

I cam across a scenario while making my functionality in lightning a managed package. 

Before having a namespace, my functionality was wrking fine where I was able to receive the attributes from another component in the init method perfectly fine when the component was dynamically created. 

this attributes stopped coming in child when I create a namespace

Any clues ?
 
GhanshyamChoudhariGhanshyamChoudhari
Hi,
By default, all org uses 'c' namespace but 
once you created a namespace you need to make some changes like if you are referring child component instead of 
<c:childcmp/>
you need to change into 
<namespace:childcmp/>

referring below article for more details https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/namespace_using_reference.htm#namespace_using_reference

Mark as best answer if it helps you.
Thanks,
Ghanshyam Choudhari
Rajat Mahajan 28Rajat Mahajan 28

Hi Ghyanshyam
 

Thanks for replying, but , that is not my issue, its the attributes that are not getting passed.

Take example:

THIS BELOW IS WRITTEN IN THE HELPER OF MY PARENT COMPONENT
 $A.createComponent(
                            <NAMESPACE>:testcomponent, 
                            {
                                "registeredSystem" : registeredSystem,
                                "messages" : component.get("v.messages"),
                                "accountId" : component.get("v.accountId"),
                                "acc" : component.get("v.account")
                            }, 
                            function (contentComponent, status, error) {
                                if (status === "SUCCESS") { 
                                    target.set('v.body', contentComponent);
                                } else {
                                    throw new Error(error);
                                }
                            }
                        );     

IN THE CHILD COMPONENT THE ATTRIBUTES WERE GETTING FILLED WHEN NAMESAPCE WAS NOT THERE IN THE ORG, HOWEVER, NOW WHEN I DO 
component.get("v.registeredSystem"); in the init method of the child component it does not work, comes as undefined

Please note - the attributes are perfectly declared in child component and were working when managed package namespace was not there

Kewal JaipuriaKewal Jaipuria
Hi Rajat,

Did you find any solution to the issue?

-BR, KJ