Skip to main content

#Lightning Aura Component0 人正在讨论

#Lightning Aura Component #Javascript

I have tried going on the LWC route but there is no functionality like overlay library.

I have solved this issue using $A.createcomponent. But I am facing a bug **while clicking the button for the second time**.

 

I am calling this inside the aura component I have put inside the Utility bar window.

 

<lightning:overlayLibrary aura:id="overlayLib"/>

There is a button inside utility window that triggers this js function:

 

openFlowOverlay: function (component, event, helper) {

$A.createComponent(

"lightning:flow",

{

"aura:id": "dynamicFlow",

},

function (newFlow, status, errorMessage) {

var overlayLib = component.find("overlayLib");

var flowName = "ABC_FLOW";

var flow = component.find("dynamicFlow");

if (status === "SUCCESS") {

var flowConfig = {

header: "ABC FLOW",

body: newFlow,

showCloseButton: true,

cssClass: "slds-modal_large",

closeCallback: function () {

}

};

overlayLib.showCustomModal(flowConfig)

.then(function(){

flow.startFlow(flowName);

});

} else {

console.error("Error creating Flow component: " + errorMessage);

}

}

);

}

 

When I open the utility bar and open it and click the button it's running fine. But when I close and try to click the button again I get this error.

 

So basically the component cannot find the flow in the DOM when it is running for# the second time.

 

Starting a screen flow inside an overlay modal that I am calling from utility bar using Aura

1 个回答
  1. 2023年9月21日 23:09

    What’s the reason you’re not using the standard utility bar flow functionality?

0/9000

Hello i have created an aura component and which i am calling it from opportunity action button

and using these for chatter

feedchatter aura component auto closing

 

forceChatter:publisher 

forceChatter:feed

The problem I'm encountering is that when I input text in the publisher and wait for 5 seconds, the modal closes on its own. Furthermore, even when I click on "Share," the modal also closes. How can I troubleshoot and resolve this issue?

 

Screenshot 2024-02-21 103714.png

 

#Salesforce  #Salesforce Developer  #Salesforce Admin  #Salesforce Developers  #Lightning Aura Component  #Chatter

1 个回答
0/9000

We have created a Lightning page 'Create_WW_Page' and added LWC to it.  

Another aura component after the creation of the record is redirected to the lightning page, below is the code.  

var navEvt = $A.get("e.force:navigateToURL");

navEvt.setParams({

                                "url": "/lightning/n/Create_WW_Page?c__eventRecordId="+EvtId,

 "isredirect": "true"

                            });

                            navEvt.fire();

The problem is that when we redirect to the URL for the first  EvtId (let's say 'A') it correctly initiates the LWC, but when we redirect it a second time for another EvtId(let's say 'B'), it will not initiate the LWC and show the data of previous EvtId 'A'.  so we need to refresh it manual to see data related to EvtId 'B'

How to have a refreshed lightning page every time we redirect from the aura component? 

 

#Trailhead Challenges  #Sales Cloud  #Salesforce Developer #Lightning Aura Component #LWC

1 个回答
  1. 2024年1月16日 14:24

    Hi @Megha Jain, Hope you are doing well.

    I am from the Trailhead help team. May I request you please let us know if this is part of any Trailhead module/project that you are working on so that we can understand better and can help you further.

    If this is related to any Trailhead badge, kindly share the URL of the Trailhead so that we can assist further.

    Kind Regards,

    Sathvika T

    Trailblazer Help.

0/9000

Hi,

 

I managed to add the action as URL but I opened in a new page, Also I`ve created an aura component but I cant add it to the list view, I want that the screen flow will be opened as a popup and not new page.

 

Any suggestions?

 

Thanks!

 

#Lightning Aura Component #Quick Actions #PopUps

6 个回答
0/9000

my requirment is if the account have custom field status is in 'completed and submitted 'status ,related contact objects standard action new button clicking display error'contact cannot be worked for this account

this requirment is on lwc component with apex class

i am using my soql query in account [select id ,status from account where id :=recordId]

but when i pass this recordId in my lwc js

connectedcallback()

{

getaccountdata(recordId:this.formId)

{

 

}

 facing this.formId as undefined

please anyone help me with code #TrailblazerCommunity #Integration #Flow #Trailhead Challenges@Trailblazer Community Cove

 

#Salesforce #LWC #Lightning Aura Component #Salesforcecommunity #Apex

1 个回答
  1. Eric Burté (DEVOTEAM) Forum Ambassador
    2023年11月13日 23:59

    Hello @sweta kumari, not sure to fully understand. 

    Have you tried to pass the recordId with :

    @api recordId;

    Eric

0/9000

Hello @Salesforce Developer

Here is my code. I want to preview image dynamically, but when I was passed the variable in my apex class they don't give any output. whenever I passed static id so its work for me.

so how can I do dynamically? without passing static id.

#Salesforce #Lightning Aura Component #Salesforce Developer

AURA COMPONENTI want to Preview image using dynamically

HELPERAURAHELPER.png

CONTROLLERAURACONTROLLER.png

APEX CLASS

 

AURAAPEX.png

1 个回答
0/9000

Non System Admins are having Component Error messages pop up for different reasons, all related to Aura. Here are example Error Messages:

  • Action failed: aura:iteration$controller$itemsChange [Invalid regular expression: /(.+?)(?:\:(\d+))?(?:\:(\d+))?$/: Stack overflow]
  • Action failed: aura:iteration$controller$itemsChange [Maximum call stack size exceeded]

Component descriptor is always "markup://aura:iteration"

 

The Non System Admins are also not able to launch an Aura Component from a Global Action. I read that during Salesforce Releases it is possible that permissions to Apex classes can be reset, but I tried to match the System Admin perms with the Non System Admin perms and couldn't find the discrepancy.

 

I have found similar posts however none seem to match this issue. Please link a thread if it already exists for this. I am not a developer, so if I need to post controller code, I will probably need someone to help me find it.

 

#Aura Error Message #Lightning Aura Component #Component Error

 

Can someone help me understand these Aura Component Errors?

 

Screenshot 2023-10-11 104615.png

2 个回答
0/9000
  • Have you ever had a scenario where you're overriding a standard button, such as the "New" button on an Opportunity, with an Aura component that invokes a screen Flow and passes the ID of the record type selected by the user, captured through the v.PageReference from the standard record type selection? I'm facing an issue where, when a user has only one record type available, there is no page reference to capture it from. It returns an error because the recordTypeId variable is null when the flow is initiated. 
    • My first idea is to get it from an ApexClass, do you have any other suggestion?
  • This same component, when initiated multiple times without refreshing the page (there is a closing button so it's intended capability), retains its variables. Consequently, the recordTypeId remains the same, causing our Flow not to follow its correct path within the decision node. 
    • For this we have tried the window.location.reload() strategy to refresh the page;
    • Also setting the inputVariables as null again inside the closing function mentioned didn't work.
3 个回答
  1. 2023年10月5日 22:14

    @Ali Khan Firstly, thank you for your response.

    As described in the post, we tried using window.location.reload(), but it didn't manage to close and reload the page as intended. Perhaps it is a code structure problem that resulted in this behavior.

    For the second point, we are already saving this variable. But as mentioned, it doesn't seem to be refreshing if we don't reload the page before a second execution. Our hypothesis is that this behavior is happening because our initiated Flow is not finishing properly.

     

    We have defined a button to destroy/close the Aura's modal, but it does not react to the finishing state of the flow.

0/9000

Checking Selection State of Aura and LWC Checkboxes and Radio Buttons

 

Summary

With the current trend towards encapsulating web components using shadowDOM, it has become quite complicated to automate tasks which were once rather straight forward.

 

The starting point for this document has been this post in the Test Automation Trailblazer Community group which describes the problem that Selenium’s WebElement.isSelected() call is not working any longer when automatically testing the Salesforce application. 

 

This document explains how to achieve this check for selection for Aura and Lightning Web Component Checkboxes and Radiobuttons.

 

The Problem

LWC

If you want to check if a LWC radio button has been selected, you are facing the problem that the differences in the DOM tree are minute and — even worse — not helpful at all in the traditional Selenium test automation style. Please see this screenshot where the highlighted DOM element is the “Yes” radio button one time in de-selected state (upper part) and one time in selected state (lower part):

Checking Selection State of Aura and LWC Checkboxes and Radio Buttons SummaryWith the current trend towards encapsulating web components using shadowDOM, it has become quite complicated to automate ta

Screenshot: DOM Tree Comparison  Can you spot the difference? The lower part has a <span> element with class attribute “slds-radio_faux” which contains the pseudo element “::after”. Trying to get this pseudo element via a locator does not work.  If you want to check this yourself, please use this link to get to this LWC Radio Group sample page

 

Aura

With Aura’s checkbox button component there is absolutely no visual difference in the DOM tree:

Screenshot 2021-10-18 at 17.05.36.png

Screenshot: Aura Component DOM Tree Snippet  If you want to check this yourself, please use this link to get to this Aura Checkbox sample page.

 

The Solution

In order to obtain proper locators for the solution to work, it is recommended to use the Chrome browser and install the 

LWC ShadowPath Generator extension.

 

Get the JavaScript Code for LWC

Please take the following steps:

  1. Open the example page 
  2. Make a right mouse click on the Sales radio button and select menu option Inspect. This will open the Console and take you to the <span> element with the label’s text.
  3. In the DOM tree go a little bit up and select the <input> element right above the <label> element containing the currently selected <span> element (see 1 in screenshot Chrome Console - Elements and LWC ShadowPath).
  4. Go to tab LWC ShadowPath (see 2 in screenshot Chrome Console - Elements and LWC ShadowPath).
  5. Get the string labeled "jspath" (see 3 in screenshot Chrome Console - Elements and LWC ShadowPath) without the enclosing double quotes.

Screenshot 2021-10-18 at 17.24.30.png

Screenshot: Chrome Console - Elements and LWC ShadowPath  To verify you got the right locator and can get the information, click on the tab Console and enter this command:

document.querySelector('lightning-radio-group').shadowRoot.querySelectorAll('input')[0].checked

 If you feel uneasy about the array index in the locator, please feel free to use a locator of your choice.  The JavaScript statement shown above should — depending on the state of selection — return true or false:

Screenshot 2021-10-18 at 17.34.27.png

Screenshot: Chrome Console - Console  

In this screenshot the radio button “Yes” was not selected.

 

Get the JavaScript Code for Aura

Very similar to the steps outlined above are those for Aura components.

  1. Open the example page
  2. Make a right mouse click on the Selected checkbox and select menu option Inspect. This will open the Console and take you to the <input> element with the label’s text (similar to 1 in screenshot Chrome Console - Elements and LWC ShadowPath).
  3. Go to tab LWC ShadowPath (see 2 in screenshot Chrome Console - Elements and LWC ShadowPath).
  4. Get the string labeled "jspath" (see 3 in screenshot Chrome Console - Elements and LWC ShadowPath) without the enclosing double quotes.

To verify you got the right locator and can get the information, click on the tab Console (see screenshot Chrome Console - Console).and enter this command:

document.querySelectorAll('input')[2].checked

 If you feel uneasy about the array index in the locator, please feel free to use a locator of your choice.  The JavaScript statement shown above should — depending on the state of selection — return true or false.

 

Using the JavaScript Code in Selenium

If you are jusing Java-based Selenium, then your test automation code should call either the method

In most cases the former will suffice.

// Get the JavascriptExecutor

JavascriptExecutor executor = (JavascriptExecutor) webDriver;

Boolean state = (Boolean) executor.executeScript(

"return document.querySelector('lightning-radio-group').shadowRoot.querySelectorAll('input')[0].checked");

For more flexibility it is recommended to put this piece of code into a method and parameterize the locator.

 

Acknowledgements

Many thanks to the two Test Automation Trailblazer Community community members 

who suggested this solution!

 

#LWC #LWC Component #Winter22Testing #Testing Automation #Selenium #Aura Lightning Components #Lightning Aura Component

0/9000

Flow embedded in Aura Component has been working fine for a couple of years. After the latest release we are getting the following error when user click on Next or Previous:

 

This page has an error. You might just need to refresh it. First, would you give us some details? (We're reporting this as error ID: -1649005042)

 

[this._target() is null] startPositioning()@https://xxx.lightning.force.com/components/lightning/tooltipLibrary.js:1:4463 t()@https://xxx.lightning.force.com/components/lightning/tooltipLibrary.js:1:3363

 

By the way, the flow works just fine outside the component. Also, the same component is exposed in a community (site) and it works as expected. This issue only happens for internal users.

 

Any idea? Thanks!

 

#Aura Component  #Aura Lightning Components  #Lightning Aura Component  #Screen Flow

3 个回答
  1. 2021年10月23日 04:05

    Hi - Thanks for the replies. I updated the description with more details.  

    The flow works just fine outside the component. Also, the same component is exposed in a community (site) and it works as expected. This issue only happens for internal users. 

0/9000