• Marcos Laso
  • NEWBIE
  • 65 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 9
    Replies
Hi,

I've been tasked with creating a custom version of the Opportunity Team component that users currently see in the side panel.  Most of my development is fine but I am struggling to correctly position the button menu that appears when the dropdown arrow is clicked.

Salesforce working version :-
Salesforce standard button menuMy version :-
User-added image
As you can see on my version the menu items appear beneath & to the right of the dropdown (which means half the text is missing as the dropdown appears on the righthand side of the page) whereas the Salesforce version appears to the left & can also appear above the dropdown if there is not enough room on the browser beneath the dropdown.

Cutdown version of the aura component which demonstrates the problem when added to the righthand sidepanel of an opportunity page:-
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes" access="global">
	<div class="container forceRelatedListSingleContainer" data-aura-class="forceRelatedListSingleContainer">
        <article class="slds-card slds-card_boundary headerBottomBorder forceRelatedListCardDesktop" data-aura-class="forceRelatedListCardDesktop">
            <div class="slds-grid slds-page-header forceRelatedListCardHeader" data-aura-class="forceRelatedListCardHeader">
                <header class="slds-media slds-media--center slds-has-flexi-truncate" >
                    <div class="slds-media__figure stencil slds-avatar slds-avatar_small" aria-hidden="true">
                        <div class="extraSmall forceEntityIcon" style="background-color: #FCB95B" data-aura-class="forceEntityIcon">
                            <span class="uiImage" data-aura-class="uiImage">
                                <img src="/img/icon/t4v35/standard/team_member_120.png" class="icon " alt="Opportunity Team" title="Opportunity Team"/>
                            </span>
                        </div>
                    </div>
                    <div class="slds-media__body">
                        <h2 class="slds-card__header-title">
                            <a class="slds-card__header-link baseCard__header-title-container">
                                <span class="slds-truncate slds-m-right--xx-small" title="Opportunity Team">
                                    Opportunity Team
                                </span>
                            </a>
                        </h2>
                    </div>
                    
                    <div class="slds-p-around_medium container lgc-bg">
                        <lightning:buttonMenu alternativeText="Show menu" variant="border-filled">
                            <lightning:menuItem value="MenuItemOne" label="Menu Item One" />
                            <lightning:menuItem value="MenuItemTwo" label="Menu Item Two" />
                            <lightning:menuItem value="MenuItemThree" label="Menu Item Three" />
                            <lightning:menuItem value="MenuItemFour" label="Menu Item Four" />
                        </lightning:buttonMenu>
                    </div>
                    
                </header>
            </div>
        </article>
    </div>
</aura:component>
Any thoughts gratefully received.
 

I am having trouble completing this badge. I keep getting an error that reads "We can’t find 'reduceErrors' imported into contactList.js."

I double checked the component, it is saved and has the the import statement. My workspace also has the ldsUtils component and even that is saved. This should have been a walk in the park challenge as a similar one is already stated in the trailhead module. Even with similar code as mentioned, I get an error: (https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-and-salesforce-data/handle-server-errors)

//JS FILE
import {
    reduceErrors
} from 'c/ldsUtils';
import {
    LightningElement,
    wire
} from 'lwc';

import FIRST_NAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LAST_NAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import getContacts from '@salesforce/apex/ContactController.getContacts';

const COLUMNS = [{
        label: 'First Name',
        fieldName: FIRST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Last Name',
        fieldName: LAST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Email',
        fieldName: EMAIL_FIELD.fieldApiName,
        type: 'email'
    },
];

export default class ContactList extends LightningElement {

    columns = COLUMNS;
    errors;
    @wire(getContacts)
    contacts;


    get errors() {
        console.log('this.contacts.error: ', this.contacts.error);
        return (this.contacts.error) ? reduceErrors(this.contacts.error) : [];
    }
}

//HTML FILE
<template>
    <lightning-card title="Contact List">


        <template if:true={errors}>
            <p>{errors}</p>
        </template>

        <!--<lightning-datatable key-field="Id" data={contacts.data} columns={columns}>
        </lightning-datatable> -->
    </lightning-card>


</template>

//Controller

public with sharing class ContactController {
    
    @AuraEnabled(cacheable = true)
    public static List<Contact> getContacts(){
        
        //return [SELECT FirstName, LastName, Email FROM Contact];
        throw new AuraHandledException('Forced error');
    }
}
Hi Community,

 I have created one External credential and one named credential.
When I'm trying to access the named credential in my apex code to callout it shows me "Either you don't have permission or External credential doesn't exist.
Now when I'm trying to access named and external credentials at profiles and Permission set it shows,  there are no Available Named Credentials to add.

Please provide me solution for the same, so that I can able to solve this timely.

User-added image

Thanks & Regards
Nikhil Garg
SF Developer
I wanted to populate the data from Parent record to Child record on record creation or on  parent record edit , if the child record status is not closed . 

e.g : Parent record has customField1 and Child record has customField1,
I wanted to copy the parent record -> customField1 to child record custom field1 if the child record status is not closed .

Will the formula fields will be better option ? OR Need to populsated via triggerHandler ?

Could you please suggest 
I have a below requirement. Please suggest the best option to implement it .

Allow the user to create opportunity related record if the user has edit access on the opportunity. If user doesn't have edit access on opprtunity and tries to create the related record (e.g : Custom Object record ) throw the user friendly error message . 
Hello community.

I would like to ask an question about Apex.
I want to create an function with Apex but I can not imagine how to create.

The function is as following,

When someone sees the data(e.g. Account data), another object data is registered.

Perhaps this is can be realized with Salsforce Shield but I don't wnat to use this option.

If someone knows good way,could you tell me, please?
  • November 20, 2020
  • Like
  • 0
My flow is pretty simple, it simply returns the account record found for a given account number, along with the record type name.

The whole flow looks like this:
User-added image

The Get Account element is below. This is the element that is erroring.
User-added image

When I debug the flow, the debug output looks like this for the Get_Account step:
 
Fast Lookup: Get_Account
Find all Account records where
AccountNumber Equals {!VarAccountNumber} (A00012345)
Sort records by: CreatedDate (Ascending)
Store the values of these currently referenced fields in Get_Account: RecordTypeId, Id
Because Get_Account is passed to an action, subflow, or Lightning component, store the values of all Account fields that the running user has access to.

Result
Failed to find records.

Error Occurred:
This error occurred when the flow tried to look up records: An unexpected error occurred. Please include this ErrorId if you contact support: 908556789-5354 (-548403183). You can look up ExceptionCode values in the SOAP API Developer Guide.

When I look in the developer console logs, I can see the following error occuring:
System.QueryException: Non-selective query against large object type (more than 200000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
Even if a field is indexed a filter might still not be selective when:
1. The filter value includes null (for instance binding with a list that contains null)
2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

I found this knowledge article (https://help.salesforce.com/articleView?id=000323572&type=1&mode=1) which gives some further detail on the error. It suggests that queries should return less 10% or less of the data. My query would only return 1 record. I currently have a total of ~364k account records. This shouldn't be a problem.

I've tried writing a SOQL query that would be equivalent of what's being queried in the flow. It looks like this:
SELECT [all fields] FROM Account WHERE AccountNumber = 'A00012345'
Replacing [all fields] with all my account object fields, and running the query, it returns 1 row without any errors.

According to all the salesforce documentation I could find, this shouldn't be a problem, yet for some reason the flow encounters this issue. 

I've tried adding further conditions to the Get_Account element, to try and make the query more selective:
User-added imageThis did not resolve the issue and the same error occurs.

The other suggestion in the Salesforce documentation is to index the field. Since Account Number is a standard field, I can't make it an external ID, so I'll need to contact support for this.

Can anyone explain why this error is affecting me, when all the documentation, and test queries I run suggest that it shouldn't be occurring?
  • November 20, 2020
  • Like
  • 0
Hi,

I've been tasked with creating a custom version of the Opportunity Team component that users currently see in the side panel.  Most of my development is fine but I am struggling to correctly position the button menu that appears when the dropdown arrow is clicked.

Salesforce working version :-
Salesforce standard button menuMy version :-
User-added image
As you can see on my version the menu items appear beneath & to the right of the dropdown (which means half the text is missing as the dropdown appears on the righthand side of the page) whereas the Salesforce version appears to the left & can also appear above the dropdown if there is not enough room on the browser beneath the dropdown.

Cutdown version of the aura component which demonstrates the problem when added to the righthand sidepanel of an opportunity page:-
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes" access="global">
	<div class="container forceRelatedListSingleContainer" data-aura-class="forceRelatedListSingleContainer">
        <article class="slds-card slds-card_boundary headerBottomBorder forceRelatedListCardDesktop" data-aura-class="forceRelatedListCardDesktop">
            <div class="slds-grid slds-page-header forceRelatedListCardHeader" data-aura-class="forceRelatedListCardHeader">
                <header class="slds-media slds-media--center slds-has-flexi-truncate" >
                    <div class="slds-media__figure stencil slds-avatar slds-avatar_small" aria-hidden="true">
                        <div class="extraSmall forceEntityIcon" style="background-color: #FCB95B" data-aura-class="forceEntityIcon">
                            <span class="uiImage" data-aura-class="uiImage">
                                <img src="/img/icon/t4v35/standard/team_member_120.png" class="icon " alt="Opportunity Team" title="Opportunity Team"/>
                            </span>
                        </div>
                    </div>
                    <div class="slds-media__body">
                        <h2 class="slds-card__header-title">
                            <a class="slds-card__header-link baseCard__header-title-container">
                                <span class="slds-truncate slds-m-right--xx-small" title="Opportunity Team">
                                    Opportunity Team
                                </span>
                            </a>
                        </h2>
                    </div>
                    
                    <div class="slds-p-around_medium container lgc-bg">
                        <lightning:buttonMenu alternativeText="Show menu" variant="border-filled">
                            <lightning:menuItem value="MenuItemOne" label="Menu Item One" />
                            <lightning:menuItem value="MenuItemTwo" label="Menu Item Two" />
                            <lightning:menuItem value="MenuItemThree" label="Menu Item Three" />
                            <lightning:menuItem value="MenuItemFour" label="Menu Item Four" />
                        </lightning:buttonMenu>
                    </div>
                    
                </header>
            </div>
        </article>
    </div>
</aura:component>
Any thoughts gratefully received.
 
Hi all!

I'm struggling to get the right SOQL query in a way that I can search and filter by URL addresses, through the API.

We have a custom field "Crunchbase_URL__c", which can be both written by my application (usign the REST API), or filled in manually by the used.

Most of the the times, when the URL was filled automatically, the line
.../services/data/v47.0/query?q=SELECT Name FROM Account WHERE Crunchbase_URL__c = 'https://www.crunchbase.com/organization/{the permalink that I'm searching}'
will work without any issues, but sometimes when the user would only type www.crunchbase.com/.... without the https the query obvioulsly comes back empty.

I tried to use 'LIKE' instead of the '=' operator, but it looks like it would only work with a string beginning with the query term. So
SELECT Name FROM Account WHERE Crunchbase_URL__c LIKE '%crunchbase.com/....'
is not working.

Currently my workaround is to query for all the possibilities (from my Javascript code):
"Crunchbase_URL__c = 'https://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'https://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'http://www.crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'http://crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'crunchbase.com/organization/" + Sel_row.QueryName + "'" +
                            " OR Crunchbase_URL__c = 'www.crunchbase.com/organization/" + Sel_row.QueryName + "' "
but this hardly looks like the right approach.

furthermore, when querying for the standard Website field I have exactly the same issues.

Thanks for your help!

I am having trouble completing this badge. I keep getting an error that reads "We can’t find 'reduceErrors' imported into contactList.js."

I double checked the component, it is saved and has the the import statement. My workspace also has the ldsUtils component and even that is saved. This should have been a walk in the park challenge as a similar one is already stated in the trailhead module. Even with similar code as mentioned, I get an error: (https://trailhead.salesforce.com/content/learn/modules/lightning-web-components-and-salesforce-data/handle-server-errors)

//JS FILE
import {
    reduceErrors
} from 'c/ldsUtils';
import {
    LightningElement,
    wire
} from 'lwc';

import FIRST_NAME_FIELD from '@salesforce/schema/Contact.FirstName';
import LAST_NAME_FIELD from '@salesforce/schema/Contact.LastName';
import EMAIL_FIELD from '@salesforce/schema/Contact.Email';
import getContacts from '@salesforce/apex/ContactController.getContacts';

const COLUMNS = [{
        label: 'First Name',
        fieldName: FIRST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Last Name',
        fieldName: LAST_NAME_FIELD.fieldApiName,
        type: 'text'
    },
    {
        label: 'Email',
        fieldName: EMAIL_FIELD.fieldApiName,
        type: 'email'
    },
];

export default class ContactList extends LightningElement {

    columns = COLUMNS;
    errors;
    @wire(getContacts)
    contacts;


    get errors() {
        console.log('this.contacts.error: ', this.contacts.error);
        return (this.contacts.error) ? reduceErrors(this.contacts.error) : [];
    }
}

//HTML FILE
<template>
    <lightning-card title="Contact List">


        <template if:true={errors}>
            <p>{errors}</p>
        </template>

        <!--<lightning-datatable key-field="Id" data={contacts.data} columns={columns}>
        </lightning-datatable> -->
    </lightning-card>


</template>

//Controller

public with sharing class ContactController {
    
    @AuraEnabled(cacheable = true)
    public static List<Contact> getContacts(){
        
        //return [SELECT FirstName, LastName, Email FROM Contact];
        throw new AuraHandledException('Forced error');
    }
}
Hello,

I already know how to use Named Credentials in Apex however I need to know if LWC support Named Credentials.

I'm calling a external rest service from LWC and I need to pass on Authorization header. This credentials is stored as Named Credential. Stored crdentials in the custome object is security issue. 

Thanks,
PJP