Skip to main content

#Custom Lightning Component토론 중인 항목 0개

Hi All,

 

I have a custom lightning component being hosted in a community page.

I was wondering if it would be possible to catch the browser windows close event (beforeUnload) in a lightning component?

This would be useful to both warn the end user and do some data clean up before closing the window.

 

My question is similar to the question being discussed on this topic: https://salesforce.stackexchange.com/questions/244204/does-beforeunload-event-work-in-lightning

 

Thank you for your assistance.

Tiago

댓글 3개
0/9000

Hi All,

 

I am trying to reduce the amount information visible on my pages and what to try and update my alert notification lightning component from showing multiple with different message but 1 alert banner that displays different information based on the Account ID, here is example of my attempt to use IF statement, but clearly not working;

 

<aura:component implements="flexipage:availableForAllPageTypes" access="global" >

 

    <aura:if isTrue="{!v.Account.ID = '0010C00000DbnUSQAZ'}">

    <div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_warning" role="alert">

         

        <lightning:icon iconName="utility:warning" size="small" class="icn"/>

     

        <div class="slds-p-left_medium"></div>

        <strong>

            <div class="slds-text-heading_medium"><p style="font-weight:bold;"> Test1 </p></div>

        </strong>

        <div class="slds-p-right_medium"></div>

        

       <lightning:icon iconName="utility:clock" size="small" class="icn"/>

            

    </div>

    </aura:if>

   

        <aura:if isTrue="{!v.Account.ID = '0010C00000DbnUcQAJ'}">

        <div class="slds-notify slds-notify_alert slds-theme_alert-texture slds-theme_warning" role="alert">

         

        <lightning:icon iconName="utility:warning" size="small" class="icn"/>

     

        <div class="slds-p-left_medium"></div>

        <strong>

            <div class="slds-text-heading_medium"><p style="font-weight:bold;"> Test2 </p></div>

        </strong>

        <div class="slds-p-right_medium"></div>

        

       <lightning:icon iconName="utility:clock" size="small" class="icn"/>

            

    </div>

    </aura:if>

 

</aura:component>

 

What I want is for an alert that has a single purpose that will dynamically change its message based on the Account ID or Name so I add/remove new one to it to display for very specific accounts and reduce the amount of notification that I have to deal with when editing/creating new pages.

 

Thanks

댓글 1개
  1. Eric Smith (Retired) Forum Ambassador
    2020년 9월 3일 오후 12:35

    You could add a Custom Field to the Account object for Alert Text. Then have your component check to see if that field is not empty and display the alert.

    Another option would be to create a Flow that you add to the Record Page that checks for a value in the Alert field and displays a Toast Message (

    https://unofficialsf.com/show-toast-flow-action/) if needed. #LCAnswers
0/9000

Salesforce Flows | Address Verification & Auto-Completion Component!

We've received a number of requests to build an enhanced address entry component for Salesforce Flows into our managed package "AddressTools" - I thought I'd share it with this group as we've found that it's a highly requested feature within our existing user base. I've written an article going over it in more detail. 

https://www.provenworks.com/blog/post.php?s=2020-07-29-address-verification-in-salesforce-flow-screens-for-auto-completing-addresses

0/9000

Hi Team,

 

We have a custom lightning component(aura) in our application to create a new record in custom object A, this object having lookup relationship with another custom object B.

 

Before summer'20 release our users go to the component and create new record in object A, and in the lookup they search and map B object records using lookup. if the records are not available in object B, they were able to create it using quick create option. 

 

But after summer'20 release, this quick create option is not visible when you search records in lookup field in our custom component.

 

So is there any changes happened in aura components with regards to quick create option.

 

Show quick create - option is enabled in setup - user interface settings.

댓글 2개
0/9000

Hello everyone!

I need help with a problem that I have. 

I have two sandbox with the same lightning component and the same code,I compare with clickdeploy.io, BUT, In one sandbox is working fine when doInit initialize, but in the other sandbox is not working. There are two components related, the parent component and the child. The parent component doInit method is working fine, but the child component is not working, It doesn't even run the doInit of the child component. This causes the functionality does not load correctly. The strange thing is that in one sandbox it works correctly but in the other it doesn't, even though it has the same code and components.

 

Code of sandbox 1

 

Cmp

 

<aura:component implements="lightning:actionOverride,force:lightningQuickAction,force:hasRecordId,flexipage:availableForAllPageTypes" controller="OM_ActionPlanTemplateCreationController">

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 

    <aura:attribute name="taskdependencyList" type="String[]"/>

    <aura:attribute name="TemplateID" type="String"/>

    <aura:attribute name="aptwrapper" type="OM_APT_TaskTemplate__c[]" />   

    <aura:attribute name="apt" type="OM_Action_Plan_Template__c" default="{'sobject':'OM_Action_Plan_Template__c'}"/> 

    <aura:handler name="deleteRowEvent" event="c:OM_DeleteRowEvent" action="{!c.removeRows}"/>

 

...... More code

 

                        <tbody>

                            <aura:iteration items="{!v.aptwrapper}" var="item" indexVar="index">

                                <c:OM_APTRowItem Apt="{!item}" AptTemplate="{!v.aptwrapper}" rowIndex="{!index}" taskId="{!item.id}" TemplateID="{!v.TemplateID}"/>

                            </aura:iteration>                                           

                        </tbody>

 

Code of sandbox 2

 

<aura:component implements="lightning:actionOverride,force:lightningQuickAction,force:hasRecordId,flexipage:availableForAllPageTypes" controller="OM_ActionPlanTemplateCreationController">

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> 

    <aura:attribute name="taskdependencyList" type="String[]"/>

    <aura:attribute name="TemplateID" type="String"/>

    <aura:attribute name="aptwrapper" type="OM_APT_TaskTemplate__c[]" />   

    <aura:attribute name="apt" type="OM_Action_Plan_Template__c" default="{'sobject':'OM_Action_Plan_Template__c'}"/> 

    <aura:handler name="deleteRowEvent" event="c:OM_DeleteRowEvent" action="{!c.removeRows}"/>

    

...... More code

 

                        <tbody>

                            <aura:iteration items="{!v.aptwrapper}" var="item" indexVar="index">

                                <c:OM_APTRowItem Apt="{!item}" AptTemplate="{!v.aptwrapper}" rowIndex="{!index}" taskId="{!item.id}" TemplateID="{!v.TemplateID}"/>

                            </aura:iteration>                                           

                        </tbody>

 

The problem is when aura:iteration call other component, in the sandbox 2 does not load and sandbox 1 does load. If someone has happened I appreciate the support or if you have any idea how to solve this problem.

 

I am attaching the screenshot of each sandbox.

 

Thank you

0/9000

I am trying to open a group page from a custom lightning component in a customer community that I am building and the the chatter for that group is empty. Researched and found that this is a know issue (link below) in Salesforce. Is there a workaround for this issue that people have implemented ?

Chatter renders empty

0/9000

Hi- I am trying to use a custom svg icon in lightning component with Workspace API. I have to use the Icon in setTabIcon of workspace API. According to the documentation it accepts the "SLDS Icon Keys", so does that mean we cannot use custom icons from static resource. And if it is possible to use icons from static resource in Javascript then please let me know how.

 

This is what I am trying to achieve:  

workspaceAPI.setTabIcon({ tabId: focusedTabId, icon: "Icon from Static Resource" });

댓글 1개
0/9000
1076003404 님이 * Experience Cloud *에 글을 올렸습니다

Does anyone try to track the number of clicks in button (which is a custom lightning component) using google analytics?

 

We are using google analytics but it can only track page views.

댓글 2개
  1. 2019년 10월 24일 오후 4:07
    Laurel is correct. You can use Google Analytics to add event tracking on your buttons directly. Or if you use Google Tag Manager you can set up event tracking on all button clicks, assigning them a name and even a conversion value if you want. Here's a resource: https://salesforce.stackexchange.com/questions/189862/how-to-use-google-analytics-for-lightning-component-controls-events

    It's not exactly what you're looking for but it points to the right direction. I recommend tracking them as events and not pageviews though.

0/9000

We have a custom lightning component where a user would choose one of 5 objects. Then there is a search box where the user searches for the records and can add multiple records. while displaying multiple records from search result we are using lightning recordview control because we want to show compact layout on the search. results are retrieved. we can able to save form but getting below warning message. 

This page has an error. You might just need to refresh it. [PromiseRejection: [Assert Violation: [object:vm undefined (505)] must be inserted.]]. This seems to be known issue if there is a huge data across the object

@Charles Cummings 

0/9000
Charles Cummings (Self) 님이 * Lightning Now! *에 글을 올렸습니다

We are trying to use some of the standard LEX functionality for a Custom Dynamic Lightning Component. 

 

We have a custom lightning component where a user would choose one of 5 objects. Then there is a search box where the user searches for the records and can add multiple records (similar to how adding Campaign Members in LEX is, except that the user can choose multiple objects). We want to search options to display the Compact Layout values for each record (just like it would in standard LEX). Has someone figured out how to do this?

댓글 7개
0/9000