Quantcast
Channel: Active questions tagged lightning-experience - Salesforce Stack Exchange
Viewing all 3000 articles
Browse latest View live

Source of "Update Case" Quick Action in Lightning Experience

$
0
0

I am struggling to understand what a particular Action (or is it an Action?) is.

  1. It appears next to the Post, Poll, Ask a Question for Case object in the Lightning Experience and its label is Update Case.
  2. Its name is Case._LightningUpdateCase as can be seen from hover under Salesforce Mobile and Lightning Actions in the Case Page Layout editor.
  3. It is a Quick Action as I can see it to be one when I hover the mouse in the Page Layout Editor over that component.
  4. I can not from Case > Buttons, Links and Actions see ANYTHING with that Label or that Developer name.
  5. It, on being clicked, gives a nice form to update a case.

I will be grateful if someone helps me understand this.

Update Case button with other buttons

When Update Case button is clicked


Dynamic reference to static resource in lightning component

$
0
0

In lightning, we can reference to static resource by a value provider like:

<img src="{!$Resource.staticResource}"/>

Is there any smart way to make it dynamic like:

<aura:attribute name="resourceName" type="String" default="res"/>
<img src="{!$Resource.v.resourceName}"/>

For VF+Apex it was possible, but the documentation for Lightning does not say anything about that kind of possibility. Have anyone, by chance, found a smart way to do that ?

Thanks!

Unable to view aura component in lightning experience.Do I need to enable any setting to view components in Lightning Experience?

$
0
0

<p>Message of the day: {!v.message}</p>

<div>
    <lightning:button label="You look nice today."
        onclick="{!c.handleClick}"/>

    <lightning:button label="Today is going to be a great day!"
        onclick="{!c.handleClick}"/>
</div>

Below is the format I am able to see on clicking preview.

Above format is what I want to see(Trailhead Module image)

Mobile UI in iPad in Salesforce1

$
0
0

I just came to notice that in iPad devices, Salesforce1 app is reflecting the mobile design of the app!

I'm specifically asking it because, in the Chrome simulator, it's showing the table layout itself when Opportunity tab is taken.

PFB, the screenshots for reference.

  1. Salesforce1_PortraitView_1 | iPad :- Salesforce1_PortraitView_1
  2. Salesforce1_PortraitView_2 | iPad :- Salesforce1_PortraitView_2
  3. Salesforce1_LandscapeView_1 | iPad :- Salesforce1_LandscapeView_1
  4. Salesforce1_Chrome_Simulator_Portrait | iPad :- Salesforce1_Chrome_Simulator_Portrait
  5. Salesforce1_Chrome_Simulator_Landscape | iPad :- Salesforce1_Chrome_Simulator_Landscape

iOS 10.3.1 Salesforce1 v13.1 Build #3032251

Is this an issue or is it that they've updated the Salesforce1 design in iPad devices(and not being reflected in the simulator)?

Dynamically update Lightning path (Chevron)

$
0
0

My Lightning/Salesforce Path was displaying the Chevron based on the Case Pick list field which has 15 pick list options. Every Case is unique and doesn't require all the 15 options, how can I make my Chevron dynamic with limited options.

i.e Case 1 needs 5 pick list options out of 15 then I need to show only 5 options in 5 the chevron.

Value is not displaying in component. lightning

$
0
0

Hi iam getting value from event and is being handled by handlePassedAccAdd method. I want to display value in {!v.contact.MailingCity}" which is getting alert, but it is not getting displayed in component. I don't know where i am going wrong.

CMP

<aura:attribute name="contact" type="Contact" default="{ 'sobjectType': 'Contact' ,
                    'First Name': '',
                    'LastName': '',
                    'Phone':'',
                    'Email':'',
                    'MailingCountryCode':'US',
                    'MailingStreet':'',
                    'MailingCity':'',
                    'MailingStateCode':'',
                    'MailingPostalCode':''                                   
                                        }" />  
<aura:attribute name="acc" type="Account" default="{ 'sobjectType': 'Account' ,
                    'Name':'',                       
                    'Phone':'',
                    'Company_Email__c':'',
                    'BillingStreet':'',
                    'BillingCountryCode':'',
                    'BillingCity':'',
                    'BillingStateCode':'',
                    'BillingPostalCode':'' }" />

 <div class="slds-grid slds-grid slds-wrap slds-grid--pull-padded">

                    <div class="slds-large-size--2-of-5 slds-medium-size--5-of-12 slds-small-size--1-of-1" aura:id="dMCity">
                        <div class="slds-m-horizontal-large">
                            <div Style="margin-right:50px; margin-left:50px; margin-top:10px">
                                <label for="MCity">Mailing City</label>
                                <force:inputField aura:id="MCity" value="{!v.contact.MailingCity}" />

                            </div>
                        </div>

                    </div>

JS

 handlePassedAccAdd :  function(component, event, helper) {

    var accInfoAddr = event.getParam("acc");
    alert('^^^^^^^^^^acc^^^^^^^^^^' + JSON.stringify(accInfoAddr));

    var ContInfo = component.get("v.contact");

    component.get("v.acc"); 
    component.set("v.acc", accInfoAddr);

    var AccInfo1 = component.get("v.acc.BillingCity");
    // alert( component.get("v.acc.BillingCity"));
    ContInfo.BillingCity = component.get("v.acc.BillingCity");
    component.set("v.contact.MailingCity", ContInfo.BillingCity);

    var AccInfo2 = component.get("v.acc.BillingStreet");
    ContInfo.BillingStreet = component.get("v.acc.BillingStreet");
    component.set("v.contact.MailingStreet", ContInfo.BillingStreet);

    var AccInfo3 = component.get("v.acc.BillingCountryCode");
    ContInfo.BillingCountryCode = component.get("v.acc.BillingCountryCode");
    component.set("v.contact.MailingCountryCode", ContInfo.BillingCountryCode);

    var AccInfo4 = component.get("v.acc.BillingStateCode");
    ContInfo.BillingStateCode = component.get("v.acc.BillingStateCode");
    component.set("v.contact.MailingStateCode", ContInfo.BillingStateCode);

    var AccInfo5 = component.get("v.acc.BillingPostalCode");
    console.log('v.acc.BillingPostalCode' + component.get("v.acc.BillingPostalCode"));
    ContInfo.BillingPostalCode = component.get("v.acc.BillingPostalCode");
    component.set("v.contact.MailingPostalCode", ContInfo.BillingPostalCode);

  },

How to call helper method when we change any field?

$
0
0

I need to execute a helper method in lightning component whenever i change status field in record. Can anyone suggest me an idea how to call helper method when we update any record?

Is there a way to use lightning:fileUpload from a Visualforce Page?

$
0
0

I need to call a Lightning component which uses lightning:fileUpload to upload multiple files from a Visualforce Page.

But for calling a Lightning component from a Visualforce Page, I need to use a Lightning out App and Lightning out App doesn't support lightning:fileUpload.

Is there any way/workaround by which you can use lightning:fileUpload from a Visualforce Page?

LightningOutDemo.vfp

<apex:page standardController="Opportunity" extensions="LightningOutDemoCtrl">
<apex:includeLightning />

<div id="CardContainer">

</div>
<script>
    var Id = '{!$CurrentPage.parameters.Id}';
    console.log(Id);
    $Lightning.use("c:LightningComponentFromVFApp", function() {
        $Lightning.createComponent("c:NewFileUpload",
                                   { 
                                       recordId : Id
                                   },
                                   "CardContainer",
                                   function(cmp) {
                                       console.log('Component created');
                                   });
        });
</script>

LightningOutDemoCtrl.apxc

public class LightningOutDemoCtrl {

public Id recordId{get;set;}

public LightningOutDemoCtrl(ApexPages.StandardController stdcontroller){
  recordId = ApexPages.currentPage().getParameters().get('id');
  System.debug('Record Id is: '+recordId);
 }
}

LightningComponentFromVFApp.app

<aura:application access="GLOBAL" extends="ltng:outApp">
  <aura:dependency resource="c:NewFileUpload"/>
</aura:application>

NewFileUpload.cmp

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">

    This is New File Upload component.
    {!v.recordId}
    <aura:attribute name="recordId" type="Id"/>
    <lightning:fileUpload label="Upload File" multiple="true" recordId="{!v.recordId}" aura:id="multifileUpload" onuploadfinished="{!c.handleUploadFinished}" />

</aura:component>

NewFileUploadController.js

({
handleUploadFinished: function (cmp, event) {
    //Get the list of uploaded files
    debugger;
    var uploadedFiles = event.getParam("files");
    //Show success message – with no of files uploaded
    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
        "title": "Success!",
        "type" : "success",
        "message": uploadedFiles.length+" files uploaded successfully!"
    });
    toastEvent.fire();

    $A.get('e.force:refreshView').fire();

    //Close the action panel
    var dismissActionPanel = $A.get("e.force:closeQuickAction");
    dismissActionPanel.fire();
  }
})

The upload files button is visible but the files are not uploaded after selecting them.

Upload Files

Edit: There are commandButtons on another Visualforce Page(OpportunityDetailVF.vfp). On click of any of these buttons, I need to open Lightning multiple file upload.

For calling Lightning multiple file upload, I need a Visualforce Page(LightningOutDemo.vfp) which uses Lightning Out dependency to call the lightning component (NewFileUpload.cmp).

OpportunityDetailVF.vfp

<apex:page standardController="Opportunity" extensions="opportunityDetailCtrl">

    <apex:form >
     <apex:commandButton action="{!callVFPage}" value="Click Here"/>         
     </apex:form> 

</apex:page>

opportunityDetailCtrl.apxc

    public class opportunityDetailCtrl {

    public opportunityDetailCtrl(ApexPages.StandardController stdController){

    }
    public PageReference callVFPage(){

        PageReference pr = new PageReference('/apex/LightningOutDemo');
        return pr;
    }
}

How to use custom LWC lightning component in lightning-datatable

$
0
0

If we want to have custom lightning component in LWC lightning-datatable, for example Upload file for each of the records, how can we do that?

Report on where record is pending at in salesforce reports

$
0
0

I have approval process on Knowledge. When submitter submit knowledge record it is pending at approver. I want report where knowledge record is pending.

How to print Lightning icon?

$
0
0

We're having below markup in Lightning component.

<lightning:icon aura:id="statusIcon" iconName="action:check" size="xx-small"/>

When java-script is controller prints the page with this component, seems like it's omitting this icon.

window.print(); is used to print the page.

Is there a way I can get this icon on printed output? Appreciate any help. Thanks.

Inconsistent Scrolling Behaviour in Lightning Quick Actions

$
0
0

I have a lightning component I want to embed in a quick action. The component has content which might vary in size, which means I cannot predict what height my quick action needs.

As a simple example, here's my component which has content which is larger than the quick action box:

<aura:component implements="force:lightningQuickAction">
    <aura:iteration items="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15" var="item">
        <h1>{!item}</h1><br />
    </aura:iteration>
</aura:component>

This results in the content of the component spilling out of the bottom of the docked modal, without a scrollbar to access it

Overrunning content

However, if I expand the action by clicking the middle button at the top right, then it shows all my content

Expanded

And if the window is too small then it gets a scrollbar

Scrolling

To work around this, I can add a ui:scrollerWrapper with a hardcoded height to enable scrolling in the docked mode, but this results in double scrollbars depending on the viewport size and what size the scrollerWrapper is set to (in both Lightning Experience and Mobile):

Double Scroll Bars

To make this work better I can use css in a static resource to peek out into the Salesforce DOM to adjust my UI's behaviour, :

.forceDockingPanel.DOCKED .scrollerSize {
    height: 400px;
}

.forceDockingPanel.MAXIMIZED .scrollerSize {
    height: 100%;
}

<aura:component description="bigQuickAction" implements="force:lightningQuickAction">
    <ltng:require styles="{!$Resource.cssScroller}" />
    <ui:scrollerWrapper class="scrollerSize">
        <aura:iteration items="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15" var="item">
            <h1>{!item}</h1><br />
        </aura:iteration>
    </ui:scrollerWrapper>
</aura:component>

But this seems hacky as it's based on undocumented Salesforce components which might change. Is there a proper way to make the quick action respond to the size of its container correctly?

I also tried to use the utility bar APIs, but as you'd expect they don't appear to function outside of the utility bar.

Is there an URL-pattern in LEX similar to /apex/NameOfVisualForcePage?

$
0
0

In Aloha the URL /apex/NameOfVisualForcePage lets Salesforce show the VF-Page named "NameOfVisualForcePage"

Assume LEX = Lightning Experience and SPA = Single Page App

I know LEX is SPA, but that does not mean necessarily to banish URLs in general. All the part after the # could be used, like Salesforce itself does at some places:

  • /one/one.app#/setup/ApexClasses/home (e.g. setup-pages)
  • /one/one.app#/sObject/Account/home (e.g. record home)
  • /one/one.app#/sObject/0010Y00000AaNI4QAN/view (e.g. record view)

Why I need this?

I want to talk with team-mates about an particular UI located on one of many VF-tabs without communicating clickpaths.

What have I tried so far?

/one/one.app#/apex/NameOfVisualForcePage (does not work)

Is there anything else?

How to redirect to a newly created SObject record at the end of a flow?

$
0
0

I have been trying to follow the Salesforce documentation, but running into errors such as "We can't execute this action. Ask your admin to check that the "c:OpportunityFinish" Lightning component's client-side controller includes an "invoke" method"

below is what I have so far:

cmp:

<aura:component access="global" implements="lightning:availableForFlowActions">
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowData" onstatuschange="{!c.handleStatusChange}" />
</aura:component>

controller:

({
init : function (component) {
      // Find the component whose aura:id is "flowData"
      var flow = component.find("flowData");
      // In that component, start your flow. Reference the flow's Unique Name.
      flow.startFlow("CreateNextOpportunityFlowAction");
   },
handleStatusChange : function (component, event) {
   if(event.getParam("status") === "FINISHED") {
      var outputVariables = event.getParam("outputVariables");
      var outputVar;
      for(var i = 0; i < outputVariables.length; i++) {
         outputVar = outputVariables[i];
         if(outputVar.name === "newRecordId") {
            var urlEvent = $A.get("e.force:navigateToSObject");
            urlEvent.setParams({
               "recordId": outputVar.value,
               "isredirect": "true"
            });
            urlEvent.fire();
         }
      }
   }
}
})

When I have changed the "handleStatusChange" function to "invoke", it does run through without error, but it still does not redirect.

Send Survey Notification from Standalone Application

$
0
0

As per Winter 20 release, we can automate "Survey Invitations" from Process Builder. But there is one use case for me.

Is there any possibility to automate the same "Survey Invitations" from lightning component or standalone application?

I have tried one scenario like :-

I have created one Boolean custom field for object and updating that field from apex class. Then after making condition in process builder(When thesend_Survey_Notification__c = true) and calling the "Send Survey Notification" action. But not able to get the notifications.

Below is the code:-

public static CaseUpdateResponse updateCases(List cases) { for (CaseManager__c ct : cases) { if(ct.UserAction__c == 'Make Available'){ ct.send_Survey_Notification__c = true; } } update cases; }

Thanks, Ragav


How to create a custom rerender on a lightning component bundle?

$
0
0

I cannot find a good example that tackles this, I searched through google and find only the documentation in salesforce, although they suggest not to use it, i need this for my report, if you have a good working component that explains custom render(), afterRender(), rerender() and unRender() in a lightning component - i would love to study that. Thanks.

Salesforce Keyboard shortcuts

Expandable Section not working in Lightning

$
0
0

I'm trying to do an expandable section, but the collapse and expand buttons don't seem to be working:

<aura:component >
<div class="slds-section slds-is-open">
    <h3 class="slds-section__title slds-theme_shade">
        <button aria-controls="divContent" aria-expanded="true" class="slds-button slds-section__title-action">
            <lightning:icon aura:id="articleOne" iconName="utility:switch" size="xx-small" alternativeText="switch"/>
            <span class="slds-truncate" title="Section Title">Ponto de Venda</span>
        </button>
    </h3>
    <div class="slds-section__content" aria-hidden="false" id="divContent">
        <div class="slds-form slds-form_compound" style="width:40%;">
            <fieldset class="slds-form-element">
                <div class="slds-form-element__group">
                    <div class="slds-form-element__row">
                        <div class="slds-form-element slds-size_1-of-2">
                            <label class="slds-form-element__label" for="input-01">PDV</label>
                            <input type="text" id="input-01" class="slds-input" />
                        </div>
                    </div>
                </div>
            </fieldset>
        </div>
    </div>
</div>
</aura:component>

The link I have used for reference:

https://www.lightningdesignsystem.com/components/expandable-section/

How to map case and category while import articles in lightning knowledge using article import

$
0
0

In classic there are multiple article types. I have taken backup and need to import them again to lightning knowledge using article import tool. I am able to import articles using csv file and property file. Coming to rich text fields I have created html file.

Do I need to create as many html files if my csv file contain thousands of records for rich text fields??

How to map which case the article is attached and which category the article belongs during import articles into knowledge using article import tool??

force:navigateToComponent not loading component in Summer '17 | DOM repetition issue in Summer '17

$
0
0

I'm using force:navigateToComponent to navigate to a different component on click.
On the first click, it navigates to the component and everything is successfully loaded.
When pressing back button and being navigated to the inner component again, the inner component is not being loaded, although, all the data is being loaded.
This issue started when the org became Summer '17. This issue is not present in Winter '17 org.
And, locker service is active.

Additional findings:-

DOM is being repeated everytime back button is pressed and then navigated to the component using force:navigateToComponent in Summer '17 org. Also, the latest (or the last DOM) is not the one that is displayed. It varies. Sometimes, second or the first DOM element is being displayed in the front end.

For example:-

Say there's a div with class "outer-wrapper" in the inner component(the one which is navigated to). So, in the first navigation, document.getElementsByClassName('outer-wrapper').length returns 1. When the back button is pressed and then navigating again to the inner component, document.getElementsByClassName('outer-wrapper').length becomes 2, 3 and maximum 4. It is not just that Salesforce does not handle the old DOM element, but also, it is not the latest (or the last DOM element) which is being displayed in the front end.

This issue came to light in Summer '17 org. It is not present in Spring '17. [Eventhough DOM repetition is there, the last DOM element is the one which is displayed in the front end.]

It would be great if anyone could suggest a workaround or confirm if this is an issue in the Summer '17 org.

Viewing all 3000 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>