4

I have the issue but cannot understand what is wrong, hope you will help me here.

There is the community with custom lightning Register component. When you fill some basic info about the user you press Next button that dynamically creates the custom lightning component to fill info about the account.

As I was told, it worked before the Spring 19 release, but the sandbox was updated 3 days ago and it does not work now and $A.createComponent throws an error with Id 1703989902-32917 (1257401656). However, it does work in the lightning app. The component is being created there.

Here is the code that creates a component:

//a lot of messy code before
var action = component.get("c.validateCustomer");
    action.setParams({email:email});
    action.setCallback(this, function(a) {
        var rtnValue = a.getReturnValue();         
            $A.createComponent(
                "c:StandardFMS_CompanyRegistration",
                 {
                    "Email" : email,
                    "FirstName":component.find("firstname").get("v.value"),
                    "LastName":component.find("lastname").get("v.value"),
                    "Gender":component.find("gender").get("v.value"),
                    "selfLoginUrl":loginUrl
                 },
                 function(newCmp, status, errorMessage) {
                    console.log('Dynamic');
                    if (status === "SUCCESS") {
                       console.log('cmp >>> ' + newCmp);
                    } else if (status === "INCOMPLETE") {
                       console.log("No response from server or client is offline.")              
                    } else if (status === "ERROR") {
                       console.log("Error: " + errorMessage);
                    }
                    var cmp = component.find("unsuccessfulAttempt");
                    cmp.set("v.body", []);
                    cmp.set("v.body", newCmp);
                }
             );                            

        });
        $A.enqueueAction(action);

The method from Apex controller returns null, that is ok. As I mentioned, it throws an error in the community but works normally in the lightning app.

Here is the short markup of the created component:

<aura:component controller="StandardFMS_CustomerCreationController">
<aura:attribute name="Email" type="String" default="" access="global"/>
<aura:attribute name="FirstName" type="String" default="" access="global"/>
<aura:attribute name="LastName" type="String" default="" access="global"/>
<aura:attribute name="Gender" type="String" default="" access="global"/>
<aura:attribute name="selfLoginUrl" type="String" required="false" default="/"/>
//a lot of messy code after

I tried to add forceCommunity:availableForAllPageTypes and access attribute to the component, but it did not help. Any help would be appreciated.

  • 1
    Have you tried reaching out to support to confirm if this is a known issue? – Jayant Das Jan 9 at 14:45
  • @JayantDas, yes they escalated this to the development team, but there is no feedback yet. – m_konyk Jan 9 at 14:49
  • 1
    I've seen several comments on Twitter about Spring 19 breaking permissions for community users - might be a place to look for changes in the absence of anything else changing? – BritishBoyinDC Jan 9 at 18:18
  • @BritishBoyinDC, I have looked already. Nothing there...will wait for the answer from sfdc dev team. – m_konyk Jan 10 at 7:31
  • 1
    I am working with a community and my $A.createComponent methods work great also with the new Spring 19 release. Maybe try with a very small new custom component - see if this is a problem specific to this problematic one – Itai Shmida Jan 10 at 8:55
0

After some investigation I found the error.

There is an attribute of type Account in the component that is being created dynamically.

Init handler of that component calls Apex to get info about Account. Since there is no Read permission for Guest user on Account neither no isAccessible() validation for Account in Apex the lightning throws an unknown error with some Id.

As I was told it was working before Spring 19 release, perhaps the release reset Guest profile settings. But I do not know for sure, because there is no VCS for that project. So, the issue is in the code which is poorly performed.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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