• RyanSchierholz
  • NEWBIE
  • 70 Points
  • Member since 2018
  • Director or Operations
  • Kenney & Company Real Estate

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 26
    Replies
I am trying to build a Lightning Component for a home page that will display three buttons with each one opening up a different link.  

The buttons are all lined up against the border on the left. How do I add padding so that they are all aligned just off of the border?

User-added image

Here is my code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <lightning:card>
        <aura:set attribute="title">
            <lightning:icon iconName="utility:open_folder" size="small" />
            XYZ Reports
        </aura:set>
  
        <lightning:button label="Download XYZ Report" onclick="{! c.downloadClick}" iconName="utility:download" iconPosition="left" /><br/>
        <br/>
        <lightning:button label="View XYZ Report" onclick="{! c.viewReportClick}" /><br/>
        <br/>
        <lightning:button label="View XYZ Dashboard" onclick="{! c.viewDashClick}" /> <br/>  
        
    </lightning:card>
</aura:component>

 
I have the following component for my Community dispaying specific fields pulled from the user's Account object. How can I style the lightning:outputFields? I have wrapped the lightning:outputFields in a Div wrapper and tried to style that but doesn't work. Any suggestions?
<aura:component controller="AccountDisplayController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="accountId" type="string" default = '0010r00000BtdLoAAJ'/>
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    
    <aura:if isTrue="{! not( empty( v.accountId ) ) }">
        <div class="billingtitle"><h1>Billing Information</h1></div>
        <lightning:recordViewForm recordId="{!v.accountId}" objectApiName="Account">
            
            <div class="slds-grid">
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Agreement_Date__c"/>
                    <lightning:outputField fieldName="Renewal_Date__c"/>
                </div>
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Product_Service1__c"/>
                    <lightning:outputField fieldName="Number_of_Seats_Purchased__c"/>
                </div>
            </div>
        </lightning:recordViewForm>
    </aura:if>
</aura:component>

 
Our users are required to complete assigned learning. I would like to track the completion date of certain learning items on the User record in custom fields. It's possible with a Process Builder process to have a node for each learning Id and if complete, update the respective field on the User account. However, each time we add one to track, the process would need to be updated and reactivated. I would like to accomplish this through custom metadata and a Flow. The custom metadata has an LearningId field and UserFieldAPI. The Flow would take the completed learning Id and compare with the custom metadata, returning a matching UserFieldAPI (i.e. BasicLearningCompletionDate__c). Then, using a variable, I could update the User record field that matches that field API. And then when we need to make changes, we don't have to update the process or flow, but just add a new metadata record with the LearningId and UserFieldAPI. 

Is this possible in a flow?
The ultimate goal is to be able to iterate over an array in a Lightning web component to show internal reviews about our vendors. There would be at least three levels: Super Category, Category, Review (maybe even four: Super Category, Category, Vendor, Review), so that the root lists are not repeated in the display. For example:

Super Category 1
-Category A
--Review 00
--Review 01
-Category B
--Review 02

Super Category 2
-Category C
--Review 03

Super Category is Parent over Category, which is parent over Review. Review also has references to Super Category. 

ultimately the array might look like this:
superCategories = [
        {
            Name: 'Additions',
            Categories: [
                {
                    Name: 'Bathroom Additions',
                    Reviews: [
                        {
                            Vendor: 'Jay at Pritches Closets',
                            Rating: 5,
                            Comment: 'this is the comment',
                            Phone: '8005551234'
                        }
                    ]
                },
                {
                    Name: 'Kitchen Additions',
                    Reviews: [
                        {
                            Vendor: 'Phil Dunphy',
                            Rating: 4,
                            Comment: 'this is the comment',
                            Phone: '8005551234'
                        }
                    ]
                }
            ]
        }
    ];

What is the best way to accomplish this? In the Controller or the .js of the component? And how?
I am building a list of our preferred vendors and want to show it in a custom lightning web component. I would like all vendors of the same 'Category' to be listed together, with just one header. 
User-added image

As you can see, when there are multiple vendors in one cateogry, the category name/head displays twice. I am sure I could get what I need, through making multiple calls in apex (one for each category), but it seems ideal and more efficient to get all the vendors in one call, and then just adjust their grouping in the lightning web component. 

I query the data in the controller, then display it in the lwc as such: 
<template for:each={vendors.data} for:item="vendor">
                <div key={vendor.Id}>                   
                    <div class="slds-text-heading_small">{vendor.Category_Name__c}</div>
                    <p><lightning-formatted-rich-text value={vendor.Vendor__c} ></lightning-formatted-rich-text></p>
                </div>
            </template>

 
I have two buttons on a Lightning Web Component on a record page. When each is clicked, the code they run is virtually identical, so I want to reuse the code as much as possible. However, I cannot figure out the best way to do it. I can pass the button name into the code, but when I try to put the "let record + fields" code into the switch or conditional if statements, it doesnt work. I need to pass a different field name into the 'let record' statement, depending on which button is pressed. 
 
handleActivateBuyerSide() {
        this.loading = true;
        
        let record = {
            fields: {
                Id: this.recordId,
                VirtualTCStatus_BuyerSide__c: 'Active',        
            },
        };
        updateRecord(record)
            // eslint-disable-next-line no-unused-vars
            .then(() => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Record Is Updated',
                        variant: 'success',
                    }),
                );
                this.loading = false;

            })
            .catch(error => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error on data save',
                        message: error.message.body,
                        variant: 'error',
                    }),
                );
                this.loading = false;

            });
    }
    handleActivateSellerSide() {
        this.loading = true;
        
        let record = {
            fields: {
                Id: this.recordId,
                VirtualTCStatus_SellerSide__c: 'Active',        
            },
        };
        updateRecord(record)
            // eslint-disable-next-line no-unused-vars
            .then(() => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Record Is Updated',
                        variant: 'success',
                    }),
                );
                this.loading = false;

            })
            .catch(error => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error on data save',
                        message: error.message.body,
                        variant: 'error',
                    }),
                );
                this.loading = false;

            });
    }

 
I am building a custom page, and I want certain items to show depending on which step in a path is clicked, but not yet active/updated. Pretty much similar to the built-in Guidance for Success on objects; as you click each step, the data below changes, even before you Mark as Current Step. 

Here is my lightning-progress-indicator path. I would love to get the value of the selected lightning-progress-step
<lightning-progress-indicator id="phasePath"  current-step={phaseValue} type="path" variant="base" onclick={handlePathClick}>
                                <lightning-progress-step label="Welcome" value="PX"></lightning-progress-step>
                                <lightning-progress-step label="Getting Started" value="P0"></lightning-progress-step>
                                <lightning-progress-step label="Get Licensed" value="P1"></lightning-progress-step>
                                <lightning-progress-step label="Orientation" value="P2"></lightning-progress-step>
                                <lightning-progress-step label="Mentorship" value="P3"></lightning-progress-step>
                            </lightning-progress-indicator>

 
Hey fam, I have a trigger that runs after an Closing is complete/closed that will sum the other Closings volume and commission. Then, cycle through the Goals the User has added for this year, and update their progress towards their goal. This is one of my first Triggers, and I am obviously new to the game. I found some guides on bulkifying the code, but most of those were for single object or related object triggers. These two objects are unrelated. Is there anything I can do to optimize this? Thanks! 
trigger UpdateGoals on pba__Closing__c (after update, after insert) {
    
    //	loop through each closing that is updated/insert.
    for(pba__Closing__c c : Trigger.New)
    {
        //	If the closing is CLOSED, then do some work. 
        if (c.Closing_Status__c == 'Closed'){
            
            String Owner = c.OwnerId;
            Date d = c.ClosingDate__c;
            Integer yr = d.year();

            //	get the sum of fields on the Closed closings of the closed date of the closing, by the owner. 
            AggregateResult[] getSums = [SELECT SUM(Sales_Volume__c) sales_volume, 
                                         SUM(Agent_True_Gross_Commission_Total__c) sum_commissions,
                                      
                                         FROM pba__Closing__c
                                         WHERE Closing_Year__c = :yr
                                         AND Closing_Status__c = 'Closed'
                                         AND OwnerId = :Owner
                                        ];  

            //	loop through each GOAL of the associated user and year
            for (Goal__c g : [SELECT Id, Name, Actual_Value__c, OwnerId, Goal_Field__c
                              FROM Goal__c
                              WHERE OwnerId = :Owner
                              AND Year__c = :yr ]) 
            {
                //	CASE through Goal_Field__c to update 
                switch on g.Goal_Field__c {
                    when 'Sales_Volume' {
                        g.Actual_Value__c = Integer.valueOf(getSums[0].get('sales_volume'));
                        update g;
                    }
                   
                    when 'Net_Commission' {
                        g.Actual_Value__c = Integer.valueOf(getSums[0].get('sum_commissions'));
                        update g;
                    }
                    
                    
                }                
            }
        }
    }
}


 
What do you use when plain text, letterhead, custom HTML, and Visualforce email templates won't work?!
First, it's infuriating to use Custom HTML email templates and IF statements; they are extremely finicky! For example, I can't get this to show the true OR false elements:
{!IF(ISBLANK(pba__Closing__c.Inspection_Date__c), 'If you have not already scheduled an inspection, let me know when you would like to do one, and I would be happy to schedule for you. If you have an Inspector that you would prefer to use, please let me know. If you need suggestions, I would be happy to provide them and or schedule it for you.', 'The Inspection is scheduled for ' & pba__Closing__c.Inspection_Date__c) }


And I have tried with single and double quotes (and any other possible variation. 

So, I thought using a Visualforce email template might be the solution. The email will be going to a Contact record and its relatedTo a Closing record. When I get all my code in and then add the signature for the Closing Owner, it gives an error: 
Error: Invalid field MobilePhone for SObject Name
<p>{!relatedTo.Owner.Name} <br/>{!relatedTo.Owner.Title} <br/>{!relatedTo.Owner.MobilePhone}


Apparently it understands Name and Title, but not MobilePhone (or other fields I want to use in the signature)! 

So, I am at a loss! 
 
We're using an LMS app, LearnTrac, and I would like to automatically assign LESSON TWO to a user when they complete LESSON ONE.
The infomation I am given by the app is:
LearnTrac exposes the following Apex methods to developers :

redwing.LMS_API.upsertAssignments(Set<Id> userIds, Id trainingPlanId)

Creates/Updates assignments for the provided set of user ids to the specified Training Plan Id.

Parameters

userIds

Type : Set<Id>

Set of User Ids that will be assigned to the specified training plan.

trainingPlanId

Type : Id

Id of the Training Plan to which the set of user ids will be assigned to

Return Value

Type : Void

Therefore, I have built a trigger that will check to see if a certain Learning Assignment is 'Completed' and then run this class with the info for the new assignment. It doesnt work. So, I have taken a step back and just tried to execute the code in anonymous window. It still doesnt do what I want, but doesn't error. The logs don't seem helpful. How can I get more info back about what is going on?

Here is the anon block I run:
Id trainingPlanId = 'a2e0v0000001zohAAA';
Set<Id> userIds= new Set<Id>();
userIds.add('0056A000001VrA3QAK');
        
redwing.LMS_API.upsertAssignments(userIds, trainingPlanId);

 
I am trying to build a Lightning Component for a home page that will display three buttons with each one opening up a different link.  

The buttons are all lined up against the border on the left. How do I add padding so that they are all aligned just off of the border?

User-added image

Here is my code:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <lightning:card>
        <aura:set attribute="title">
            <lightning:icon iconName="utility:open_folder" size="small" />
            XYZ Reports
        </aura:set>
  
        <lightning:button label="Download XYZ Report" onclick="{! c.downloadClick}" iconName="utility:download" iconPosition="left" /><br/>
        <br/>
        <lightning:button label="View XYZ Report" onclick="{! c.viewReportClick}" /><br/>
        <br/>
        <lightning:button label="View XYZ Dashboard" onclick="{! c.viewDashClick}" /> <br/>  
        
    </lightning:card>
</aura:component>

 
I have the following component for my Community dispaying specific fields pulled from the user's Account object. How can I style the lightning:outputFields? I have wrapped the lightning:outputFields in a Div wrapper and tried to style that but doesn't work. Any suggestions?
<aura:component controller="AccountDisplayController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
    <aura:attribute name="accountId" type="string" default = '0010r00000BtdLoAAJ'/>
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    
    <aura:if isTrue="{! not( empty( v.accountId ) ) }">
        <div class="billingtitle"><h1>Billing Information</h1></div>
        <lightning:recordViewForm recordId="{!v.accountId}" objectApiName="Account">
            
            <div class="slds-grid">
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Agreement_Date__c"/>
                    <lightning:outputField fieldName="Renewal_Date__c"/>
                </div>
                <div class="slds-col slds-size_1-of-2">
                    <lightning:outputField fieldName="Product_Service1__c"/>
                    <lightning:outputField fieldName="Number_of_Seats_Purchased__c"/>
                </div>
            </div>
        </lightning:recordViewForm>
    </aura:if>
</aura:component>

 
Hi ! I am working with Lighting Web Components, and looking to understand how to get meaningful error codes from the createRecord() function. 

The example I am working with is an Opportunity Create javascript function. It is supposed to fail because it is missing the Opportunity Stage Name. It fails as expected, however, the error message is not at all helpful. Here is the error message that I am receiving:
:[object Object] reduce: An error occurred while trying to update the record. Please try again. status:400 undefined. 
My question is how can I go about getting meaningful error messages in this case. Do I have to enable some kind of logging in Salesforce Options? Write a custom Apex Class that throws better errors? Or is there a different way to access the createRecord() error return to actually see what the error is?

Here is the javascript code:
 
import { LightningElement, track  } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { createRecord } from 'lightning/uiRecordApi';
import { reduceErrors } from 'c/ldsUtils';
import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity';
import NAME_FIELD from '@salesforce/schema/Opportunity.Name';
import CloseDate_FIELD from '@salesforce/schema/Opportunity.CloseDate';
import StageName_FIELD from '@salesforce/schema/Opportunity.StageName';



export default class LdsCreateOpportunity extends LightningElement {
    @track opportunityId;

    // errorInfo = undefined;
    name = '';
    closeDate = new Date('December 17, 2019 03:24:00');
    stageName = 'Prospecting';
   // @track error;



    handleNameChange(event) {
        this.opportunityId = undefined;
        this.name = event.target.value;
    }

    createOpportunity() {
        const fields = {};
        fields[NAME_FIELD.fieldApiName] = this.name;
        fields[CloseDate_FIELD.fieldApiName] = this.closeDate;
        // fields[StageName_FIELD.fieldApiName] = this.stageName; // - this breaks the save by omitting the required stage name field


        
        const recordInput = { apiName: OPPORTUNITY_OBJECT.objectApiName, fields };
        createRecord(recordInput)
            .then(opportunity => {
                this.opportunityId = opportunity.id;
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Opportunity created. Message goes here!',
                        variant: 'success'
                    })
                );
            })
            .catch(error => {



                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error creating record',
                        message:'Here is the error:' + error.body +  ' reduce: ' + reduceErrors(error).join(', ')  + 'status:' + error.status + '  ;status text' + error.statustext,
                        variant: 'error'
                    }
                    )

                    
                );
            });
    }
}

 
The ultimate goal is to be able to iterate over an array in a Lightning web component to show internal reviews about our vendors. There would be at least three levels: Super Category, Category, Review (maybe even four: Super Category, Category, Vendor, Review), so that the root lists are not repeated in the display. For example:

Super Category 1
-Category A
--Review 00
--Review 01
-Category B
--Review 02

Super Category 2
-Category C
--Review 03

Super Category is Parent over Category, which is parent over Review. Review also has references to Super Category. 

ultimately the array might look like this:
superCategories = [
        {
            Name: 'Additions',
            Categories: [
                {
                    Name: 'Bathroom Additions',
                    Reviews: [
                        {
                            Vendor: 'Jay at Pritches Closets',
                            Rating: 5,
                            Comment: 'this is the comment',
                            Phone: '8005551234'
                        }
                    ]
                },
                {
                    Name: 'Kitchen Additions',
                    Reviews: [
                        {
                            Vendor: 'Phil Dunphy',
                            Rating: 4,
                            Comment: 'this is the comment',
                            Phone: '8005551234'
                        }
                    ]
                }
            ]
        }
    ];

What is the best way to accomplish this? In the Controller or the .js of the component? And how?
I am building a list of our preferred vendors and want to show it in a custom lightning web component. I would like all vendors of the same 'Category' to be listed together, with just one header. 
User-added image

As you can see, when there are multiple vendors in one cateogry, the category name/head displays twice. I am sure I could get what I need, through making multiple calls in apex (one for each category), but it seems ideal and more efficient to get all the vendors in one call, and then just adjust their grouping in the lightning web component. 

I query the data in the controller, then display it in the lwc as such: 
<template for:each={vendors.data} for:item="vendor">
                <div key={vendor.Id}>                   
                    <div class="slds-text-heading_small">{vendor.Category_Name__c}</div>
                    <p><lightning-formatted-rich-text value={vendor.Vendor__c} ></lightning-formatted-rich-text></p>
                </div>
            </template>

 
Dear Team,

Thank you for continous support !!!

I built some components using LWC , I am continously using import Lightning Element and  extends LightningElement . Please describe these keywords in some easy way in order i am able to understand and use it properly .

Thanks & Regards
Sachin Bhalerao
I have two buttons on a Lightning Web Component on a record page. When each is clicked, the code they run is virtually identical, so I want to reuse the code as much as possible. However, I cannot figure out the best way to do it. I can pass the button name into the code, but when I try to put the "let record + fields" code into the switch or conditional if statements, it doesnt work. I need to pass a different field name into the 'let record' statement, depending on which button is pressed. 
 
handleActivateBuyerSide() {
        this.loading = true;
        
        let record = {
            fields: {
                Id: this.recordId,
                VirtualTCStatus_BuyerSide__c: 'Active',        
            },
        };
        updateRecord(record)
            // eslint-disable-next-line no-unused-vars
            .then(() => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Record Is Updated',
                        variant: 'success',
                    }),
                );
                this.loading = false;

            })
            .catch(error => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error on data save',
                        message: error.message.body,
                        variant: 'error',
                    }),
                );
                this.loading = false;

            });
    }
    handleActivateSellerSide() {
        this.loading = true;
        
        let record = {
            fields: {
                Id: this.recordId,
                VirtualTCStatus_SellerSide__c: 'Active',        
            },
        };
        updateRecord(record)
            // eslint-disable-next-line no-unused-vars
            .then(() => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Success',
                        message: 'Record Is Updated',
                        variant: 'success',
                    }),
                );
                this.loading = false;

            })
            .catch(error => {
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error on data save',
                        message: error.message.body,
                        variant: 'error',
                    }),
                );
                this.loading = false;

            });
    }

 

I need to create a link to an object within a data-table listing.
For example, list of contacts on a data table, when the user clicks the "name", it opens that Contact record view.
This seems simple enough, and yet, I'm having trouble finding a solution or example anywhere out on the internet or trailhead.  It seems like all the solutions I find are using "tiles" and cascading events.  I don't need anything that complicated.
I can post example/more information below... but would love it if someone could explain how to do this (using NavigationMixin)

Hello, 

I've managed to create a custom page for salesforce mobile through the lightning app builder. However,when naming the app page, for example My Salesforce, is there a way to hide this header part using the display:none syntax? If so, where could I hide this header using css? 

User-added image
I want to make an input field as watermark in my Salesforce lightning component. Please help me how shall I proceed?
Hi,
I'm trying to write my text inside one block.
Example, I have this :
<div> 
AAA 
BBB 
CCC 
DDD
</div>
And I want the visualforce page to render it this way :
AAA      CCC
BBB      DDD
The text "AAA BBB CCC DDD" would be a long area field. And I need to display it on two columns when rendering as PDF.

I've tried to use the CSS (column-count, column-width) but nothing seems to be working. He doesn't understand this specific CSS. I tried on a basic HTML page and the render is as I want it so I'm guessing it's coming from restricted CSS rules about VF pages.
 
Can you help me ?

Thanks,
Best regards,
Martin
Hi.,
I want to place a custom button in custom object list view. I don’t want user to click this button from any other list view other than desired one.
There is no option to make list button visible only in desired list view, it will be there in all list view.
Finally I desired to throw a message to user, when they click that list button other than desired list view.
Here I need to check the List View Name, how can we get the list view name in Visual force page / extension apex class.
Where all list view names are stored, is that object / table is accessible / can we query that object in apex class.
E.g:
List View Name A, I want to place custom button A here.
User should not have access to button A in list View B, C and etc(We cannot make it this happen in standard list view) hence user clicks button A from List view B or C.
I want to throw message to user.
Note: PDF page will be render to me when I click on custom button A.