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

Redirection is not working in lightning

$
0
0

I have overridden standard new button with a Visualforce page, after clicking save from that visualforce page, its redirecting to the standard edit page and on save from the standard edit page it should redirect to detail page of that record.

For Salesforce classic, its working as expected but in lightning experience, from standard edit page its not redirecting to detail page of that record.

On save I am calling controller's method and setting the redirectURL to standard edit URL and oncomplete using handleRedirect() function

<apex:commandButton action="{!save}" oncomplete="handleRedirect();" value="Save and Continue" rerender="pgMsg"/>

function handleRedirect() {
    var redirectURL = '{!redirectURL}';
    if (redirectURL != null && redirectURL != '') {
        if ((typeof sforce != 'undefined') && (sforce != null)) {
            sforce.one.navigateToURL(redirectURL);
        } else {
            window.location.href = redirectURL;
        }
    }
}

Cannot click on button in Lightning but OK in Classic

$
0
0

I'm currently in the middle of a migration from classic and lightning but have an issue. I have a calendar, with 3 buttons to have the week, month or day view Please see the calendar below : : enter image description here

The 3 buttons works in classic, but I cannot click on the buttons that are not chosen by default in lightning. Here is my code:

 function loadCalendar()
{
    var st = null;
    $('#calendar').fullCalendar({

        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        editable: true,
        droppable: true,
        disableDragging: true,
        defaultView: 'agendaWeek',
        minTime: "06:00:00",
        maxTime: "23:59:00",
        height:670,
        width:900,
        lang: 'fr',
        events: [ <apex:repeat value="{!events}" var="e">
                 {
                 id: '{!e.eventId}',
                 title: "{!e.eventTitle}",
                 start: '{!e.eventStart}',
                 end: '{!e.eventEnd}',
                 url: '{!e.url}',
                 allDay: {!e.allDay
                 }
                 }, </apex:repeat>
                ],
        drop: function(date, start, end, moment) {
            //alert(moment.format());
            // alert("Dropped on " + date.format()+ $(this).attr("data-id"));
            createEvent($(this).attr("data-id"), date.format());
        },
        eventDrop: function(event, delta, revertFunc) {
            if (!confirm("Are you sure about this change?")) {
                revertFunc();
            }
            setEvnt(event.id, event.start.format(), event.end.format());
        },
        eventMouseover: function(calEvent, jsEvent) {
            var tooltip = '<div class="tooltipevent" style="width:100px;height:100px;background:#ccc;color:black;position:absolute;z-index:10001;">' + calEvent.title + '</div>';
            $("body").append(tooltip);
            $(this).mouseover(function(e) {
                $(this).css('z-index', 10000);
                $('.tooltipevent').fadeIn('500');
                $('.tooltipevent').fadeTo('10', 1.9);
            }).mousemove(function(e) {
                $('.tooltipevent').css('top', e.pageY + 10);
                $('.tooltipevent').css('left', e.pageX + 20);
            });
        }
    });
}

Did I miss something ?

LWC lightning-card border not shown with slds-card_boundary

$
0
0

Playground example https://developer.salesforce.com/docs/component-library/tools/playground/KLHs3GU9

I have a Lightning Web Component template with a lightning-card in an App Page.

<template>
    <lightning-card title="parent"></lightning-card>
</template>

I would like to nest more cards into it to simulate the related list look and feel from standard Lightning experience.

<template>
    <lightning-card title="parent">
        <lightning-card title="child></lightning-card>    
    </lightning-card>
</template>

This renders the child without borders, filling the entire width of the parent.

If I add the slds-card_boundary class to the child, it draws a misplaced vertical border fragment above and below the card.

However, if I add the slds-card_boundary class to the article element spawned by the child lightning-card component, the border is correctly drawn around the entire card. Adding a slds-m-around_small to article element also forces a separation between parent and child cards.

What layout concepts am I missing with Lightning Web Components to be able to successfully use lightning-card components?

In general, how can lightning-cards be used inside Lightning Web Components to achieve a related list-like appearance?

Hide Standard Page Header in Custom Lightning App page

$
0
0

Is there a way to hide the page header in a custom Lightning App shown below ? This banner is not available in the Edit page section.

I have selected 'One region Template' and added just one Lightning component.

enter image description here

But after saving the header comes by default which I want to remove.

enter image description here

PS: I was able to remove the header by putting the display as none as shown below. But don't know which standard class to refer in css

enter image description here

on clicking any pencil icons to update the record, the currency data fields that are in SEK change to SGD

$
0
0

on clicking any pencil icons to update the record, the currency data fields that are in SEK change to SGD (User's local currency). On saving the records the currency changes back to SEK. This should not be happen. Edit layout should also show the same currency as on detail layout.

Detail Page

enter image description here

Component Visibility in Flow's Screen with Number data type

$
0
0

I'm trying to set up a filter to manage a component visibility in a flow's screen component. In particular, I want the field to be available to the user for the insert of data only when a particular field's value is equal to 50.

For this purpose, I have created in the flow a Number variable named "CodiceFase", and I have assigned to it the value retrieved from the field of interest, thanks to the record Id (I check the correctness of the assignment with a Display Text component in the same screen).

Nevertheless, when I launch the flow the field is never visible, even if CodiceFase is correctly set to 50. If instead I use a Text variable in the condition for the component visibility, for example using another field's value to perform a similar check, everithing works as intended (I have checked the option "Enable Lightning runtime for flows" in Setup -> Process Automation).

Even stranger, the very same condition "{!CodiceFase} Equals [an integer number]" works perfectly in a previous Decision component of the flow.

For this reason I think the problem could lie somehow in the fact that I'm using a Number variable in the condition, but I am unable to figure out what I'm doing wrong.

Flow's Screen component with the non-working condition

The same condition works perfectly in a previous flow's Decision component

The field of interest isn't shown during runtime even if the variable CodiceFase is correctly set to 50

Lightning Component not saving new data to sObject Data

$
0
0

I have a simple component that fetches a record and attempts to update it.

I am trying to update the "part count" and it shows that it's being updated client side and that the params are being sent to the database but it's not actually updating the record..

here is my code:

component:

<aura:attribute name="partInfo" type="Part_Inventory__c[]"/>

<form>
    <ui:inputText label="Enter Part #" aura:id="sInput"/>
    <lightning:button label="Search" onclick="{! c.searchPart }" />
</form>
Part Details:

<aura:iteration items="{!v.partInfo}" var="obj">
    <!-- Display names of all accounts -->
    Name: {!obj.Name}, Description: {!obj.Part_Description__c}, Count: {!obj.Part_Count__c}
    <ui:inputNumber label="{! 'Enter Count For Part:' +obj.Name}" value="{!obj.Part_Count__c}" aura:id="cInput"/>
    <lightning:button label="Enter Count" onclick="{! c.savePartCount }" />+
    Name: {!obj.Name}, Description: {!obj.Part_Description__c}, Count: {!obj.Part_Count__c}
</aura:iteration>

public with sharing class PartController {

@AuraEnabled
public static List<Part_Inventory__c> getPartInfo(String searchTerm){
           return [SELECT Name,Part_Description__c, Part_Count__c
            FROM Part_Inventory__c
            WHERE Part_Inventory__c.Name LIKE: searchTerm];
}


@AuraEnabled
public static Part_Inventory__c saveCount(Part_Inventory__c updatedPartCount){
        upsert updatedPartCount;
        return updatedPartCount;
}

}

({
searchPart : function(component, event, helper) {

    var searchFor=component.find("sInput");
    var searchValue=searchFor.get("v.value");
    var action= component.get("c.getPartInfo");
    action.setParams({"searchTerm": searchValue });

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            console.log(response.getReturnValue());
            component.set("v.partInfo", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);          
        }
    });
    $A.enqueueAction(action);


},
 savePartCount: function (component, event, helper){

     var action = component.get("c.saveCount");
     var myPartInfo = component.get("v.partInfo");

     console.log(myPartInfo);

     action.setParams({ "updatedPartCount": myPartInfo });
     action.setCallback(this, function() {  console.log('SAVED.');  } );
     $A.enqueueAction(action);
    }

})

Some screenshots: enter image description here

enter image description here

now I have attempted to update the count to 15 from 10 and this is what the console says: Note- When I go back into the object view, the value is still 10.

How to display a report in Lightning component

$
0
0

I need to display a report in a Lightning Component. But I am not able to see any information related to it.

I need to display a report as it is.

Previously, we used to write VF page code and use "iframe" tag. But, this also doesn't work now.

Please help me with this.


Record type selection on according to the field selected

$
0
0

We have an object (Object A) having 2 record types. Another Object(Object B) has two lookup fields of Object A. There are two record types of object A.

Whenever a user comes on any record and selects a record in any of these lookups, Salesforce standard functionality asks for the record type when he chose to select a new record on that screen.

We want to automate the selection based on the field from which it is being created. For instance, there are two fields Sales and Service (Lookup of Object A). Whenever the user selects Sales, the record type should be sales of object A and it should lead to the record create screen and similar should happen for Service.

How should I implement this requirement?

Hyperlink is not showing in lightning in trigger code but working for Classic

$
0
0

Here I'm just written code for finding a duplicate record and displaying link through the hyperlink but it's working fine in the classic but lighting it showing directly code. Please just check images hyperlinks that displaying in classic and lightning. Why ??

Please find Image for reference

enter image description here

Here it is not showing hyperlink properly

Code

Trigger.new[0].addError('ENTERED PARTNUMBER ALREADY EXISTS FOR THIS SUPPLIER PLEASE CHECK<a target="_blank" href=\'https://my.salesforce.com/'+stc.Id+'\'>VINOD</a>', false);

Salesforce lightning collapsable Issue by creating custom lightning component for Activity Timeline

$
0
0

I have created a activity timeline custom component also added a collapsible section in my component but when i am clicking on one section it is opening all the section same is happening at the time of closing... I am not able to fix this issue please help me to expand only one section at the time of clicking also for closing using lightning collapsible icon.

Apex Class -

public class ActivityTimeLineForEmailMessage {

      @AuraEnabled
        public static List < EmailMessage > getMessageDetail(String emailMessageId) {
         //     System.debug('emailMessageId' + emailMessageId);
            List<EmailMessage> MessageDetail = new List<EmailMessage>([select id, Subject, TextBody, FromAddress, ToAddress, RelatedToId, ParentId from EmailMessage where ParentId = :emailMessageId ]);
              return MessageDetail;
    }

}

Application :-

< aura:application extends="force:slds">
    < qwerty:ActivityTimeLineGrazitti /> 
  < /aura:application>

Component :

< aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,lightning:actionOverride" access="global" controller="ActivityTimeLineForEmailMessage">

      <aura:attribute name="EmailMsgs" type="EmailMessage[]" />
    <aura:attribute name="recordId" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <div class="demo-only" style="width:400px">     
       <ul class="slds-timeline">
           <aura:iteration var="oneMsg" items="{!v.EmailMsgs}">
         <li>
             <div class="slds-timeline__item_expandable slds-timeline__item_email slds-is-open">
                <span class="slds-assistive-text">email</span>
                  <div class="slds-media">
                    <div class="slds-media__figure">
                      <button class="slds-button slds-button_icon" title="Toggle details for Re: Mobile conversation on Monday with the new global team" aria-controls="email-item-narrow" aria-expanded="true" onclick="{!c.emailsection}">
                        <section class="slds-clearfix">
                            <div class="slds-float--left ">
                                <lightning:icon class="slds-show" aura:id="emaildetail" iconName="utility:add" size="x-small" alternativeText="Indicates add"/>
                                <lightning:icon class="slds-hide" aura:id="emaildetail" iconName="utility:dash" size="x-small" alternativeText="Indicates dash"/>
                            </div>
                        </section>
                      <span class="slds-assistive-text">Toggle details for Re: Mobile conversation on Monday with the new global team</span>
                      </button>
                    <div class="slds-icon_container slds-icon-standard-email slds-timeline__icon" title="email">
                        <lightning:icon iconName="action:email" size="x-small" alternativeText="Indicates mail sign"/>
                    </div>
                   </div>
          <div class="slds-media__body">
            <div class="slds-grid slds-grid_align-spread slds-timeline__trigger">
              <div class="slds-grid slds-grid_vertical-align-center slds-truncate_container_75 slds-no-space">
                  <h3 class="slds-truncate" title="Subject of Send/Receive mail">
                       <a href="javascript:void(0);">
                           <strong> {!oneMsg.Subject} </strong>
                       </a>
                  </h3>
                  <div class="slds-no-flex">
                     <span class="slds-icon_container slds-icon-utility-groups" title="Group email">
                        <lightning:icon class="icongreen" iconName="utility:arrowup"/>
                        <span class="slds-assistive-text">Group email</span>
                     </span>

                  </div>
              </div>
              <div class="slds-timeline__actions slds-timeline__actions_inline">
                      <p class="slds-timeline__date">
                            <lightning:formattedDateTime value="{!oneMsg.MessageDate}" year="numeric" month="numeric" day="numeric" hour="2-digit" minute="2-digit" timeZoneName="short" />
                      </p>
              </div>
           </div>
            <p class="slds-m-horizontal_xx-small">
              <a href="javascript:void(0);">You</a> emailed
              <a href="javascript:void(0);">{!oneMsg.ToAddress}</a>
            </p>
            <article class="slds-box slds-timeline__item_details slds-theme_shade slds-m-top_x-small slds-m-horizontal_xx-small slds-p-around_medium" aura:id="emaildetail" id="email-item-narrow" aria-hidden="false">
              <ul class="slds-list_horizontal slds-wrap">
                <li class="slds-grid slds-grid_vertical slds-size_1-of-2 slds-p-bottom_small">
                  <span class="slds-text-title slds-p-bottom_x-small">From Address</span>
                  <span class="slds-text-body_medium slds-truncate" title="Jackie Dewar">
                    <a href="javascript:void(0);">{!oneMsg.FromAddress}</a>
                  </span>
                </li>
                <li class="slds-grid slds-grid_vertical slds-size_1-of-2 slds-p-bottom_small">
                  <span class="slds-text-title slds-p-bottom_x-small">To Address</span>
                  <span class="slds-text-body_medium slds-truncate" title="Lea Chan">
                    <a href="javascript:void(0);">{!oneMsg.ToAddress}</a>
                  </span>
                </li>
              </ul>
              <div>
                <span class="slds-text-title">Text Body</span>
                    <p class="slds-p-top_x-small">
                      <!--  <aura:unescapedHtml value="{!oneMsg.HtmlBody}"/>  -->
                     <p class="linewidth"> {!oneMsg.TextBody} </p>  
                  </p>
              </div>
                <lightning:button name="modal" label="Reply" aura:id="{!oneMsg.Id}" value="{!oneMsg.Id}" onclick="{!c.replyEmailmsg}" />
            </article>
          </div>
        </div>
      </div>
    </li>
           </aura:iteration>
   < /ul>
 < /div>
< /aura:component>

Controller:-

({
    doInit : function(component, event, helper) {
        var currentRec = component.get("v.recordId");
        console.log('>>>>>>'+currentRec);
        helper.getEmailMessages(component,event,currentRec);        
    },

    emailsection : function(component, event, helper) {

      var acc = component.find('emaildetail');
     $A.util.toggleClass(acc, 'slds-show');  
        helper.helperFun(component,event,'emaildetail');
    },
})

Helper:-

({
    helperFun : function(component,event,secId) {
      var acc = component.find(secId);
            for(var cmp in acc) {
            $A.util.toggleClass(acc[cmp], 'slds-show');  
            $A.util.toggleClass(acc[cmp], 'slds-hide');  
            }
},

    getEmailMessages : function(component,event,currentRec) {
        console.log('###helper record id##'+currentRec);        
        var action = component.get("c.getMessageDetail");
        action.setParams({
            "emailMessageId": currentRec             
        });

        action.setCallback(this, function (response) {
            var state = response.getState();
            if (state === "SUCCESS") {                
                component.set("v.EmailMsgs", response.getReturnValue());

            }  else if (state === "INCOMPLETE") {
                console.log("No response from server or client is offline.")
                var myErrMsg='No response from server or client is offline.';

            } else if (state === "ERROR") {                
                console.log("Error: ");
            }
        });
        $A.enqueueAction(action);        
    },

How to refresh the specific Lightning component not the lightning page

$
0
0

I have two lightning component placed on one page lightning app. First Component have refresh icon and I set onclick action to refresh Component $A.get('e.force:refreshView').fire(); but this event refresh the whole page instead of First component. how can refresh only one component on page not all the page ?

embedding a visualforce page in lightning component

$
0
0

I used an iframe to embed my visualforce page in a lightning component, but the page is showing me the error: Refused to display, in a frame because it set 'X-Frame-Options' to 'deny'. is this because my VF page is calling web services? if so, what could be done?

How can I navigate to a Visualforce tab from a link or component in Lightning Experience?

$
0
0

We have a seemingly simple need to create a hyperlink that will redirect users to a tab in our Lightning Experience site that is a Visualforce tab. Lightning Components have navigateTo() methods that allow us to navigate to specific URLs, and most other tabs in Lightning have reasonable URLs like /one/one.app?source=aloha#/sObject/Contact/home that allow us to deploy these links from org to org. But Visualforce tabs have very complex URLs that are dynamically generated and vary from org to org. How can we create (and deploy) links to allow users to navigate to these tabs?

In lightning - Record edit on save loops when standard(contact) edit button is overriden with visualforce page

$
0
0

Steps to reproduce:

1) Create a VF page with below code and override Contact Edit button with this visualforce page.

<apex:page standardController="Contact" action="{!URLFOR($Action.Contact.Edit, Contact.Id, ['retURL'='/'+Contact.id],true)}">
</apex:page>

2) In lightning experience and edit a contact record.

3) Record edit screen will open and save.

4) Issue is after save edit screen opens again.

I have also tried sforce.one.navigateToURL but found same results in lightning.

FYI, same code works perfect in Salesforce classic.


Salesforce lightning - unable to click the menu using selenium web driver

$
0
0

This is the salesforce application (Lightning mode), I want to automate the below cases using selenium webdriver using java.

case 1: want to click the menu

case 2 get the href value from tag

HTML

<one-app-nav-bar-item-root one-appnavbar_appnavbar="" data-id="home" data-assistive-id="operationId" aria-hidden="false" draggable="true" class="navItem slds-context-bar__item slds-shrink-none slds-is-active" role="listitem" xpath="1">
<a href="/lightning/page/home" title="Home" tabindex="0" draggable="false" aria-describedby="operationId-14" class="slds-context-bar__label-action dndItem" style="">
<span class="slds-truncate">Home</span>
</a></one-app-nav-bar-item-root>

my selenium code to get the href value

WebElement getHref = driver.findElement(By.xpath("//one-app-nav-bar-item-root[1]//a"))
println getHref.getAttribute('href')

above one getting a null value

to click the Home menu

WebElement clickHomeMenu = driver.findElement(By.xpath("//one-app-nav-bar-item-root[1]//a"))
clickHomeMenu.click()

for the above one getting the below exception

org.openqa.selenium.JavascriptException: javascript error: Cannot read property 'defaultView' of undefined

Lightning Styling not working on VisualForce Page

$
0
0

I have a complex VF page that needs a lot of updates, so I've created a copy of it to work on. Apart from the name, all else is identical - it even (for now) points to the same controller. In Setup, in Visualforce Pages, I've tries setting the 'Available for Lightning Experience, Lightning Communities, and the mobile app' checkbox, even though the original did not have this set.

But, on the original page, the Lightning Styling works, while on my copy it doesn't. 2 screenshots - the first is what it's supposed to look like, the second is what the new page looks like.

Original, Working page

New, non-working page

If I look in Dev tools, I can see a CSS difference:

The original page uses:

https://britisheventing--prodmirror--c.cs110.visual.force.com/apexpages/slds/latest/assets/styles/salesforce-lightning-design-system-vf.min.css

The new page uses: https://britisheventing--prodmirror--c.cs110.visual.force.com/slds/css/lKu4b4zrMH3Fa5dSdO_jjA/min/scoped/one:oneNamespace,force:sldsTokens,force:base,force:oneSalesforceSkin,force:levelTwoDensity,force:themeTokens,force:formFactorLarge/slds.css

So, both style sheets come from the same Org, but different paths, and have different names.

The first 3 lines of both pages read:

<apex:page standardStylesheets="false" applyHtmlTag="true" applyBodyTag="true" docType="html-5.0"  tabStyle="Entry__c" controller="RefundEntriesCtrl">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <apex:slds />

Edit:

I added:

{!URLFOR($Asset.SLDS, '/')}

to both pages. On the page that works, it displayed:

/apexpages/slds/latest/

On the page that doesn't, it displayed:

/_slds/

This makes no sense, but is happening. Any ideas? Thanks!

Email author url for lightning experience view

$
0
0

How to navigate to email editor with some parameters when user click on custom button on record detail page. I have VF page which redirects to email composer. Button working in classic but in lightning its redirected to classic view, how to navigate to lightning view.

PageReference pageRef = new PageReference('/email/author/emailauthor.jsp?retURL=/'+application.Id+'&template_id=00X90000000fUvv&&p3_lkid='+application.Id+'&&p2_lkid='+application.Account_ID__c);

Formula field with BR() function in lightning calendar

$
0
0

I created a formula field to show two field values but in separate line. Here is the formula field with BR() function Field1& BR() & Field2. I created a calendar for a user and It is coming in calendar like Field1<br>Field2 instead of coming in separate line. Could anyone tell me please that is there anything I am doing wrong or it is a known issue for salesforce?

Thanks for all your help.

Fix the Lightning component on app page

$
0
0

I need to fix the position of 1st component on top & 2nd component at the bottom of page.Both shouldn't be scrollable (As i want them as buttons). If any other component is in between that should only scroll.

enter image description here

Viewing all 2964 articles
Browse latest View live


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