• Amol Rokade 26
  • NEWBIE
  • 115 Points
  • Member since 2019

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 29
    Replies
Hi all,

We are working on building a custom carousel for one of the pages in our customer community.

We like the the lightning carousel, but need to customize it to add more than five images and remove the white box with black text at the bottom of each image.

https://developer.salesforce.com/docs/component-library/bundle/lightning-carousel/example

We would like our custom carousel to be a Lightning web component.

We found the HTML and CSS available as part of the Lightning Design System here.
https://lightningdesignsystem.com/components/carousel/

However, we couldn't find the JavaScript code for the carousel anywhere.

We searched pretty extensively in this repo:
https://github.com/salesforce/lwc

But that repo only seemed to be the compiler for Lightning Web Components. That repo does not seem to contain the HTML, CSS, and JS for any of the Base Lightning Web Components.

Are we understanding this correctly?
In other words, is the JS code for the lightning-carousel closed source even though the HTML and CSS has been released?

Thank you!
Jey
Hi All,

I created a component with Inteface 'forceCommunity:themeLayout' to use this as custom theme for communities and also added 'access' as global. But this theme is not displaying in list of theme in communities. Below is the component.
<aura:component implements="forceCommunity:themeLayout" access="global" >
	<aura:attribute name="menu" type="Aura.Component[]" required="false" />
    <aura:attribute name="header" type="Aura.Component[]" required="false" />
    <aura:attribute name="searchResult" type="Aura.Component[]" required="false" />
    <aura:attribute name="bodyResult" type="Aura.Component[]" required="false" />
    <aura:attribute name="footer" type="Aura.Component[]" required="false" />
    <aura:attribute name="backgroundImageURL" type="String" default=""/>
	<aura:handler name="init" value="{!this}" action="{!c.doInit}"/> 
    <div class="c-container">
        <lightning:layout multipleRows="true">
            <lightning:layoutItem size="12" smallDeviceSize="2" mediumDeviceSize="2" largeDeviceSize="2" flexibility="auto">
            	{!v.menu}
            </lightning:layoutItem>
            <lightning:layoutItem size="12" smallDeviceSize="10" mediumDeviceSize="10" largeDeviceSize="10" flexibility="auto">
            	 <lightning:layout multipleRows="true">
                    <lightning:layoutItem size="12" smallDeviceSize="12" mediumDeviceSize="12" largeDeviceSize="12" flexibility="auto">
                        {!v.header}
                    </lightning:layoutItem>
                </lightning:layout>
                <div class="slds-grid slds-wrap accountNav">
                    <div class="slds-col slds-size_1-of-1 slds-medium-size_5-of-12 slds-large-size_5-of-12 slds-account-style">
                    	{!v.searchResult}
                    </div>
                    <div class="slds-col slds-size_1-of-1 slds-medium-size_7-of-12 slds-large-size_7-of-12 slds-account-style" style="{!'position: relative; height: 30vh; background:' + v.backgroundColor + ' url(' + v.backgroundImageURL +') no-repeat;min-height: calc(100vh - 88px);background-position: center;background-size: cover;'}">
                    	{!v.bodyResult}
                    </div>
                </div>
            </lightning:layoutItem>
        </lightning:layout>
        <lightning:layout multipleRows="true">
            <lightning:layoutItem size="12" smallDeviceSize="12" mediumDeviceSize="12" largeDeviceSize="12" flexibility="auto">
            	{!v.footer}
            </lightning:layoutItem>
        </lightning:layout>
    </div>
</aura:component>

 
Hi Folks,

Am quite new to Lightning and trying to understand Events so far i have created two components making Parent Child compoent with help of Events. But getting "Action failed: c:MySampleChildCmp$controller$handleClick [Cannot read property 'setParams' of null] Failing descriptor: {c:MySampleChildCmp$controller$handleClick}"
Unable to identify the Error.

Here is  the code.

ChildToParentEvent.evt:-

<aura:event type="COMPONENT">
    <aura:attribute type="String" name="firstName"/>
    <aura:attribute type="String" name="lastName"/>
    <aura:attribute type="String" name="Phone"/>
</aura:event>

MySampleChildCmp:- 
<aura:component>
    <!--<aura:attribute type="String" name="userData" default=""/>
    <aura:attribute type="String" name="firstName" default=""/>
    <aura:attribute type="String" name="lastname" default=""/>
    <aura:attribute name="Phone" type="Integer" default=""/>-->
    <aura:registerEvent name="ChildToParentEvnt" type="c:ChildToParent"/>
    <lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
</aura:component>

MySampleChildCmpController:- 
({
    handleClick : function(component, event, helper) {
        alert('called Child component');        
        var evt = component.getEvent("c.ChildToParentEvnt");
        evt.setParams({'firstName' : SFDC,
                        'lastName' : Developer,
                        'Phone' : 9999999
                       });
            evt.fire();
        alert('called Event');
    }
})

MySampleParentCmp:-
<aura:component >
    <aura:attribute type="String" name="userData" default="" />
    <aura:attribute type="String" name="firstName" default="ABC" />
    <aura:attribute type="String" name="lastName" default="DEF" />
    <aura:attribute type="Integer" name="Phone" default="" />
    <aura:attribute type="boolean" name="callChild" default="false" />
    <aura:handler name="ChildToParentEvnt" event="c:ChildToParent" action="{!c.handleClick}"/>
        <div>
           <c:MySampleChildCmp />
    </div>
    <div>
        <h2>User Data from Event </h2>
        Name    : {!firstName} {!lastName}<br/><br/>
        Phone    : {!Phone}
    </div>
</aura:component>

MySampleParentController:-

({
    handleClick : function(component, event, helper) {
        alert('Called Parent');
        var lastName= event.getParam('lastName');
        var firstName= event.getParam('firstName');
        var Phone= event.getParam('Phone');
        component.set('v.lastName', lastName);
        component.set('v.firstName', firstName);
        component.set('v.phone', Phone);
    }
})


Thanks in Advance,
Ragav
  • September 23, 2019
  • Like
  • 0
Can anyone help me out in writing batch apex that will create or update records.I never worked on batch apex so struggling here I have two objects
1) SIS_Staging__c
2) Contact
Both objects are having same field Siscode__c, so on inserting records in SIS_Staging__c, I need to check if any contact records are having same Siscode__c or not, if yes then I need to update else I need to create Contact.
I tried below code but when I run batch apex in anonymous window then I am getting below error.
"Constructor not defined: [BatchSISstagingObject].()"
My code is below.
 
global class BatchSISstagingObject implements Database.Batchable<sObject>{
    List <SIS_Staging__c> mapSisobject = new List <SIS_Staging__c> ();
    List <Contact> contactlist1 = new List <Contact> ();
    
    global BatchSISstagingObject(List <SIS_Staging__c> sisobjectUpdate) {
        mapSisobject=sisobjectUpdate;
        
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        return DataBase.getQueryLocator([SELECT Id, SIS_Student_ID__c
                                         FROM Contact
                                        ]);
    }
    global void execute(Database.BatchableContext BC , List <Contact> contactlist) {
        for (SIS_Staging__c acct : mapSisobject){ 
            for (Contact con : contactList){
                if (con.SIS_Student_ID__c == acct.Name){
                        contactlist1.add(new Contact(
                            Id = con.Id,
                            FirstName = acct.First_Name__c,
                            LastName = acct.Last_Name__c
                           ));
                    }
            }   
        }
        
         update contactlist1;
    } 
    global void finish(Database.BatchableContext BC){
        
    }

}

 
I have as follows in lightning component

distance=2416.63 miles

I want to have as distance=241.63
so pls let me know how to use split function or is there any other method

thanks 
meghna


 
I need to get the foreign key columns of a table . In the describeObjectResult for the table,I get a list of child relationships but not the fk columns in this table to which the child column is mapped.
Hi all,

We are working on building a custom carousel for one of the pages in our customer community.

We like the the lightning carousel, but need to customize it to add more than five images and remove the white box with black text at the bottom of each image.

https://developer.salesforce.com/docs/component-library/bundle/lightning-carousel/example

We would like our custom carousel to be a Lightning web component.

We found the HTML and CSS available as part of the Lightning Design System here.
https://lightningdesignsystem.com/components/carousel/

However, we couldn't find the JavaScript code for the carousel anywhere.

We searched pretty extensively in this repo:
https://github.com/salesforce/lwc

But that repo only seemed to be the compiler for Lightning Web Components. That repo does not seem to contain the HTML, CSS, and JS for any of the Base Lightning Web Components.

Are we understanding this correctly?
In other words, is the JS code for the lightning-carousel closed source even though the HTML and CSS has been released?

Thank you!
Jey
Hi All,

I created a component with Inteface 'forceCommunity:themeLayout' to use this as custom theme for communities and also added 'access' as global. But this theme is not displaying in list of theme in communities. Below is the component.
<aura:component implements="forceCommunity:themeLayout" access="global" >
	<aura:attribute name="menu" type="Aura.Component[]" required="false" />
    <aura:attribute name="header" type="Aura.Component[]" required="false" />
    <aura:attribute name="searchResult" type="Aura.Component[]" required="false" />
    <aura:attribute name="bodyResult" type="Aura.Component[]" required="false" />
    <aura:attribute name="footer" type="Aura.Component[]" required="false" />
    <aura:attribute name="backgroundImageURL" type="String" default=""/>
	<aura:handler name="init" value="{!this}" action="{!c.doInit}"/> 
    <div class="c-container">
        <lightning:layout multipleRows="true">
            <lightning:layoutItem size="12" smallDeviceSize="2" mediumDeviceSize="2" largeDeviceSize="2" flexibility="auto">
            	{!v.menu}
            </lightning:layoutItem>
            <lightning:layoutItem size="12" smallDeviceSize="10" mediumDeviceSize="10" largeDeviceSize="10" flexibility="auto">
            	 <lightning:layout multipleRows="true">
                    <lightning:layoutItem size="12" smallDeviceSize="12" mediumDeviceSize="12" largeDeviceSize="12" flexibility="auto">
                        {!v.header}
                    </lightning:layoutItem>
                </lightning:layout>
                <div class="slds-grid slds-wrap accountNav">
                    <div class="slds-col slds-size_1-of-1 slds-medium-size_5-of-12 slds-large-size_5-of-12 slds-account-style">
                    	{!v.searchResult}
                    </div>
                    <div class="slds-col slds-size_1-of-1 slds-medium-size_7-of-12 slds-large-size_7-of-12 slds-account-style" style="{!'position: relative; height: 30vh; background:' + v.backgroundColor + ' url(' + v.backgroundImageURL +') no-repeat;min-height: calc(100vh - 88px);background-position: center;background-size: cover;'}">
                    	{!v.bodyResult}
                    </div>
                </div>
            </lightning:layoutItem>
        </lightning:layout>
        <lightning:layout multipleRows="true">
            <lightning:layoutItem size="12" smallDeviceSize="12" mediumDeviceSize="12" largeDeviceSize="12" flexibility="auto">
            	{!v.footer}
            </lightning:layoutItem>
        </lightning:layout>
    </div>
</aura:component>

 
Hi,
I tried to retrieve all the components of a org with known credentials using Salesforce ant migration tool. Some of the components were successfully retrieved while some of the components have content as
"(hidden)".
Why this happens?
Are there any access privilages on the components?
If yes how to make them accessible.
Regarding salesforce communities custom theme developed using aura component. I wish to change custom theme logo to other image.

To see the current logo click here (https://ibb.co/QQKnzWB
but wish to change this, 
need help
We want to add rows of a parent on button click and also add multiple child records again each record.we are facing the issue for child rows.
Hi Folks,

Am quite new to Lightning and trying to understand Events so far i have created two components making Parent Child compoent with help of Events. But getting "Action failed: c:MySampleChildCmp$controller$handleClick [Cannot read property 'setParams' of null] Failing descriptor: {c:MySampleChildCmp$controller$handleClick}"
Unable to identify the Error.

Here is  the code.

ChildToParentEvent.evt:-

<aura:event type="COMPONENT">
    <aura:attribute type="String" name="firstName"/>
    <aura:attribute type="String" name="lastName"/>
    <aura:attribute type="String" name="Phone"/>
</aura:event>

MySampleChildCmp:- 
<aura:component>
    <!--<aura:attribute type="String" name="userData" default=""/>
    <aura:attribute type="String" name="firstName" default=""/>
    <aura:attribute type="String" name="lastname" default=""/>
    <aura:attribute name="Phone" type="Integer" default=""/>-->
    <aura:registerEvent name="ChildToParentEvnt" type="c:ChildToParent"/>
    <lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
</aura:component>

MySampleChildCmpController:- 
({
    handleClick : function(component, event, helper) {
        alert('called Child component');        
        var evt = component.getEvent("c.ChildToParentEvnt");
        evt.setParams({'firstName' : SFDC,
                        'lastName' : Developer,
                        'Phone' : 9999999
                       });
            evt.fire();
        alert('called Event');
    }
})

MySampleParentCmp:-
<aura:component >
    <aura:attribute type="String" name="userData" default="" />
    <aura:attribute type="String" name="firstName" default="ABC" />
    <aura:attribute type="String" name="lastName" default="DEF" />
    <aura:attribute type="Integer" name="Phone" default="" />
    <aura:attribute type="boolean" name="callChild" default="false" />
    <aura:handler name="ChildToParentEvnt" event="c:ChildToParent" action="{!c.handleClick}"/>
        <div>
           <c:MySampleChildCmp />
    </div>
    <div>
        <h2>User Data from Event </h2>
        Name    : {!firstName} {!lastName}<br/><br/>
        Phone    : {!Phone}
    </div>
</aura:component>

MySampleParentController:-

({
    handleClick : function(component, event, helper) {
        alert('Called Parent');
        var lastName= event.getParam('lastName');
        var firstName= event.getParam('firstName');
        var Phone= event.getParam('Phone');
        component.set('v.lastName', lastName);
        component.set('v.firstName', firstName);
        component.set('v.phone', Phone);
    }
})


Thanks in Advance,
Ragav
  • September 23, 2019
  • Like
  • 0

The Opportunities Logo is to the left of PageBlock titleHere the Opportunities Logo keeps shifting up/down depending on the viewing window size. If I view from my laptop its fine, but when I view the page from monitor or ipad, the logo isnt placed properly. Below is current code-Any idea how to dynamically allign it?

<apex:form id="form">
        <apex:pageBlock title="*** Opportunities" id="pgblock" tabStyle="Opportunity">
            <img src="{!$Resource.OppLogo}" style="margin-top: -3.5%; margin-left: -0.5%;"/>
          

Can anyone help me out in writing batch apex that will create or update records.I never worked on batch apex so struggling here I have two objects
1) SIS_Staging__c
2) Contact
Both objects are having same field Siscode__c, so on inserting records in SIS_Staging__c, I need to check if any contact records are having same Siscode__c or not, if yes then I need to update else I need to create Contact.
I tried below code but when I run batch apex in anonymous window then I am getting below error.
"Constructor not defined: [BatchSISstagingObject].()"
My code is below.
 
global class BatchSISstagingObject implements Database.Batchable<sObject>{
    List <SIS_Staging__c> mapSisobject = new List <SIS_Staging__c> ();
    List <Contact> contactlist1 = new List <Contact> ();
    
    global BatchSISstagingObject(List <SIS_Staging__c> sisobjectUpdate) {
        mapSisobject=sisobjectUpdate;
        
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        return DataBase.getQueryLocator([SELECT Id, SIS_Student_ID__c
                                         FROM Contact
                                        ]);
    }
    global void execute(Database.BatchableContext BC , List <Contact> contactlist) {
        for (SIS_Staging__c acct : mapSisobject){ 
            for (Contact con : contactList){
                if (con.SIS_Student_ID__c == acct.Name){
                        contactlist1.add(new Contact(
                            Id = con.Id,
                            FirstName = acct.First_Name__c,
                            LastName = acct.Last_Name__c
                           ));
                    }
            }   
        }
        
         update contactlist1;
    } 
    global void finish(Database.BatchableContext BC){
        
    }

}

 
I have written before update trigger on opportunity but it is not working for below code, not providing error when changing stage to verbal agreement.

Note: I have created one opportunity stage as verbal agreement(80%).

for(Opportunity opp:[Select id,name, Legal_Entity_Name__r.SAP_CODE__c,StageName from opportunity where (StageName='Verbal Agreement' and id in:trigger.new)]){
        if(opp.Legal_Entity_Name__r.SAP_CODE__c==null && opp.Legal_Entity_Name__r.Name==null){
            opp.addError('Oppotunity cannot move to 80% as SAP CODE or LE is not present');


For below code there is error occured as mentioned in code but error is getting for all the stages instead of verbal agreement.

trigger SAP_CODE on Opportunity (before Update) {
    
    Set<Opportunity> updatedoppty = new Set<Opportunity>();
    for (Opportunity opp: trigger.new){
        updatedoppty.add(opp);
    }  
    
    Map<id,Opportunity> mapopty = new Map<id,Opportunity>();
    mapopty.putAll([Select id, name, Legal_Entity_Name__r.SAP_CODE__c,StageName from opportunity where (StageName='Verbal Agreement' and id in:updatedoppty)]);
    
    For (Opportunity opp: trigger.new){
        
        if(null==mapopty.get(opp.Legal_Entity_Name__r.name)){
             opp.addError('Oppotunity cannot move to 80% as LE is not present');
        }
        if(null==mapopty.get(opp.Legal_Entity_Name__r.SAP_CODE__c))
        {
               opp.addError('Oppotunity cannot move to 80% as SAP CODE is not present');
        }
    }