• Alain Cabon
  • ALL STAR
  • 12456 Points
  • Member since 2016

  • Chatter
    Feed
  • 389
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 2445
    Replies
Hi, I'm trying to create an LWC that displays a datatable of records from a custom obect called Match__c. I want to display the record Id, the participant, and volunteer fields in the datatable where the field volunteer job on the Match record equals the record id of the page being viewed. I created an apex controller to pull the data. The table will not display any data even though I have permissions to the object/fields. On load the console displays "DevTools Failed to Load Source Map". Here are some pictures: 

Apex Controller
User-added imageJS
User-added imageHTML
User-added imageComponent
User-added image
Any help would be appreciated. This is my first LWC.
Hello
I'm trying to get the Week Number into a new custom field.  I need to calculate the week number from a standard Field Service Lightning field named "SchedStartTime".  The data type for this field is Date/Time.  I created a custom formula field to capture only the date from the SchedStartTime field named "Scheduled Start Date" with the formula: DATEVALUE(SchedStartTime ).  I then created another custom field named "Week Number" with the formula: MOD (FLOOR (( Scheduled_Start_Date__c - DATE(2019,12,30) + (1/24) ) / 7),53)+1.  However, there are errors when the Scheduled Start is midnight (00:00), the Week Number should update to the next week number but this isn't happening until the Scheduled Start is 01:00.  See example below:

Scheduled Start     Week Number
14/06/2020 23:00          24
14/06/2020 23:30          24
15/06/2020 00:00          24
15/06/2020 00:30          24
15/06/2020 01:00          25

Can anyone provide help please?  Note that our Org has the Default Time Zone(GMT+01:00) British Summer Time (Europe/London).

I have an interesting use case. We are using Salesforce's Embedded Chat service, but it needs to also be able to open by the click of a button located somewhere on the page.

This means it opens in two ways:

1. The standard way (clicking the embedded chat in the bottom right of the screen)

2. A separate button on the page that should open that same embedded chat

 

I already know that using Chat Buttons and Embedded Chat on the same page is not compatible with Salesforce. However, is it possible to lauch the Embedded Chat with a button click? Essentially, we just need two ways to launch the embedded chat: button click on page, and standard way

Hi -

I have a VF page that generates what we call Route Sheets.  Each one takes 1-2 pages and the whole printout is about 55 pages long.  Each Route starts on a new page.  This is all fine.

The challenge is -- I'd like to include the route name on every page so was thinking of placing it in the page footer.  To accomplish this I'd need to change the footer with each iteration through the loop.

Can that be done?  If not, do you have other suggestions?

Thanks,

Steve

 
<apex:page controller="GenerateRouteSheets" deferLastCommandUntilReady="true" renderAs="PDF" applyBodyTag="false" action="{!loadData}">
	<!-- <apex:page controller="GenerateRouteSheets" deferLastCommandUntilReady="true" renderAs="PDF" applyBodyTag="false" > -->
	<head>
		<style>
			@page{
			size: landscape;
			@bottom-right {
			font-family: 'Arial Unicode MS';
			font-size: 13px;
			content:  "Page " counter(page) " of " counter(pages);
			}
			} 
		</style>
	</head>
	<script>
	    var dt = new Date();
	    document.getElementById("datetime").innerHTML = dt.toLocaleString();
	</script>
	<body>
		<apex:pageBlock >
			<apex:repeat value="{!routes}" var="r">
				<div style="page-break-after:always;  ">
                    Route {!r}
                    ~~ SNIP ~~
                </div>
			</apex:repeat>
		</apex:pageBlock>
	</body>
</apex:page>

 
I need to show a picklist in a visualforce with all the related territories of an user. These territories are the user's assigned territories and all the territories under them in the territory hierarchy. For example, with a hierarchy like this one:
Europe
 |- France
 |- Spain <--
   |- Madrid
   |- Catalunya
     |- Barcelona
 |- Italy
A user assigned to Spain should see Madrid, Catalunya and Barcelona as possible options in the picklist. Right now I achieve this using a recursive function, but in a production org with around 1300  territories, I'm hitting CPU and SOQL limits all the time because I need to execute a SOQL query for every sub territory.

Reading Enterprise Territory Management documentation I cannot find any function provided by Salesforce to achieve this and the object itself doesn't have a named relationship between the parent a its sons that could help me reduce the number of queries. I was looking something like this:
SELECT Id, Name, (SELECT Id, Name FROM ChildTerritory2s) FROM Territory2 WHERE DeveloperName = 'Spain'
Hope someone have some workaround for achieving this without using something as demanding as a recursive function that when it hits the limits doesn't show the end of the list. Thanks.
I've got the following code
 
User u =   [SELECT Id 
            FROM User
            Where Email='admin@***.org'];

for(AggregateResult objAgr : [SELECT   RecordType.Name, SUM(DurationHours__c)
                              FROM     Event 
                              WHERE    OwnerId = :u.Id
                              GROUP BY RecordType.Name])
{
    String label = string.valueof(objAgr.get('RecordType.Name'));
    Double total = double.valueof(objAgr.get('expr0'));
    system.debug(label + ' | ' + total);
}

I get an error when running this from an execute anonymous window that says:

System.SObjectException: Invalid field RecordType.Name for AggregateResult

I am able to use this exact same code for a similar query, except instead of grouping by RecordType.Name, I group by ActivityDate. This works perfectly. So how do I get RecordType.Name results?
Hey guys, there is a text field that I want to restrict so it only accepts 10 digit phone numbers separated by commas. 

So far I have this, but it does not specify how many digits the numbers must be.  So it allows any number of digits separated by commas (i.e. 123,12,1234,12345,etc).  But I want to restrict it to comma separated 10-digit numbers (i.e. 4161231234,6470987657,9051231234,etc…).  I know I need a “{10}” somewhere, but can’t seem to figure out where. 

Your help is greatly appreciated.


AND(
NOT(ISBLANK(Text_Field__c)),
NOT(REGEX(Text_Field__c,"^[0-9,.*]+$"))
)
Hello, I need to query a feeditem's parent's custom field.

Here is so far:
  
            Discharge__c discharge=[Select Id, Name, Date_of_Birth__c from Discharge__c where Id = :this.dis.id];
        
        listofNotes = [SELECT ID, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Parent.Name, Body
                      FROM feeditem 
                      WHERE Parent.Name = :discharge.name ];

I need to add another WHERE clause stating that the Parent (discharge record's) date of birth  is = discharge.date_of_birth__c

Is this possible?
Hi,

Can anyone please help how to cover a test class for this code ?
 
public class GD_CartProductsWrapper {

    @AuraEnabled
    public GD_Cart__c cartItem;
    
    @AuraEnabled
    public List<String> uomPicklist;
    
    @AuraEnabled
    public Map<String,GD_Cart__c> orderLinesByUom;
    
    @AuraEnabled
    public Decimal unitPrice;
    
    @AuraEnabled
    public Decimal totalPrice;
    
    public GD_CartProductsWrapper(){
        cartItem = new GD_Cart__c();
        uomPicklist = new List<String>();
        orderLinesByUom = new Map<String,GD_Cart__c>();
        totalPrice = 0;
    }
}

Regards,
Soundar.​​​​​​​
I'm looking for other/ better ways to implent the code below. 

Use Case: 

I have a custom Project__c object which gets created when an Opportunity becomes Closed Won. If the Opportunity has certain Opportunity Products which have the Hours_Contribute_to_Project__c checkbox set to true, when the Project is created, it will tally all the quantities of these respective Opportunity Products to see how many hours were purchased and input the value within the respective Project record. Project and Opportunity have a lookup relationship. 

Code: 
 The following code works but I'm wondering how to make it more efficient without the SOQL query in the FOR loop. Thanks!
public static void CalculateHoursPurchased(List<Project__c> projectList){
    
    for(Project__c a: projectList){
        
        AggregateResult hoursPurchased = [SELECT SUM(Quantity)
                                          FROM OpportunityLineItem
                                          WHERE Hours_Contribute_to_Project__c = TRUE AND Opportunity.Id = :a.Opportunity__c];
        
        Decimal b = (decimal)hoursPurchased.get('expr0');
        a.Hours_Purchased__c = b;
        
    }
    
}

 
I want to create a table that displays some time slots with a checkbox next to it. At the end of the table, there's a submit button. For the table, I used a Schedule__c object and also declared a Map, with the boolean being the default value for the checkbox.
This is the UI:
UI

This is a part of my VF code:
<apex:form id="results">
            <!-- <apex:outputText rendered="{!availableCourses.size == 0}" value="{!$Label.noResults}" /> -->
            <br/>
            <table style="width:100%">
                <thead>
                    <th>{!$Label.timeSlot}</th>
                    <th>{!$Label.courseStatus}</th>
                    <th>chose</th>
                </thead>
                <tbody>
                    <apex:repeat value="{!availableCourses}" var="result">
                        <apex:param value="{!courseOptions}"/>
                        <tr>
                            <td class="courseTime">
                                <apex:outputText value="{!result.Time__c}"></apex:outputText>
                            </td>
                            <td>test</td>
                            <td><apex:inputCheckbox value="{!courseOptions[result]}"/></td>
                        </tr>
                    </apex:repeat>
                </tbody>
            </table>
            <br/>
        </apex:form>
        <apex:form>
            <apex:commandButton value="{!$Label.submit}" action="{!Submit}" styleClass="btn btn-block" style="margin:0px;">

            </apex:commandButton>
        </apex:form>

This is part of my controller:
This is where I assign the default values to the Map, which has no problems at all.
for(ScheduleSetting__c a: availableCourses){
        courseOptions.put(a, false);
}

This is supposed to be my Submit function. It's not done yet because I'm trying to get the new values for the input checkboxes first.
 
public Pagereference Submit() {
    system.debug('aaa');

    for(ScheduleSetting__c key : courseOptions.keySet()){
        system.debug(courseOptions.get(key));
    }
    return null;
}
The problem is that even though I check the inputCheckBox when Submit gets called, the Map values don't change at all. I just want to be able to change the Map Boolean values depending on whether the checkbox is checked or not.
This is what I get in the Logs:
User-added image
 
Considering the inherent problems with OOP (https://medium.com/@cscalfani/goodbye-object-oriented-programming-a59cda4c0e53), and since Salesforce is always on the cutting edge, is there a universe in which Salesforce would move away from OOP and toward Functional Programing?  

I'm a certified Salesforce professional but still relatively new to writing code. I've been working on learning Apex in order to be able to hold my own as a Salesforce Developer......I'd love to be reassured that I'm not wasting my time learning Object-Oriented Programming.  

Admittedly, my grasp of the two different engineering approaches is very limited so I'm speaking as a newbie :)
Hi Can any one help me,
I have a text field in which i am trying to save alpha numeric and i am trying to limit the range between 0100 to 0555 so the values should save between the range and alpha numeric.i worte a formula like this.                 
  AND(
NOT(REGEX(Text__c,"^[a-zA-Z0-9_]*$")),
OR(
VALUE(Text__c) < 0100,
VALUE(Text__c) > 0555 ) )

So here example am giving AC15 value in the field it is working.
if i give the value 0101 it is saving and if i give it as 1111 it is 
also saving which is not correct.REGEX part is working but not the other part  OR Part.
  • March 26, 2020
  • Like
  • 0

Hi, i need to create event on lead for a test apex.

The EndDateTime (or activityDate) of this event need to be past.

I have create a lead and event on this lead but i can't choose a negative EndDateTime.
How can i do ?

It's possible to set a date time on Start Test for launch the test in the futur? Ty

I'm using an admin account and using an org setup as "Dev Hub".  

When creating the scratch org:

sfdx force:org:create -f project-scratch-def.json -a AbcScratchOrg

I receive this error message: 

ERROR running force:org:create:  We couldn't create this sandbox or scratch org because the associated Dev Hub isn't authorized. Authorize the Dev Hub and try again.

I've ensured the org is indeed configured as Dev Hub and that the admin user in visual studio code is set:

Sfdx force:config:set defaultdevhubusername=<devhubusername> --global

User-added image

Any ideas/help on what might be the issue would be much appreciated.
 
Hi - I'm relatively new to Lightning so I'm not sure where to look for this.

I have a community page that I've built with Builder, and it has a component on it, and a language switcher.  Guests can view the page, and switch between English and French.

There's one particular component that I need to hide when the user's language is French.

How can I do that?

I looked at Audiences but I don't see how I can create an audience based on a guest user's selected language.

There's <aura:renderif> but I don't see how I can apply that to the page I built with Builder.

The component I'm trying to hide is a Contact Support form, so it's fairly complicated inside otherwise I could do in HTML/JavaScript.

Is there an easy way to do this?

Thanks!
 -- Steve

I have a set of flows from a previous admin, and I'm trying to find how those screen flows are launched.   Is there a way to tell if they are attached to a button, or a visual force page or some other way?   Is it possible to query this via soql so I can get a list of flows and their related launch points?   Hope that makes sense.   

I'll need to move these flows to a new org, but that org won't have the identical schema.  I need to know how the screen flows are launched so I can replicate this action in a new org with a different schema. 

TIA for your help

Why does this RegEx pattern not working in Salesforce ?

pattern myPattern = pattern.compile('@(microsoft|ms|microsoftsurface|msstore).com');
System.debug(myPattern.matcher('aba@ms.com').matches());

I tested it in https://regexr.com/ and it works !
  • December 06, 2019
  • Like
  • 0
Hi! I am working on a project to load account information per criteria in a data table and allow users to select which they want to create a new record for. 

However I am unable to pass the rows selected by the user to the controller. the value is returning as undefined or null. Please help!

Here is my code: 
COMPONENT: 
<aura:component controller = "JMA_SearchforAllChildrenAccounts_Ctr" implements="lightning:availableForFlowActions,force:hasRecordId,lightning:availableForFlowScreens,force:lightningQuickActionWithoutHeader" access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="recordId" type="String" access="global"/>
    <aura:attribute name="AccountList" type="Account[]"/>
    <aura:attribute name="childrenAccount" type="Account[]" access="global" />
    <aura:attribute name="data" type="Object" />
    <aura:attribute name="SelectedAccount" type="Account[]" access = "global"/>
    <aura:attribute name="columns" type="List"/>
        <div class="slds-page-header">
        <div class="slds-page-header__row">
                            <div class="slds-page-header__name-title">
                                <h1>
                                    <span class="slds-page-header__title slds-truncate" title="Rohde Corp - 80,000 Widgets">Select Accounts for Deal Proposal</span>
                                </h1>
                            </div>
                        </div>
                        <p class="slds-page-header__name-meta">   Selected Account</p>
                    </div>
    <lightning:datatable 
                         data="{!v.data}" 
                         columns="{!v.columns}" 
                         keyField="id" 
                         selectedRows="{! v.selectedRows }" 
                         maxRowSelection="{! v.maxRowSelection }" 
                         onrowselection="{! c.updateSelectedText }" />
    <br/>
    <center>
        <lightning:button variant="success" label="Create Deal Proposal" title="Create Deal Proposal" onclick="{!c.handleSelect}"/>        
    </center>
</aura:component>

CONTROLLER:

({
    doInit : function(component, event, helper) {
        var recordId = component.get('v.recordId');
        var action = component.get("c.PullChildrenAccounts");
        action.setParams({
            'recordId': recordId,
            'strObjectName' : 'Account',
            'strFieldSetName' : 'JMA_Deal_Proposal_Lightning_Component'
        });
        action.setCallback(this, function(response){
               var state = response.getState();
        if(state === "SUCCESS"){
            component.set("v.data", response.getReturnValue().lstDataTableData);
            component.set("v.columns", response.getReturnValue().lstDataTableColumns);
            }else if (state === 'ERROR'){
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " +
                                    errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }else{
                console.log('Something went wrong, Please check with your admin');
            }
        });
        $A.enqueueAction(action);
    },
     
    
    updateSelectedText : function(component, event, helper){
        var selectedRows = event.getParam('selectedRows');
        console.log('selectedRows'+selectedRows);
        component.set("v.selectedRowsCount" ,selectedRows.length );
        var rowCount = component.get("v.selectedRowsCount");
        console.log('rowCount'+rowCount);
        let obj =[] ; 
        for (var i = 0; i < selectedRows.length; i++){
            
            obj.push({Name:selectedRows[i].Name});
            
        }
        component.set("v.selectedRowsDetails" ,JSON.stringify(obj) );
        component.set("v.selectedRowsList" ,event.getParam('selectedRows') );
        console.log('obj: '+obj);
    },
    
    handleSelect: function (component, event, helper) {

        var arr = component.get('v.data');
        var obj =  component.get("v.selectedRowsList");
        var rowCount = component.get("v.selectedRowsCount");
        console.log('rowCount'+rowCount);
        console.log('obj '+JSON.stringify(obj) );
        var updateAction = component.get("c.SelectedAccounts");
        updateAction.setParams({ AccountList: obj});
        updateAction.setCallback(this, function(a) {
            $A.get('e.force:refreshView').fire();
        });
        $A.enqueueAction(updateAction);
       
       
    },
    
})
Hi all,

I built a report with report type Opportunities and would like to add a filter saying Close Date <= 31.12.CURRENT YEAR. For this year it would be <= 31.12.2019.

I found in the Salesforce Documentation the following statement:

For example, instead of filtering on Close Date greater than Jan 1, 2017, filter using a relative date: Close Date equals this year.

Attached the link to the documentation:

https://help.salesforce.com/articleView?id=filter_dates_relative.htm&type=5

If I use Close Date <= THIS YEAR I am wondering if this is the correct solution, as THIS YEAR means "Starts at 12:00:00 AM on January 1 of the current year and continues through the end of December 31 of the current year". I just want to tell Salesforce, I want all records with Closed Date <= LAST DAY OF THE CURRENT YEAR without using any formulas.

If using formulas what would be a practical approach here?.
I need to replace this code with a Lightning Action or some other alternative so I can add a button to the Opportunity Page in LEX.  I have been unsuccessful with finding a template to use as a guide and I'm not a Developer.  Any guidance would be greatly appreciated.

{!REQUIRESCRIPT('//code.jquery.com/jquery-1.6.2.min.js')}
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
var myquery = "SELECT Id, Opportunity.Order_Num__c FROM Opportunity WHERE Id = '{!Opportunity.Id}'";
var result = sforce.connection.query(myquery);
var records = result.getArray("records");
var recordToUpdate;
if (records[0]) {
recordToUpdate = records[0];
}
if (recordToUpdate.Order_Num__c) {
alert("Order already exists");
}
else if (!recordToUpdate) {
alert("Record not found (shouldn't happen)");
}
else {
var dataToSend = {
summary: "{!Opportunity.Name}",
purchaseOrder: "{!Opportunity.Purchase_Order_or_Job__c}",
reporter: "{!Opportunity.OwnerFullName}"
};

jQuery.ajax(
{
dataType: "jsonp",
crossDomain: true,
data: dataToSend,
url: 'https://Something.CompanyABC.com:1234/order/createOrder'
})
.done(function (data) {
if (data.error) {
alert("Error: " + data.error);
}
else if (data) {
setSaleforceValues(data);
}
else {
alert("No response data returned!");
}
})
.fail(function (error) {
alert("Error occurred!");
alert(error);
})
.always(function () {
"use strict";
//alert( "complete" );
});
}

function setSaleforceValues(data) {
var newRecords = [];
if (recordToUpdate) {
var errorMessage = "";
var haveRecordChange = false;
if (data.orderUrl) {
recordToUpdate.Order_Num__c = data.orderUrl;
haveRecordChange = true;
}
else {
errorMessage += "No orderUrl returned!";
}

if (data.orderKey) {
recordToUpdate.Order_Key__c = data.orderKey;
haveRecordChange = true;
}
else {
errorMessage += "\nNo orderKey returned!";
}

if (data.ordersAppUrl) {
recordToUpdate.Model_Reports__c = data.ordersAppUrl;
haveRecordChange = true;
}
else {
errorMessage += "\nNo ordersAppUrl returned!";
}

if (errorMessage.length) {
alert(errorMessage);
}

if (haveRecordChange) {
newRecords.push(recordToUpdate);
}
}

if (newRecords.length) {
result = sforce.connection.update(newRecords);
window.location.reload();
}
else {
alert("No updates to Salesforce made");
}
}
I'm trying to create a schedule flow that would pull all records created within the last 7 days into a collection. I can't seem to get the formula right to get these records..
I have this formula field I am trying to build. Here is the current formula that is throwing the compilation error above:
 
IF( 
   ISPICKVAL(Opportunity.StageName,"Closed Lost"),0,
     IF( 
        AND(Opportunity_Record_Type__c = 'Amendment',
           OR(Line_Level_Detail__c <> 'New Logo',
              Line_Level_Detail__c <> 'Cross Sell',
              Line_Level_Detail__c <> 'Upgrade / Downgrade',
              Line_Level_Detail__c  <> 'Services',
              Line_Level_Detail__c  <> 'Product Churn',
              Line_Level_Detail__c  <> 'Product Deprecated',
              Line_Level_Detail__c  <> 'Customer Credit')), TotalPrice,
            IF(
               AND(Opportunity_Record_Type__c  <>  'Amendment',  Line_Level_Type__c  <> 'Removed Product', 
                 OR(Line_Level_Detail__c <> 'New Logo',
                    Line_Level_Detail__c <> 'Cross Sell',
                    Line_Level_Detail__c <> 'Upgrade / Downgrade',
                    Line_Level_Detail__c  <> 'Services',
                    Line_Level_Detail__c  <> 'Product Churn',
                    Line_Level_Detail__c  <> 'Product Deprecated',
                    Line_Level_Detail__c  <> 'Customer Credit')), TotalPrice,
                IF(
                   AND(Opportunity_Record_Type__c  <>  'Amendment',  Line_Level_Type__c = 'Removed Product',
                     OR(Line_Level_Detail__c = 'Upgrade / Downgrade',
                        Line_Level_Detail__c = 'Migration',
                        Line_Level_Detail__c = 'Bundle Adj')), Combined_Renewed_Subscription_Total_Amt__c ,        

           0)
)
)
)

I know that the compilation error is due to things such as formulas on formulas, etc. But is there anything I can do to re-write it.
Hi all

I am working on a Aura component framwork where i need to show the Hirarchy wise pictorical diagram, with some struggle i was able to achive the functionality but i am not display subnodes for child node, like below diagram

any help will be very helpfull

User-added image
below is what is i have achieved

User-added image
 
public class OrgChartController
{
    @AuraEnabled
    public static String getContacts(String recordId)
    {
        List<BindNodes> bindNodesWrapperList = new List<BindNodes>();
        if(!String.isBlank(recordId))
        {
            Account currentAccount = [Select id,name,Phone from Account where id =: recordId limit 1];
            if(currentAccount!=null)
            {
                String AccountName = '';
                String AccountPhone ='';
                if(currentAccount.name!=null)
                {
                    AccountName =currentAccount.name;
                }
                if(currentAccount.Phone!=null)
                {
                    AccountPhone = String.valueOf(currentAccount.Phone);
                }
                bindNodesWrapperList.add(getMasterAccount(AccountName,AccountPhone));
            }
            set<string> setid = new set<string>();
            List<Contact> contactList = [SELECT Id, FirstName,
                                        LastName, Role__c, Status1__c FROM Contact WHERE Accountid =: recordId ORDER BY FirstName];
            if(!contactList.isEmpty())
            {
                for(Contact objcontact : contactList)
                {
                    if(objcontact.id != null)
                    {
                        setid.add(objcontact.id);
                    }
                }
                bindNodesWrapperList.addAll(getBindNodesContact(contactList,setid));
            }
        }
        if(!bindNodesWrapperList.isEmpty())
        {
            return JSON.serialize(bindNodesWrapperList);
        }
        return '';
    }
    public static BindNodes.NodeIcon getNodeIcon()
    {
        BindNodes.NodeIcon currentAccountNodeIcon = new BindNodes.NodeIcon();
        currentAccountNodeIcon.icon='';
        currentAccountNodeIcon.size=0;
        return currentAccountNodeIcon;
    }
    public static BindNodes.BorderColor getBorderColorMain()
    {
        BindNodes.BorderColor currentAccBorderColorMain = new BindNodes.BorderColor();
        currentAccBorderColorMain.red =15;
        currentAccBorderColorMain.green =140;
        currentAccBorderColorMain.blue =121;
        currentAccBorderColorMain.alpha =1;
        return currentAccBorderColorMain;
    }
    public static BindNodes.BorderColor getBorderColorNodeImage()
    {
        BindNodes.BorderColor currentAccBorderColorNodeImage = new BindNodes.BorderColor();
        currentAccBorderColorNodeImage.red =19;
        currentAccBorderColorNodeImage.green =123;
        currentAccBorderColorNodeImage.blue =128;
        currentAccBorderColorNodeImage.alpha =1;
        return currentAccBorderColorNodeImage;
    }
    public static BindNodes.BorderColor getBorderColorconnector()
    {
        BindNodes.BorderColor currentAccBorderColorconnector = new BindNodes.BorderColor();
        currentAccBorderColorconnector.red =220;
        currentAccBorderColorconnector.green =189;
        currentAccBorderColorconnector.blue =207;
        currentAccBorderColorconnector.alpha =1;
        return currentAccBorderColorconnector;
    }
    public static BindNodes.BorderColor getAccountBGColor()
    {
        BindNodes.BorderColor currentAccbgColor = new BindNodes.BorderColor();
        currentAccbgColor.red =235;
        currentAccbgColor.green =143;
        currentAccbgColor.blue =70;
        currentAccbgColor.alpha =1;
        return currentAccbgColor;
    }
    public static BindNodes.BorderColor getContactBGColor()
    {
        BindNodes.BorderColor currentContactbgColor = new BindNodes.BorderColor();
        currentContactbgColor.red =68; //160, 148, 237 ,1
        currentContactbgColor.green =212;
        currentContactbgColor.blue =59;
        currentContactbgColor.alpha =1;
        return currentContactbgColor;
    }
    public static BindNodes.NodeImage getNodeImage(BindNodes.BorderColor currentAccBorderColorNodeImage)
    {
        BindNodes.NodeImage bindNodeImage = new BindNodes.NodeImage();
        bindNodeImage.url = '';
        bindNodeImage.width = 100;
        bindNodeImage.height = 100;
        bindNodeImage.centerTopDistance = 0;
        bindNodeImage.centerLeftDistance = 0;
        bindNodeImage.cornerShape = 'CIRCLE';
        bindNodeImage.shadow = false;
        bindNodeImage.borderWidth = 0;
        bindNodeImage.borderColor = currentAccBorderColorNodeImage;
        return bindNodeImage;
    }    
    public static BindNodes getNode(BindNodes.NodeIcon currentAccountNodeIcon,BindNodes.BorderColor currentAccBorderColorMain,BindNodes.BorderColor currentAccBorderColorNodeImage,BindNodes.BorderColor currentAccBorderColorconnector,BindNodes.BorderColor currentAccbgColor,BindNodes.NodeImage bindNodeImage)
    {
       
        BindNodes currentAccount = new BindNodes();
      //  currentAccount.nodeId = 'O-1';
     //   currentAccount.parentNodeId = null;
        currentAccount.width = 342;
        currentAccount.height= 146;
        currentAccount.borderWidth= 1;
        currentAccount.borderRadius= 5;
        currentAccount.connectorLineWidth=5;
        currentAccount.dashArray='';
        currentAccount.expanded= false;
        currentAccount.directSubordinates=1;
        currentAccount.totalSubordinates=1;
        currentAccount.borderColor = currentAccBorderColorMain;
        currentAccount.backgroundColor=currentAccbgColor;
        currentAccount.nodeImage = bindNodeImage;
        currentAccount.nodeIcon = currentAccountNodeIcon;
//        currentAccount.template ='<div>\n<div style=\"margin-left:70px;\n margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\">'+AccountName+' </div>\n<div style=\"margin-left:70px;\n margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\">'+phone+' </div>\n</div>';
        currentAccount.connectorLineColor = currentAccBorderColorconnector;              
        return currentAccount;
    }
    public static BindNodes getMasterAccount(String AccountName,String phone)
    {
        BindNodes.NodeIcon currentAccountNodeIcon = getNodeIcon();
   
        BindNodes.BorderColor currentAccBorderColorMain =getBorderColorMain();
       
        BindNodes.BorderColor currentAccBorderColorNodeImage = getBorderColorNodeImage();
       
        BindNodes.BorderColor currentAccBorderColorconnector = getBorderColorconnector();
           
        BindNodes.BorderColor currentAccbgColor = getAccountBGColor();
       
        BindNodes.NodeImage bindNodeImage = getNodeImage(currentAccBorderColorNodeImage);
               
        BindNodes currentAccount = getNode(currentAccountNodeIcon,currentAccBorderColorMain,currentAccBorderColorNodeImage,currentAccBorderColorconnector,currentAccbgColor,bindNodeImage);
        currentAccount.nodeId = 'O-1';
        currentAccount.parentNodeId = null;
        currentAccount.template ='<div>\n<div align="center" style=\" margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\">'+AccountName+' </div>\n<div align="center" style=\" margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\">'+phone+' </div>\n</div>';
        return currentAccount;

    }
    public static List<BindNodes> getBindNodesContact(List<Contact> contactList,set<string> setid)
    {
        List<BindNodes> BindNodesList = new List<BindNodes>();
   
        BindNodes.NodeIcon currentAccountNodeIcon = getNodeIcon();
   
        BindNodes.BorderColor currentAccBorderColorMain =getBorderColorMain();
       
        BindNodes.BorderColor currentAccBorderColorNodeImage = getBorderColorNodeImage();
       
        BindNodes.BorderColor currentAccBorderColorconnector = getBorderColorconnector();
           
        BindNodes.BorderColor currentAccbgColor = getAccountBGColor();
       
        BindNodes.NodeImage bindNodeImage = getNodeImage(currentAccBorderColorNodeImage);
   
        BindNodes.BorderColor currentContactbgColor = getContactBGColor();
        Integer i = 2;
        String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        baseUrl = baseUrl + '/lightning/r/Contact/';
        map<id,list<contact>> mapcontact = new map<id,list<contact>>();
        list<contact> lstobjconts = new list<contact>();
        set<id> setnewids = new set<id>();
        if(setid.size() > 0)
        {
            for(integer j=1;j<=setid.size(); j++)
            {
                for(contact objcon1 : [select id,Firstname,lastname,Status1__c,ReportsToId,Role__c from contact where ReportsToId =:setid])
                {
                    if (setid.contains(objcon1.id))
                    {
                        setid.remove(objcon1.ReportsToId);
                    } else
                    {
                        lstobjconts.add(objcon1);
                        if(!mapcontact.containskey(objcon1.ReportsToId))
                        {
                            setnewids.add(objcon1.ReportsToId);
                            list<contact> lstcont = new list<contact>();
                            lstcont.add(objcon1);
                            mapcontact.put(objcon1.ReportsToId,lstcont);
                        }
                        else
                        {
                            mapcontact.get(objcon1.ReportsToId).add(objcon1);
                        }
                        setid.add(objcon1.id);
                        setid.remove(objcon1.ReportsToId);
                        j = j -1;
                    }
                }
            }
        }
        for(Contact con : contactList)
        {
            String contactfirstname ='';
            String contactlastname ='';
            String contactemail ='';
            String contactphone='';
           
            if(con.FirstName!=null)
            {
                contactfirstname = con.FirstName;
            }
            if(con.LastName!=null)
            {
                contactlastname = con.LastName;
            }
            if(con.Status1__c!=null)
            {
                contactemail = con.Status1__c;
            }
            if(con.Role__c!=null)
            {
                contactphone = String.valueOf(con.Role__c);
            }
            BindNodes currentContact = getNode(currentAccountNodeIcon,currentAccBorderColorMain,currentAccBorderColorNodeImage,currentAccBorderColorconnector,currentContactbgColor,bindNodeImage);
           
            currentContact.nodeId = 'O-'+String.valueOf(i);
            currentContact.parentNodeId='O-1';
            currentContact.template ='<div>'+contactemail+'\n<div align="center" style=\" font-size:20px;\n font-weight:bold;\n\"><a target=\"_blank\" href=\"'+ baseUrl + con.Id + '/view\">'+contactfirstname+' '+contactlastname+'</a></div>\n<div align="center" style=\" margin-top:20px;\n font-size:20px;\n font-weight:bold;\n\">'+contactphone+' </div>\n</div>';
            BindNodesList.add(currentContact);
            if(mapcontact.containskey(con.id))
            {
                integer count = i+1;
                for(id contid: setnewids)
                {
                    if(contid == con.id)
                    {
                        for(contact cont1 : mapcontact.get(contid))
                        {
                            String contactfirstname1 ='';
                            String contactlastname1 ='';
                            String contactemail1 ='';
                            String contactphone1='';
                           
                            if(cont1.FirstName!=null)
                            {
                                contactfirstname1 = cont1.FirstName;
                            }
                            if(cont1.LastName!=null)
                            {
                                contactlastname1 = cont1.LastName;
                            }
                            if(cont1.Status1__c!=null)
                            {
                                contactemail1 = cont1.Status1__c;
                            }
                            if(cont1.Role__c!=null)
                            {
                                contactphone1 = String.valueOf(cont1.Role__c);
                            }
                            if(cont1.id!=null)
                            {
                                con.id = cont1.id;
                            }
                            BindNodes currentContact1 = getNode(currentAccountNodeIcon,currentAccBorderColorMain,currentAccBorderColorNodeImage,currentAccBorderColorconnector,currentContactbgColor,bindNodeImage);
                           
                            currentContact1.nodeId = 'O-'+String.valueOf(count);
                            currentContact1.parentNodeId='O-'+String.valueOf(count-1);
                            currentContact1.template ='<div>'+contactemail1+'\n<div align="center" style=\" font-size:20px;\n font-weight:bold;\n\"><a target=\"_blank\" href=\"'+ baseUrl + cont1.Id + '/view\">'+contactfirstname1+' '+contactlastname1+'</a></div>\n<div align="center" style=\" margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\">'+contactphone1+' </div>\n</div>';
                            BindNodesList.add(currentContact1);
                            count++;
                        }
                    setnewids.remove(contid);
                    }
                }
                i = count;
            }

            else
                  if(mapcontact.containskey(con.id))
            {
                integer count = i+1;
                for(id contid: setnewids)
                {
                    if(contid == con.id)
                    {
                        for(contact cont2 : mapcontact.get(contid))
                        {
                            String contactfirstname2 ='';
                            String contactlastname2 ='';
                            String contactemail2 ='';
                            String contactphone2 ='';
                           
                            if(cont2.FirstName!=null)
                            {
                                contactfirstname2 = cont2.FirstName;
                            }
                            if(cont2.LastName!=null)
                            {
                                contactlastname2 = cont2.LastName;
                            }
                            if(cont2.Status1__c!=null)
                            {
                                contactemail2 = cont2.Status1__c;
                            }
                            if(cont2.Role__c!=null)
                            {
                                contactphone2 = String.valueOf(cont2.Role__c);
                            }
                            if(cont2.id!=null)
                            {
                                con.id = cont2.id;
                            }
                            BindNodes currentContact2 = getNode(currentAccountNodeIcon,currentAccBorderColorMain,currentAccBorderColorNodeImage,currentAccBorderColorconnector,currentContactbgColor,bindNodeImage);
                           
                            currentContact2.nodeId = 'O-'+String.valueOf(count);
                            currentContact2.parentNodeId='O-'+String.valueOf(count-1);
                            currentContact2.template ='<div>'+contactemail2+'\n<div align="center" style=\" font-size:20px;\n font-weight:bold;\n\"><a target=\"_blank\" href=\"'+ baseUrl + cont2.Id + '/view\">'+contactfirstname2+' '+contactlastname2+'</a></div>\n<div align="center" style=\" margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\">'+contactphone2+' </div>\n</div>';
                            BindNodesList.add(currentContact2);
                            count++;
                        }
                    setnewids.remove(contid);
                    }
                }
                i = count;
            }

                
                
            {
               i++;
            }
        }
       
        return BindNodesList;
    }
    public static List<BindNodes> getBindNodesAccount(List<Account> AccountList)
    {
        List<BindNodes> BindNodesList = new List<BindNodes>();
   
        BindNodes.NodeIcon currentAccountNodeIcon = getNodeIcon();
   
        BindNodes.BorderColor currentAccBorderColorMain =getBorderColorMain();
       
        BindNodes.BorderColor currentAccBorderColorNodeImage = getBorderColorNodeImage();
       
        BindNodes.BorderColor currentAccBorderColorconnector = getBorderColorconnector();
           
        BindNodes.BorderColor currentAccbgColor = getAccountBGColor();
       
        BindNodes.NodeImage bindNodeImage = getNodeImage(currentAccBorderColorNodeImage);
   
        BindNodes.BorderColor currentContactbgColor = getContactBGColor();
       
        Integer i = 2;
        String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        baseUrl = baseUrl + '/lightning/r/Account/';
        system.debug('===> baseUrl '+ baseUrl);
        for(Account currentAccountData: AccountList)
        {
            String accountName='';
            if(currentAccountData.Name!=null)
            {
                accountName = currentAccountData.name;
            }
            String accountPhone='';
            if(currentAccountData.Phone!=null)
            {
                accountPhone = String.valueOf(currentAccountData.Phone);
            }
            BindNodes currentAccount = getNode(currentAccountNodeIcon,currentAccBorderColorMain,currentAccBorderColorNodeImage,currentAccBorderColorconnector,currentContactbgColor,bindNodeImage);
            currentAccount.nodeId = 'O-'+String.valueOf(i);
            currentAccount.parentNodeId='O-1';
            currentAccount.template ='<div align="center">\n<div align="center" style=\" margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\"><a target=\"_blank\" href=\"'+ baseUrl + currentAccountData.Id + '/view\">'+accountName+'</a></div>\n<div align="center" style=\" margin-top:10px;\n font-size:20px;\n font-weight:bold;\n\">'+accountPhone+' </div>\n</div>';
            BindNodesList.add(currentAccount);
            i++;
        }
        return BindNodesList;
    }
}
-----------------------------------------------------------------------------------------------------------
Subclass for above class

public class BindNodes {
    public BindNodes()
    {
    }

    public class NodeImage {
        public NodeImage()
        {
        }
        public String url {get;set;} 
        public Integer width {get;set;} 
        public Integer height {get;set;} 
        public Integer centerTopDistance {get;set;} 
        public Integer centerLeftDistance {get;set;} 
        public String cornerShape {get;set;} 
        public Boolean shadow {get;set;} 
        public Integer borderWidth {get;set;} 
        public BorderColor borderColor {get;set;} 

        public NodeImage(JSONParser parser) {
            while (parser.nextToken() != System.JSONToken.END_OBJECT) {
                if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
                    String text = parser.getText();
                    if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
                        if (text == 'url') {
                            url = parser.getText();
                        } else if (text == 'width') {
                            width = parser.getIntegerValue();
                        } else if (text == 'height') {
                            height = parser.getIntegerValue();
                        } else if (text == 'centerTopDistance') {
                            centerTopDistance = parser.getIntegerValue();
                        } else if (text == 'centerLeftDistance') {
                            centerLeftDistance = parser.getIntegerValue();
                        } else if (text == 'cornerShape') {
                            cornerShape = parser.getText();
                        } else if (text == 'shadow') {
                            shadow = parser.getBooleanValue();
                        } else if (text == 'borderWidth') {
                            borderWidth = parser.getIntegerValue();
                        } else if (text == 'borderColor') {
                            borderColor = new BorderColor(parser);
                        } else {
                            System.debug(LoggingLevel.WARN, 'NodeImage consuming unrecognized property: '+text);
                            consumeObject(parser);
                        }
                    }
                }
            }
        }
    }
    
    public String nodeId {get;set;} 
    public String parentNodeId {get;set;} 
    public Integer width {get;set;} 
    public Integer height {get;set;} 
    public Integer borderWidth {get;set;} 
    public Integer borderRadius {get;set;} 
    public BorderColor borderColor {get;set;} 
    public BorderColor backgroundColor {get;set;} 
    public NodeImage nodeImage {get;set;} 
    public NodeIcon nodeIcon {get;set;} 
    public String template {get;set;} 
    public BorderColor connectorLineColor {get;set;} 
    public Integer connectorLineWidth {get;set;} 
    public String dashArray {get;set;} 
    public Boolean expanded {get;set;} 
    public Integer directSubordinates {get;set;} 
    public Integer totalSubordinates {get;set;} 

    public BindNodes(JSONParser parser) {
        while (parser.nextToken() != System.JSONToken.END_OBJECT) {
            if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
                String text = parser.getText();
                if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
                    if (text == 'nodeId') {
                        nodeId = parser.getText();
                    } else if (text == 'parentNodeId') {
                        parentNodeId = parser.getText();
                    } else if (text == 'width') {
                        width = parser.getIntegerValue();
                    } else if (text == 'height') {
                        height = parser.getIntegerValue();
                    } else if (text == 'borderWidth') {
                        borderWidth = parser.getIntegerValue();
                    } else if (text == 'borderRadius') {
                        borderRadius = parser.getIntegerValue();
                    } else if (text == 'borderColor') {
                        borderColor = new BorderColor(parser);
                    } else if (text == 'backgroundColor') {
                        backgroundColor = new BorderColor(parser);
                    } else if (text == 'nodeImage') {
                        nodeImage = new NodeImage(parser);
                    } else if (text == 'nodeIcon') {
                        nodeIcon = new NodeIcon(parser);
                    } else if (text == 'template') {
                        template = parser.getText();
                    } else if (text == 'connectorLineColor') {
                        connectorLineColor = new BorderColor(parser);
                    } else if (text == 'connectorLineWidth') {
                        connectorLineWidth = parser.getIntegerValue();
                    } else if (text == 'dashArray') {
                        dashArray = parser.getText();
                    } else if (text == 'expanded') {
                        expanded = parser.getBooleanValue();
                    } else if (text == 'directSubordinates') {
                        directSubordinates = parser.getIntegerValue();
                    } else if (text == 'totalSubordinates') {
                        totalSubordinates = parser.getIntegerValue();
                    } else {
                        System.debug(LoggingLevel.WARN, 'BindNodes consuming unrecognized property: '+text);
                        consumeObject(parser);
                    }
                }
            }
        }
    }
    
    public class BorderColor {
        public BorderColor()
        {
        }
        public Integer red {get;set;} 
        public Integer green {get;set;} 
        public Integer blue {get;set;} 
        public Integer alpha {get;set;} 

        public BorderColor(JSONParser parser) {
            while (parser.nextToken() != System.JSONToken.END_OBJECT) {
                if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
                    String text = parser.getText();
                    if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
                        if (text == 'red') {
                            red = parser.getIntegerValue();
                        } else if (text == 'green') {
                            green = parser.getIntegerValue();
                        } else if (text == 'blue') {
                            blue = parser.getIntegerValue();
                        } else if (text == 'alpha') {
                            alpha = parser.getIntegerValue();
                        } else {
                            System.debug(LoggingLevel.WARN, 'BorderColor consuming unrecognized property: '+text);
                            consumeObject(parser);
                        }
                    }
                }
            }
        }
    }
    
    public class NodeIcon {
        public NodeIcon()
        {
        }
        public String icon {get;set;} 
        public Integer size {get;set;} 

        public NodeIcon(JSONParser parser) {
            while (parser.nextToken() != System.JSONToken.END_OBJECT) {
                if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) {
                    String text = parser.getText();
                    if (parser.nextToken() != System.JSONToken.VALUE_NULL) {
                        if (text == 'icon') {
                            icon = parser.getText();
                        } else if (text == 'size') {
                            size = parser.getIntegerValue();
                        } else {
                            System.debug(LoggingLevel.WARN, 'NodeIcon consuming unrecognized property: '+text);
                            consumeObject(parser);
                        }
                    }
                }
            }
        }
    }
    
    
    public static List<BindNodes> parse(String json) {
        System.JSONParser parser = System.JSON.createParser(json);
        return arrayOfBindNodes(parser);
    }
    
    public static void consumeObject(System.JSONParser parser) {
        Integer depth = 0;
        do {
            System.JSONToken curr = parser.getCurrentToken();
            if (curr == System.JSONToken.START_OBJECT || 
                curr == System.JSONToken.START_ARRAY) {
                depth++;
            } else if (curr == System.JSONToken.END_OBJECT ||
                curr == System.JSONToken.END_ARRAY) {
                depth--;
            }
        } while (depth > 0 && parser.nextToken() != null);
    }
    
    public static List<BindNodes> arrayOfBindNodes(System.JSONParser p) {
        List<BindNodes> res = new List<BindNodes>();
        if (p.getCurrentToken() == null) p.nextToken();
        while (p.nextToken() != System.JSONToken.END_ARRAY) {
            res.add(new BindNodes(p));
        }
        return res;
    }
}

 
I'm currently working on the Trailhead unit Set Up Jest Test Framework (https://trailhead.salesforce.com/content/learn/modules/test-lightning-web-components/set-up-jest-testing-framework?trail_id=build-lightning-web-components)

I am in the directory with my project and I'd like to install Jest into the project.

However, Sfdx seems unable to find npm even though it is clearly installed:
 
D:\tutorials\SFDC2020\Summer20>npm --version
6.14.5

D:\tutorials\SFDC2020\Summer20>sfdx force:lightning:lwc:test:setup
ERROR running force:lightning:lwc:test:setup:  npm command not found. Verify npm is properly installed and try again.

What is wrong and how can I fix it?


 
Hello all

I am New to the Aura Componets, i am trying to Build Tree Structure Pictorical Diagram where related contacts should show 
for Parent Account, any help would highly be appriated

User-added imageMy Code
Apex code

public class AccountTreeMapClass {

   @AuraEnabled
   public static account getaccountData(string recId){
       return [select id, name, Company_Head__c,Sales_Team__c,SalesManager__c,Department__c,Director__c, HR_Team__c, Manager1__c, Team_Manager1__c,
               Manager2__c, Team_Manager2__c From account where id=: recId];
   } 
}
-----------------------------

Component


<aura:component controller="AccountTreeMapClass" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="acc" type="Account"/>
    <aura:attribute name="recordId"  type="String" default = "0012w0000085dU4AAI" />
    <aura:handler event="force:refreshView" action="{! c.doInit}" />
    <aura:handler name="init" value="{! this}" action="{! c.doInit}" />
    
    
    <lightning:layout>
        <div class="slds-scrollable" style="height:24rem;width:50rem;background-color: antiquewhite;">
            <body style="margin-top: -19px;">
                <div class="tree"  style="width:200%">
                    <aura:if isTrue="{!not(empty(v.acc.Department__c))}">																																
                        
                        <ul>
                            <li>
                                <p class="bg1"><ui:outputText value="{!v.acc.Department__c}"></ui:outputText> Group</p>
                                <ul>
                                    <li>
                                        <p class="slds-text-heading--medium"  style="background-color: yellow;width: 65px;word-break: break-all;">CEO</p> 
                                        <aura:if isTrue="{!not(empty(v.acc.Company_Head__c))}">
                                            <ul>
                                                <li  class="testry">
                                                    <p class="slds-text-heading--medium" style="background-color: lightblue;width: 65px;word-break: break-all;">{!v.acc.Company_Head__c}</p>
                                                </li>
                                            </ul>
                                        </aura:if>
                                    </li>
                                    <li>
                                        <p class="slds-text-heading--medium"  style="background-color: yellow;Width: 65px;word-break: break-all;">Director</p>			
                                        <aura:if isTrue="{!not(empty(v.acc.Director__c))}">
                                            <ul>
                                                <li>
                                                    <p class="slds-text-heading--medium" style="background-color: lightblue;width: 65px;word-break: break-all;"> {!v.acc.Director__c}</p>
                                                </li>
                                            </ul>
                                        </aura:if>
                                    </li>
                                    <li>
                                        <p class="slds-text-heading--medium"  style="background-color: yellow;width: 65px;word-break: break-all;">HR Department</p>
                                        <aura:if isTrue="{!not(empty(v.acc.HR_Team__c))}">
                                            <ul>
                                                <li>
                                                    <p class="slds-text-heading--medium" style="background-color: lightblue;width: 65px;word-break: break-all;"> {!v.acc.HR_Team__c}</p>
                                                </li>
                                            </ul>
                                        </aura:if>
                                    </li>
                                    
                                    <li>
                                        <p class="slds-text-heading--medium"  style="background-color: yellow;width: 65px;word-break: break-all;">Project Manager1</p>
                                        <aura:if isTrue="{!not(empty(v.acc.Manager1__c))}">
                                            <ul>
                                                
                                                <li>
                                                    <p class="slds-text-heading--medium" style="background-color: lightblue;width: 65px;word-break: break-all;">{!v.acc.Manager1__c}</p>
                                                    <ul>
                                                        <li>
                                                            <p class="slds-text-heading--medium" style="background-color: lightgray;width: 65px;word-break: break-all;">{!v.acc.Team_Manager1__c}</p>
                                                        </li>
                                                        
                                                    </ul>
                                                </li>
                                            </ul>
                                        </aura:if>
                                    </li>
                                    <li>
                                        <p class="slds-text-heading--medium" style="background-color: yellow;width: 65px;word-break: break-all;">Project Manager2</p>
                                        <aura:if isTrue="{!not(empty(v.acc.Manager2__c))}">
                                            <ul>
                                                <li style="background-color: antiquewhite;">
                                                    <p class="slds-text-heading--medium" style="background-color: lightblue;width: 65px;word-break: break-all;"> {!v.acc.Manager2__c}</p>
                                                    <ul>
                                                        <li style="background-color: antiquewhite;">
                                                            <p class="slds-text-heading--medium" style="background-color: lightgray;width: 65px;word-break: break-all;">Yeshwanth</p><!--{!v.keyResult.Team_Manager2__c}-->
                                                        </li>
                                                        <li style="background-color: antiquewhite;">
                                                            <p class="slds-text-heading--medium" style="background-color: lightgray;width: 65px;word-break: break-all;">Sai</p>
                                                        </li>
                                                        
                                                    </ul>
                                                </li>
                                                
                                            </ul>
                                        </aura:if>
                                    </li>
                                    <li>
                                        <p class="slds-text-heading--medium"  style="background-color: yellow;width: 65px;word-break: break-all;">Sales Department</p>
                                        <aura:if isTrue="{!not(empty(v.acc.Sales_Team__c))}">
                                            <ul>
                                                <li class="test" style="background-color: antiquewhite;">
                                                    <p class="slds-text-heading--medium" style="background-color: lightblue;width: 65px;word-break: break-all;">{!v.acc.Sales_Team__c}</p>
                                                </li>
                                            </ul>
                                        </aura:if>
                                    </li>
                                    <li>
                                        <p class="slds-text-heading--medium"  style="background-color: yellow;width: 65px;word-break: break-all;">Sales Project Manager</p>
                                        <aura:if isTrue="{!not(empty(v.acc.SalesManager__c))}">
                                            <ul>
                                                <li class="test">
                                                    <p class="slds-text-heading--medium" style="background-color: lightblue;width: 65px;word-break: break-all;">{!v.acc.SalesManager__c}</p>
                                                </li>
                                            </ul>
                                        </aura:if>
                                    </li>
                                    
                                </ul>
                            </li>
                        </ul>
                    </aura:if>
                </div>
            </body>
        </div>
        
    </lightning:layout>
    
    <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
    
    <div class="tree11" >
        <body>
            <a style="background-color: lightgreen;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Account</a>
            <img src="{!$Resource.Capture1}" style="margin-left: 126px;margin-top: -43px;width: 80px;margin-left: 0px;height: 38px;margin-top: -10px;border: 2px solid aliceblue;border-radius: 14px;"/>
            
            <ul>
                <li>
                    <a  style="background-color: yellow;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact1</a>
                    <ul>
                        <li>
                            <a  style="background-color: lightblue;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;"> {!v.acc.Company_Head__c}</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a style="background-color: yellow;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact2</a>
                    <ul>
                        <li>
                            <a style="background-color: lightblue;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;"> {!v.acc.Director__c}</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a style="background-color: yellow;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact3</a>
                    <ul>
                        <li>
                            <a style="background-color: lightblue;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;"> {!v.acc.HR_Team__c}</a>
                        </li>
                    </ul>
                </li>
                
                <li>
                    <a  style="background-color: yellow;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact4</a>
                    <ul>
                        <li>
                            <a  style="background-color: lightblue;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact5</a>
                            <ul>
                                <li>
                                    <a  style="background-color: lightgray;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact6</a><!--{!v.keyResult.Team_Manager1__c}-->
                                </li>
                                <li>
                                    <a  style="background-color: lightgray;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact7</a>
                                </li>
                                <li>
                                    <a style="background-color: lightgray;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact8</a>
                                </li>
                                <li>
                                    <a style="background-color: lightgray;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Contact9</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </li>
                <li>
                    <a style="background-color: yellow;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Project Manager2</a>
                    <ul>
                        <li>
                            <a  style="background-color: lightblue;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;"> {!v.acc.Manager2__c}</a>
                            <ul>
                                <li>
                                    <a  style="background-color: lightgray;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Yeshwanth</a><!--{!v.keyResult.Team_Manager2__c}-->
                                </li>
                                <li>
                                    <a  style="background-color: lightgray;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Sai</a>
                                </li>
                                
                            </ul>
                        </li>
                    </ul>
                </li>
                <li>
                    
                    <a   style="background-color: yellow;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Sales Department</a>
                    <ul>
                        <li>
                            <a  style="background-color: lightblue;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Ila, Nikhil</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a  style="background-color: yellow;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Sales Project Manager</a>
                    <ul>
                        <li>
                            <a style="background-color: lightblue;font-weight: 300;font-size: 17px;border: 2px solid red;border-radius: 4px;">Haider</a>
                        </li>
                    </ul>
                </li>
                
            </ul>
        </body>
    </div>
    
</aura:component>

----------------------------

J.s code

({
    doInit: function (component, event, helper) {
        var action= component.get("c.getaccountData");
        action.setParams({
            recId: component.get("v.recordId")
        });
        action.setCallback(this, function(res) {
            var state=res.getState();
            var r = res.getReturnValue();
            if(state==="SUCCESS"){
                component.set("v.acc", r);
            }
        });
     $A.enqueueAction(action);              
    },
   
    recordUpdate: function (component, event, helper) {
        var accountFields = component.get("v.keyResult");
        var items = [{
            "label": "Department Of Proseraa",
            "name": "1",
            "expanded": true,
            "items": [{
                "label": "CEO",
                "name": "2",
                "expanded": true,
                "items" :[{
                    "label": accountFields.Company_Head__c,
                    "name": "3",
                    "expanded": true,
                }]
            },{
                "label": "Director",
                "name": "4",
                "expanded": true,
                "items" :[{
                    "label": accountFields.Director__c,
                    "name": "3",
                    "expanded": true,
                }]
            },{
                "label": "HR Team",
                "name": "5",
                "expanded": true,
                "items" :[{
                    "label": accountFields.HR_Team__c,
                    "name": "3",
                    "expanded": true,
                }]
            },{
                "label": "Project Manager",
                "name": "6",
                "expanded": true,
                "items" :[{
                    "label": accountFields.Manager1__c,
                    "name": "7",
                    "expanded": true,
                    "items" :[{
                        "label": accountFields.Team_Manager1__c,
                        "name": "8",
                        "expanded": true,
                    }]
                },{
                    "label":  accountFields.Manager2__c,
                    "name": "9",
                    "expanded": true,
                   
                    "items" :[{
                        "label": accountFields.Team_Manager2__c,
                        "name": "10",
                        "expanded": true,
                        'tag': 'button',
                    }]
                }]
            }],
           
           
        }];
        component.set('v.items', items);
    },
})

----------------------

css


.THIS .tree ul {
    padding-top: 20px; position: relative;
    transition: all 0.5s;
}


.THIS .tree li {
    float: left; text-align: center;
    list-style-type: none;
    position: relative;
    padding: 40px 0px 0 3px;
   
    transition: all 0.5s;
    margin-left: -1px;
}

.THIS .tree li::before, .THIS .tree li::after{
    content: '';
    position: absolute; top: 0; right: 50%;
    border-top: 2px solid blue;
    width: 55%; height: 40px;
}

.THIS .tree li::after{
    right: auto; left: 50%;
    border-left: 2px solid blue;
}



/*We need to remove left-right connectors from elements without
any siblings*/
.THIS .tree li:only-child::after, .THIS .tree li:only-child::before {
    display: none;
}

/*Remove space from the top of single children*/
.THIS .tree li:only-child{ padding-top: 0;}

/*Remove left connector from first child and
right connector from last child*/
.THIS .tree li:first-child::before, .THIS .tree li:last-child::after{
    border: 0 none;
}
/*Adding back the vertical connector to the last nodes*/
.THIS .tree li:last-child::before{
    border-right: 2px solid blue;
    border-radius: 0 5px 0 0;}
.THIS .tree li:first-child::after{
    border-radius: 10px 0 0 0;
}

/*Time to add downward connectors from parents*/
.THIS .tree ul ul::before{
    content: '';
    position: absolute; top: 0; left: 49%;
    border-left: 3px solid blue;
    width: 0; height: 20px;
}

.THIS .test{
    position: absolute; top: 0;
}

.THIS .bg1{
    background-color: lightgreen;
}


.THIS .tree ul ul:empty::before{
    display: none;
}
.THIS .tree li p{
    border: 1px solid red;
    padding: 5px 10px;
    text-decoration: none;
    color: #666;
    font-family: arial, verdana, tahoma;
    font-size: 10px;
    display: inline-block;
    border-radius: 5px;
    transition: all 0.5s;
    border-right: 2px solid red;
}

/*Time for some hover effects*/
/*We will apply the hover effect the the lineage of the element also*/
.THIS .tree li p:hover, .THIS .tree li p:hover+ul li p {
    background: #c8e4f8; color: #000; border: 1px solid #94a0b4;
}
/*Connector styles on hover*/
.THIS .tree li p:hover+ul li::after,
.THIS .tree li p:hover+ul li::before,
.THIS .tree li p:hover+ul::before,
.THIS .tree li p:hover+ul ul::before{
    border-color:  #94a0b4;
}

.THIS.tree11{
    margin:0 auto;
    width: 100%;
}

.THIS.tree11 ul{
    padding: 10px 5px 0 5px;
    position: relative;
    z-index: 1;
}


.THIS.tree11 li{
    margin-left: 28px;
    list-style-type: none;
    position: relative;
    padding: 5px 5px 0 5px;
}

.THIS.tree11 li::after{
    content: '';
    position: absolute;
    border-bottom: 3px solid #c61f1f;
    border-left: 3px solid #c61f1f;
    height: 33px;
    width: 15px;
    right: auto;
    left: -10px;
    top: -11px;
    padding: -2px 10px;
    border-radius:2px;
}

-----------------------------------------------------

<aura:application extends="Force:slds">
    <c:TreePicture />
</aura:application>


 
I'd like to put up a list of items such that all are always visible, not like a combo box / dropdown.  One is preselected and the user may leave it or select a different one.  I can do it with a single tag with lightning:radioGroup.  But radioGroup only always the label to be text.  I'd like to have a litlte block with an icon and a name.  I'd like something like the example "Tiles in a List" on lightning-tile where one item may be selected.

Any idea of a tag, combination of tags, are styles to do that, preferable a snippet of code as an example.
Hi, I'm trying to create an LWC that displays a datatable of records from a custom obect called Match__c. I want to display the record Id, the participant, and volunteer fields in the datatable where the field volunteer job on the Match record equals the record id of the page being viewed. I created an apex controller to pull the data. The table will not display any data even though I have permissions to the object/fields. On load the console displays "DevTools Failed to Load Source Map". Here are some pictures: 

Apex Controller
User-added imageJS
User-added imageHTML
User-added imageComponent
User-added image
Any help would be appreciated. This is my first LWC.
Hi guys,

I am on my way to search for a solution in lwc that is able to provide a smooth transition during scrolling on app page for https://lightningdesignsystem.com/components/page-headers/#Record-Home

It should have the same 'animation' like every hightlight panel on a record page. Is there someone who could help me with that?

What I've already done was translate Record Home to lwc template:
<template>
    <div class="slds-page-header slds-page-header_record-home slds-is-fixed" style="z-index: 99; width: 98%;">
        <div class="slds-page-header__row">
            <div class="slds-page-header__col-title">
                <div class="slds-media">
                    <div class="slds-media__figure">
                        <span class="slds-icon_container">
                            <slot name="icon"></slot>
                        </span>
                    </div>
                    <div class="slds-media__body">
                        <div class="slds-page-header__name">
                            <div class="slds-page-header__name-title">
                                <h1>
                                    <slot name="objectLabelSingular"></slot>
                                    <slot name="recordName" class="slds-page-header__title slds-truncate"></slot>
                                </h1>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <template if:true={showPageHeaderActions}>
                <div class="slds-page-header__col-actions">
                    <div class="slds-page-header__controls">
                        <div class="slds-page-header__control">
                            <lightning-button-group>
                                <!-- <template if:true={showButtonGroup}> -->
                                    <template for:each={listOfVisibleButton} for:item="button">
                                        <lightning-button
                                            key={button.name}
                                            name={button.name}
                                            label={button.label}
                                            title={button.title}
                                            icon-name={button.iconName}
                                            onclick={handlePageHeaderActionClicked}
                                        ></lightning-button>
                                    </template>
                                <!-- </template> -->
                                <template if:true={showLightningButtonMenu}>
                                    <lightning-button-menu alternative-text="Show menu" menu-alignment="auto" variant="border-filled">
                                        <template for:each={listOfMenuItem} for:item="menuItem">
                                            <lightning-menu-item
                                                key={menuItem.name}
                                                label={menuItem.label}
                                                value={menuItem.name}
                                                icon-name={menuItem.iconName}
                                            ></lightning-menu-item>
                                        </template>
                                    </lightning-button-menu>
                                </template>
                            </lightning-button-group>
                        </div>
                    </div>
                </div>
            </template>
        </div>
    </div>
</template>

But I stuck on the dynamic part of this scrolling aninmation on my app page. Currently I'm working on show and hide buttons in button-group and move them to lightning-menu-item if you shrink the size of your browser horizontal.

I really appreciate every single help. Thank you.


Best regards,
Chris
Hi guys,
We just created a library named R.apex, which helps simplify the common tasks in apex code development by adopting a functional style.
It offers tons of utility functions to work with lists, sets, maps and sobjects, making apex code clean and readable. We were suffering from the pain points of writing similar Apex code to complete trivial tasks once and once again, and that is the reason why we want to stop that and start to write reusable code. Here are some examples of what R.apex can do:
 
// Reverse a list
List<Integer> reversedList = R.of(new List<Integer>{ 1, 2, 3 })
    .reverse()
    .toIntegerList();
 
// Fina specific account
List<Account> accountList = ...;
Account acc = (Account)R.of(accountList)
    .find(R.whereEq.apply(new Map<String, Object>{
        'LastName' => 'Wilson',
        'IsDeleted' => false
    }))
    .toSObject();

Hopefully R.apex can help make your Apex code development easier, and you are always welcome to give feedback so that we can improve it.

R.apex is an open source project hosted at https://github.com/Click-to-Cloud/R.apex/.
You can check it out. Feel free to clone it, make changes or submit a PR.

^_^

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.