• Yogendra Jangid
  • NEWBIE
  • 380 Points
  • Member since 2016

  • Chatter
    Feed
  • 12
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 75
    Replies
Hello,

I am new to development and I need some assistance.
Context: I am attempting to make a LWC that lives on the Home Page of our Org's App and lists a series of accounts in an accordion with related contacts nested in an additional accordion section. My code works so far, but now we need the lightning button listed on the contact to take the user when clicked to the appropriate Contact record page.

I have set up the Navigation but at first I was getting the error: "Cannot Find Page". So I attempted to pull the contact Id as it is listed in the button via data-key={con.Id} and feed that through the [NavigationMixin.Navigate] but now I receive a new error:  [Cannot read property 'dataset' of undefined]

We need the button to dynamically know what contact the button is being clicked from and direct the user to that contact's record page. Any help would be greatly appreciated! Also, apologies if the code is really muddy, I have been attempting many things to fix this and so there may be code that is not  needed.

HMTL:
<template>
    <lightning-card>
        <div class="slds-m-left_small">
            <div class="slds-text-heading_medium">
                <lightning-icon icon-name="standard:account" size="medium"></lightning-icon><strong> Client Accounts and Contacts</strong> 
            </div>
        </div>
        <template if:true={accounts}>
            <!-- accordion component with muliple sectio open -->
        <lightning-accordion allow-multiple-sections-open>
            <template for:each={accounts} for:item="acc" for:index="indexVar">
                <lightning-accordion-section key={acc.Id} name={acc.Name} label={acc.Name}>
                    <template for:each={acc.Contacts} for:item="con">
                        <lightning-accordion-section name={con.Name} label={con.Name} key={con.Id}>
                            {con.Title}
                            <lightning-button variant="brand" label="Go to Record" title="Primary action" onclick={navigateToObjectContact} class="slds-m-left_x-small" value={con.Id} name={con.Name} data-key={con.Id}></lightning-button>
                        </lightning-accordion-section>
                    </template>
                </lightning-accordion-section>
            </template>
        </lightning-accordion>
        </template>
    </lightning-card>
</template>

JavaScript:
import { api, LightningElement, track, wire} from 'lwc';
// importing apex class method to get the accounts
import retriveAccounts  from '@salesforce/apex/GetAccountContactData.getAccountData';
// imported to show toast messages
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
// imported to allow page navigation
import { NavigationMixin } from 'lightning/navigation';
export default class AccordinLWCDemo extends NavigationMixin(LightningElement) {
    @track accounts;
    @api title;
    @api greetings;
    @api recordId;
    navigateToObjectContact() {
        // Navigate to the Contact home page
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                        recordId: this.selectedRecordId,
                        objectApiName: 'Contact',
                        actionName: 'view',
            },
        });
        this.selectedRecordId = Event.target.dataset.key;
    }
    // wire service to fetch the slesforce data
    @wire(retriveAccounts)
    wiredAccount({ error, data }) {
        if(data) {
            this.accounts = data;
            this.error = undefined;
        }
        else if(error) {
            this.error = error;
            this.accounts = undefined;
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error!!',
                    message: error.message,
                    variant: 'error',
                }),
            );
        }
    }
}

Apex:
public with sharing class GetAccountContactData {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountData() {
        return [SELECT Id, Name ,(Select Id, Name, Email, Phone, Title from Contacts) from Account WHERE Active__c = TRUE AND RecordTypeId = '0122K000001Dio1QAC' ORDER BY Name];
    }
}
 
Hello,
I have 2 parents record types (Contact):
  • Physical Person
  • Juridical Person
My child object (Form) has 4 record types:
  • Physical Pre Form
  • Physical Form
  • Juridical Pre Form
  • Juridical Form
When I create a new Form using the related list button "New" is it possible to display only Physical Pre Form and Physical Form options if my Contact is a Physical Person?

I'm using a validation rule, but it's a big form and users will only get the notification that are filling out the wrong form when they save, after all the filling work.

1.When child component trigger an event it comes as detail if event trigger by DOM then comes as target.
2. event.target comes from html element
event.detail comes from custom event we write

I don't understand this from a code point. Both the codes are almost same. We are using combobox with onchange handler in both the components.
 Why did we use event.detail in the first component but we used event.target in the second component?
I have two components below. In one component we have event.detail and another we have event.target. 
Can someone please explain based on the below code?
Component 1: Wire service with getPicklistValues adapter 
HTML:
<template>
    <lightning-card title="getPicklistValues Demo">
        <div class="slds-var-p-around_medium">
            <lightning-combobox
            name="Industry"
            label="Industry"
            value={selectedIndustry}
            placeholder="Select Industry"
            options={industryOptions}
            onchange={handleChange} ></lightning-combobox>
        </div> 
        <p>selectedIndustry:{selectedIndustry}</p>
    </lightning-card>
    <lightning-card title="getPicklistValues Demo with type">
        <div class="slds-var-p-around_medium">
            <lightning-combobox
            name="Type"
            label="Type"
            value={selectedType}
            placeholder="Select Type"
            options={typeOptions}
            onchange={handleTypeChange} ></lightning-combobox>
        </div> 
        <p>selectedType:{selectedType}</p>
    </lightning-card>
</template>
JS:
 import { LightningElement, wire } from 'lwc';
import { getObjectInfo, getPicklistValues} from 'lightning/uiObjectInfoApi'
import INDUSTRY_FIELD from '@salesforce/schema/Account.Industry'
import TYPE_FIELD  from '@salesforce/schema/Account.Type'
import ACCOUNT_OBJECT from '@salesforce/schema/Account'
export default class GetPIcklistValuesDemo extends LightningElement {
    selectedIndustry = '';
    selectedType=''
    industryOptions=[]
    typeOptions=[]
    @wire(getObjectInfo, {objectApiName:ACCOUNT_OBJECT})
    objectInfo
    @wire(getPicklistValues, { recordTypeId:'$objectInfo.data.defaultRecordTypeId', fieldApiName:INDUSTRY_FIELD})
    industryPicklist({data, error}){
        if(data){
            console.log(data)
            this.industryOptions = [...this.generatePicklist(data)]
        }
        if(error){
            console.error(error)
        }
    }
    generatePicklist(data){
        return data.values.map(item=>({ label: item.label, value: item.value }))
    }
    handleChange(event) {
        this.selectedIndustry = event.detail.value;
    }
    /***second picklist for type */
    @wire(getPicklistValues, { recordTypeId:'$objectInfo.data.defaultRecordTypeId', fieldApiName:TYPE_FIELD})
    typePicklist({data, error}){
        if(data){
            console.log(data)
            this.typeOptions = [...this.generatePicklist(data)]
        }
        if(error){
            console.error(error)
        }
    }
    handleTypeChange(event) {
        this.selectedType = event.detail.value;
    }
}
Component 2: Wire service with getPicklistValuesByRecordType adapter 
HTML:
<template>
    <lightning-card title="getPicklistValuesByRecordType Adapter">
        <div class="slds-var-p-around_medium">
            <template if:true={ratingOptions}>
                <lightning-combobox
                name="rating"
                label="Rating"
                value={selectedRating}
                placeholder="Select Rating"
                options={ratingOptions}
                onchange={handleChange}></lightning-combobox>
                <p>selectedRating: {selectedRating}</p>
            </template>
            
            <template if:true={industryOptions}>
                <lightning-combobox
                name="industry"
                label="Industry"
                value={selectedIndustry}
                placeholder="Select Industry"
                options={industryOptions}
                onchange={handleChange}></lightning-combobox>
                <p>selectedIndustry: {selectedIndustry}</p>
            </template>
        </div>
    </lightning-card>
</template>
JS:
import { LightningElement, wire } from 'lwc';
import {getPicklistValuesByRecordType, getObjectInfo} from 'lightning/uiObjectInfoApi'
import ACCOUNT_OBJECT from '@salesforce/schema/Account'
export default class GetPicklistValuesByRecordTypeDemo extends LightningElement {
    ratingOptions
    industryOptions
    selectedRating
    selectedIndustry
    @wire(getObjectInfo, {objectApiName:ACCOUNT_OBJECT})
    objectInfo
    @wire(getPicklistValuesByRecordType, {objectApiName:ACCOUNT_OBJECT, 
        recordTypeId:'$objectInfo.data.defaultRecordTypeId'})
        picklistHandler({data, error}){
            if(data){
                console.log(data)
                this.ratingOptions = this.picklistGenerator(data.picklistFieldValues.Rating)
                this.industryOptions = this.picklistGenerator(data.picklistFieldValues.Industry)
            }
            if(error){
                console.error(error)
            }
        }
    picklistGenerator(data){
        return data.values.map(item=>({"label":item.label, "value":item.value}))
    }
    handleChange(event){
        const {name, value} = event.target
        console.log(name +'==>' +value)
        if(name === 'industry'){
            this.selectedIndustry = value
        }
        if(name === 'rating'){
            this.selectedRating = value
        }
    }
}
 
Hi,

I'm looking for a way to add creation date to the listview of quotations.
Somehow, I don't have a "field" that is called creation date. Any idea how I could add this?

Many thanks

Hi,

I have created a Class for einstein bot and since only one invocable method can be created in a class , i have created a service class and passed the parameter from my controller class. Both the class are working fine and while creating a test class i am able to cover the code coverage of 90% for my service class . But i am facing issue for the controller class.

Controller class
public class GlobalWebChatBotController {
    /* Input Wrapper Class for Values to be passed from Einstein Bot */
    public class ControllerInput {
    @InvocableVariable
    public String fctgBrandName;
    @InvocableVariable
    public String operationTypeString;
    @InvocableVariable
    public String chatTranscriptRecordId;
    @InvocableVariable
    public String enquiry;
    @InvocableVariable
    public String companyName;
    @InvocableVariable
    public LiveChatTranscript chatTranscriptRecord;
    @InvocableVariable
    public String countryName;   
    @InvocableVariable
    public String phoneNumber;
    @InvocableVariable
    public String contactPreference;
    @InvocableVariable
    public String feedbackcomment;
    @InvocableVariable
    public String isfeedback;
    @InvocableVariable
    public String selectedKnowledgeCategory;
    @InvocableVariable
    public String selectedKnowledgeSubCategory;
    @InvocableVariable
    public String selectedTitle;
    @InvocableVariable
    public sObject selectedKnowledgeArticle;
  }
    /* Output Wrapper Class for Values to be passed to Einstein Bot */
    public class ControllerOutput {
    @InvocableVariable
    public LiveChatTranscript chatTranscriptRecord;
    @InvocableVariable
    public String visitorCustomerType;
    @InvocableVariable
    public String supplierPublicDocumentLink;
    @InvocableVariable
    public Case loggedCaseRecord;
    @InvocableVariable
    public Contact linkedContactRecord;
    @InvocableVariable
    public String companyName;
     @InvocableVariable
    public String FirstName;
     @InvocableVariable
    public String LastName;
    @InvocableVariable
    public List<String> knowledgeCategories;
    @InvocableVariable
    public List<String> knowledgeSubCategories;
    @InvocableVariable
    public List<sObject> knowledgeArticle;
  }
    /* Invocable Method of Controller to be called From Einstein Bot*/
    @InvocableMethod(label='')    
    public static List<ControllerOutput> botControllerMethod(list<ControllerInput> controllerInputs){
        GlobalWebChatBotServiceClass serviceClassObject=new GlobalWebChatBotServiceClass();
        ControllerInput inputVariable=controllerInputs[0];
        ControllerOutput outputVariable= new ControllerOutput();
"
"
}

Service class

public without sharing class GlobalWebChatBotServiceClass {
    
    
    
    public  LiveChatTranscript returnChatTranscriptRecord(Id chatTranscriptRecordId) {
          List<LiveChatTranscript> chatTranscriptRecords=[SELECT Id,Visitor_Customer_Type__c,Visitor_Email__c,
                                                        Visitor_First_Name__c,Visitor_Last_Name__c,Visitor_Company__c,ContactId,Location FROM LiveChatTranscript
                                                        Where Id = :chatTranscriptRecordId];
        if(chatTranscriptRecords.size()>0) {
            return chatTranscriptRecords[0];
        } else {
            return null;
        }
    }

Test Class

@isTest
public class GlobalWebChatBotTestClass {        
    @istest
    static void chattranscripttest(){        
        LiveChatTranscript chat = new LiveChatTranscript (Visitor_Customer_Type__c = 'Supplier' , Visitor_Email__c = 'a@a.com' , 
                                         Visitor_First_Name__c = 'testa' ,Visitor_Last_Name__c = 'testb' , livechatvisitorid = '5717Z000001LxeQQAS',
                                          Visitor_Company__c = 'test',Location = 'test');
        insert chat;                
        
         GlobalWebChatBotServiceClass livechat = new GlobalWebChatBotServiceClass();           
        Test.startTest();
        LiveChatTranscript lct= livechat.returnChatTranscriptRecord(chat.Id);
        GlobalWebChatBotController.botControllerMethod( i dont know which parameter i should pass here);
        Test.StopTest();
    }

I dont know how to pass controller input parameter , can anyone help me with it
 
 renderedCallback method must show this message: "loaded successfully" if the promise is successful. 
I am getting an error instead. fontawesome css folder also is not being recognized. 
Please check the below error messages in the chrome console and also my code.

These are the errors in the console (chrome):
Memory_Game_LWC:1 Refused to apply style from 'https://customer-platform-9835deved.lightning.force.com/resource/1621777808000/fontawesomefontawesome/css/font-awesome.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

memoryGameLwc.js:4 undefined
eval @ memoryGameLwc.js:4

Memory_Game_LWC:1 Refused to apply style from 'https://customer-platform-9835-dev-ed.lightning.force.com/resource/1621777808000/fontawesomefontawesome/css/font-awesome.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.


This is JS file:
import { LightningElement } from 'lwc';
import {loadStyle} from 'lightning/platformResourceLoader'
import fontawesome from '@salesforce/resourceUrl/fontawesome'
export default class MemoryGameLwc extends LightningElement {
    
    isLibLoaded= false;
    renderedCallback(){
        if(this.isLibLoaded){
            return
        }
        else{
            loadStyle(this, fontawesome+'fontawesome/css/font-awesome.min.css').then(()=>{
                console.log("loaded successfully")
            }).catch(error=>{
                console.error(error)
            })
        }
      this.isLibLoaded= true;
    }
}

HTML:
<template>
  <div class= "container">
    <lightning-card title= "Memory Game LWC">
        <div class= "slds-m-around_medium">   
            <section class= "score-panel">
                Score area
            </section> 
            <section class= "game-panel">
                Game area
            </section> 
        </div>
    </lightning-card>
  </div>  
</template>

CSS:
.container{   
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

 
Hi,
I am facing the following error while deleting account from list :
Error in $A.getCallback() [helper is not defined]
My code is as follows:

Component.cmp
<aura:component controller="TestController "> 
    <!-- Attribute Section -->
    <aura:attribute name="sortDirection" type="String" default="asc" />
    <aura:attribute name="defaultSortDirection" type="String" default="asc" />
    <aura:attribute name="sortedBy" type="String" />
    <aura:attribute name="mycolumns" type="List"/>
    <aura:attribute type="List" name="accountList"/>
    <aura:attribute type="List" name="selectedAccountIds"/>
    
    
    <!-- Handler Section -->
    <aura:handler name="init" value="{!this}" action="{!c.ChangeText}"/>
    <!-- Body -->
     <lightning:button variant="destructive" 
                       label="Delete Account"  
                       title="Delete" 
                       onclick="{!c.deleteAccount}"/>
    <lightning:datatable data="{!v.accountList}"
                         columns="{!v.mycolumns}"
                         keyField="Id"
                         hideCheckboxColumn="false"
                         onrowselection="{!c.getSelectedName}"
                         defaultSortDirection="{!v.defaultSortDirection}"
                         sortedDirection="{!v.sortDirection}"
                         sortedBy="{!v.sortedBy}"
                         onsort="{!c.handleSort}"
                         />  
</aura:component>

==================================================
controller.js

({
    ChangeText : function(component, event, helper) {
        helper.getAccountListHelper(component);
    },
    
    getSelectedName:function(component, event, helper){
        var my_ids = [];
        var selectedRows = event.getParam("selectedRows");
        for(var i=0; i< selectedRows.length; i++){
            // alert('You Selected ID'+selectedRows[i].Id);
            my_ids.push(selectedRows[i].Id);
        }
        component.set("v.selectedAccountIds",my_ids);
    },
    
    handleSort : function(cmp, event, helper) {
        helper.handleSort(cmp,event);
    },
    
    deleteAccount: function(component, event, helper) {
        helper.deleteAccountHelper(component, event, helper);
        }
 })
====================================================
helper.js

({
    getAccountListHelper: function(component) {
        component.set('v.mycolumns',[
            {label: 'Account Name' ,fieldName: 'Name',type: 'text', sortable:true},
            {label: 'Account Type' ,fieldName: 'Type',type: 'text'},
            {label: 'Website' ,fieldName: 'Website',type: 'url'},
            {label: 'Phone' ,fieldName: 'Phone',type: 'Phone'},
            {label: 'Industry' ,fieldName: 'Industry',type: 'text'}
            
        ]); 
        
        var action = component.get("c.getAccListApex");
        action.setCallback(this,function(response){
            var state = response.getState();
            if (state == "SUCCESS")
            {
                console.log("====response====",response.getReturnValue());
                component.set("v.accountList",response.getReturnValue());
            }
            if (state == "Error")
            {
                alert('error');
            }
            
        });
        $A.enqueueAction(action);  
    } ,
    sortBy: function(field, reverse, primer) {
        var key = primer
        ? function(x) {
            return primer(x[field]);
        }
        : function(x) {
            return x[field];
        };
        
        return function(a, b) {
            a = key(a);
            b = key(b);
            return reverse * ((a > b) - (b > a));
        };
    },
    handleSort: function(cmp, event) {
        var sortedBy = event.getParam('fieldName');
        var sortDirection = event.getParam('sortDirection');
        var cloneData = cmp.get("v.accountList");
        cloneData =  cloneData.slice(0);
        cloneData.sort((this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1)));
        
        cmp.set('v.accountList', cloneData);
        cmp.set('v.sortDirection', sortDirection);
        cmp.set('v.sortedBy', sortedBy);
    },
    
    deleteAccountHelper: function(component,event,Helper) {
        var action = component.get("c.deleteAccountApex");
        action.setParams({accIds : component.get("v.selectedAccountIds")});
        action.setCallback(this,function(response){
            var state = response.getState();
            if (state == "SUCCESS")
            {
                helper.getAccountListHelper(component);
                alert('Account Deleted Sucessfully');
            }
            if (state == "Error")
            {
                alert('error');
            }
            
        });
        $A.enqueueAction(action);  
        
    }
})

====================================================
ApexClass

public class TestController {
    
    @AuraEnabled
    public static List<Account> getAccListApex(){
        List<Account> acclist = new List<Account>();
        acclist = [Select Id, Name, Type, Website, Phone, Industry from Account];
        return acclist;
        
    }
    
     @AuraEnabled
    public static void deleteAccountApex(List<string> accIds){
        List<Account> acclist = [Select id from Account where id in: accIds];
        delete acclist;
          }
}
Hello, I wanted to deploy an apex trigger, but I got following error:User-added image
Could you tell me what to change in my apex code or custom metadata, so this error will not appear and the deployment will work?


trigger DataBlockContentVersion on ContentVersion(before insert) {
try {   
    //DataBlock_mdt = Im Bereich Custom Metadata Types: Alle Dateitypen die als Files hochgeladen werden können
        //Set<String> blockedTypes = new Set<String>();
        Set<String> allowedTypes = new Set<String>();
        for (DataBlock__mdt  blockedType : [SELECT FileExtension__c FROM DataBlock__mdt WHERE FileExtension__c != null]) {
            allowedTypes.add(blockedType?.FileExtension__c?.toUpperCase());
        }
        for (ContentVersion myDocument : Trigger.new) {
            system.debug('PathOnClient '+myDocument.PathOnClient);
                
            if (myDocument.PathOnClient != null) {
                String[] parts = myDocument.PathOnClient.split('\\.'); 
                system.debug('part '+parts);
                if (parts.size() > 0) {
                    String ext = parts[parts.size() - 1];
                    if (!allowedTypes.contains(ext.toUpperCase())) { // added a NOT operator ! at the front
                       myDocument.addError('Der Upload von Dateien mit der Endung .' + ext + ' ist nicht erlaubt. Erlaubte Dateitypen sind .pptx, .xlsx, .docx, .msg, .pdf'); 
                    }
                }
            }
        }
    } catch (Exception e) {
        throw new StringException(e.getMessage() + ' - ' + e.getLineNumber() + '\r\n' + e.getStackTraceString());
    }
}

User-added image
Hello, I build a trigger that blocks file types that are in my custom metadata (DataBlock). Now I would like to change the trigger so every type except the ones in my metadata are blocked. Could you tell me by my code sample how to change the apex trigger so it does not block these file types but allows them and blocks every else?

Greetings
Jonathan

trigger DataBlockContentVersion on ContentVersion(before insert) {
    try {   
        Set<String> blockedTypes = new Set<String>();
        for (DataBlock__mdt  blockedType : [SELECT FileExtension__c FROM DataBlock__mdt WHERE FileExtension__c != null]) {
            blockedTypes.add(blockedType?.FileExtension__c?.toUpperCase());
        }
        for (ContentVersion myDocument : Trigger.new) {
            system.debug('PathOnClient '+myDocument.PathOnClient);
                
            if (myDocument.PathOnClient != null) {
                String[] parts = myDocument.PathOnClient.split('\\.'); /*Payal: Updated regex for splitting extension*/
                system.debug('part '+parts);
                if (parts.size() > 0) {
                    String ext = parts[parts.size() - 1];
                    if (blockedTypes.contains(ext.toUpperCase())) {
                       myDocument.addError('The datatype ' + ext + ' is not allowed'); 
                    }
                }
            }
        }
    } catch (Exception e) {
        throw new StringException(e.getMessage() + ' - ' + e.getLineNumber() + '\r\n' + e.getStackTraceString());
    }
}
System.AsyncException: Maximum stack depth has been reached.
Class.Qapex.execute: line 14, column 1
I am new to salesforce. I was pulling my hair trying to figure out this queueable apex and I want to know how to write a test class for the below code. I have chained 1 child job. 
Please give examples


Parent queueable class:
public with sharing class Qapex implements Queueable{
    private list L;
        public Qapex(List a) {
            this.L= a;
        }
    public void execute(QueueableContext q){
        list LA= new list();
        for(account f: this.L){
            account acc= new account();
            acc.Name= 'queable name' + f.Name;
            LA.add(acc);
        }
        INSERT LA;
        system.enqueueJob(new Qapex1());
    }
    }

Child queueable class: 
public with sharing class Qapex1 implements Queueable{
    public void execute(QueueableContext QC){
        account ac = new account(name= 'new name');
        insert ac;
    }
   
}

Trigger:
trigger QapexTgr on Account (before insert) {
 if(trigger.isBefore){
     if(trigger.isInsert){
         system.enqueueJob(new Qapex(trigger.new));
     }
 }
}

Parent queuable test class:
@istest
public with sharing class QapexTCLS {
    public testmethod static void QapexTCLSM(){
            Account a= new Account();
            a.Name= 'test account';
        
        insert a;
        test.startTest();
        system.enqueueJob(new Qapex(trigger.new));
        test.stopTest();

        account acc= [SELECT ID, name FROM account WHERE ID = : A.ID];
        system.assertEquals('test account', a.name);
    }

}

Child queueable test class:
@istest
public class Qapex1TCls {
   @istest
    public static void Qapex1TClsM() {
    account a= new account(name= 'qapextestname');
    insert a;

    test.startTest();
    system.enqueueJob(new Qapex1());
    test.stopTest();

    account ac= [select id, name from account where id= : a.id];
    system.assertEquals('qapextestname', a.name);
    }
}

ERROR:
QapexTCLS.QapexTCLSM  Fail     System.AsyncException: Maximum stack depth has been reached.  
                               Class.Qapex.execute: line 14, column 1   

This class name's value is invalid: Qapex1TCls. Provide the name of an Apex class that has test methods.
I'm confused in assignment rule & queue , if we want to automate tranfer of owners of other than lead and case object, what should be done .

Please someone clarify my doubt
Tthank You
Hi  all,
I am having an issue with saving record of lightning:recordEditForm with nested component.
I have component A which will display content depending on currentuserID. In this case, component A will call component B to open a new modal popup. The problem occurs when I press the save button, it shows a windows message like below image.
I tested component B by overriding 'new' standard action, but no errors occurred and record is saved.
So, I think component B doesn't work when nested in another component, but I don't know how to fix it properly.
I'm new to aura so I don't understand it very well.
Someone please help me. Thank you
--------------Component A( testNestedComponent.cmp)----------------------------------
<aura:component implements="lightning:actionOverride,force:hasRecordId,force:hasSObjectName">
	<!-- attributes -->
	<aura:attribute name="checkUser" type="Boolean" default="true" />
	<aura:attribute name="userId" type="User" />
	<!-- handlers-->
	<aura:handler name="init" value="{! this }" action="{! c.init }" />
	<aura:if isTrue="{!v.checkUser}">
		<lightning:listView aura:id="listViewDoctors" objectApiName="DoctorPersonalInfo__c" listName="AllDoctorPersonalInfo"
			rows="10" showSearchBar="true" showActionBar="false" enableInlineEdit="false" showRowLevelActions="false" />
	<aura:set attribute="else">
		<c:createNewDoctorPopupModal />
	</aura:set>
	</aura:if>
</aura:component>
 
-----------------Component B( createNewDoctorPopupModal.cmp)-------------------
<aura:component controller="createNewDoctor_Apex"
  implements="force:hasRecordId,flexipage:availableForAllPageTypes,lightning:actionOverride,force:lightningQuickAction">
  <lightning:workspaceAPI aura:id="workspace" />
  <aura:attribute name="loading" type="Boolean" default="false" />
  <aura:attribute name="isModalOpen" type="boolean" default="true" />

  <aura:handler name="init" value="{!this}" action="{!c.init}" />
  <div class="slds-m-around_xx-large">
    <aura:if isTrue="{!v.isModalOpen}">
      <lightning:recordEditForm objectApiName="DoctorPersonalInfo__c" aura:id="newRecordDoctorInfo"
        onsuccess="{!c.handleSuccess}" onsubmit="{!c.handleSubmit}" onerror="{!c.handleError}" onload="{!c.handleLoad}">
        <lightning:messages aura:id="OppMessage" />
        <!-- Modal/Popup Box starts here-->
        <section role="dialog" tabindex="-1" aria-hidden="false" aria-labelledby="modal-heading-01" aria-modal="true"
          aria-describedby="modal-content-id-1" class="slds-modal slds-backdrop_open">
          <div class="slds-modal__container">
            <!-- Modal/Popup Box Header Starts here-->
            <header class="slds-modal__header">
              <lightning:buttonIcon iconName="utility:close" onclick="{! c.closeModel }" alternativeText="close"
                variant="bare-inverse" class="slds-modal__close" />
              <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{!'新規 医師情報'} </h2>
            </header>
            <!--Modal/Popup Box Body Starts here-->
            <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
              <div class="slds">
                <div class="row">

                  <div class="slds-section__title slds-theme_shade" style="padding: 3px;">
                    <h3 style="font-size: 1rem;" title="">Information</h3>
                  </div>
                  <div class="slds-grid">
                    <div class="slds-size_6-of-12 slds-p-left_xx-large slds-p-horizontal_x-large ">
                      <lightning:inputField class=".slds-size_1-of-2" fieldName="doctorName__c"
                        aura:id="newDoctorInfoField" />
                    </div>
                  </div>
                  <div class="slds-grid">
                    <div class="slds-size_6-of-12 slds-p-left_xx-large slds-p-horizontal_x-large ">
                      <lightning:inputField class=".slds-size_1-of-2" fieldName="doctorGender" aura:id="newDoctorInfoField"
                        required="true" />
                    </div>
                  </div>
				  
                </div>
              </div>
            </div>
            <!--Modal/Popup Box Footer Starts here-->
            <footer class="slds-modal__footer">
              <lightning:button variant="neutral" label="Cancel" title="Cancel" onclick="{! c.closeModel }" />
              <lightning:button variant="brand" label="Save" title="OK" type="submit" />
              <!-- onclick="{!c.submitDetails}" -->
            </footer>
          </div>
        </section>
        <div class="slds-backdrop slds-backdrop_open"></div>
        <aura:if isTrue="{!v.loading}">
          <lightning:spinner alternativeText="Loading" />
        </aura:if>
      </lightning:recordEditForm>
    </aura:if>
  </div>
</aura:component>

 
I am writing a custom listner to lightning showtoast in my lwc application. 
constructor() {
        super();
        this.addEventListener('lightning__showtoast', this.handleNotification);
    }

    handleNotification() {
        //do something here
    }

this works fine when I fire the toast event explicitly via code. But when I use the lightning navigation, the standard toast events are fired.

Pop up is opened through the Navigation
navigateToRecordEditPage(event, recordId) {
        event.preventDefault();
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: recordId,
                objectApiName: this.records.relatedSobjectApiName,
                actionName: 'edit'
            }
        });
    }
Once the records are saved, the toast event is fired but same is not caught in the handler created. 
Does anyone have any idea how to make it work for standard toast events as well. 
 
I am using lightning datatable where there are two actions EDIT and DELETE. When I choose the EDIT option I am opening the standard edit navigation as follows.
<lightning-datatable 
     class="slds-max-medium-table_stacked"
     key-field="Id" 
     data={records.records}
     columns={records.columns}
     onrowaction={handleRowAction}
     hide-checkbox-column=true
     show-row-number-column=false>
</lightning-datatable>
on handleRowAction I am calling following for EDIT
 
handleRowAction(event) {
        this.actionName = event.detail.action.name.toUpperCase();
        const row = event.detail.row;
        switch (this.actionName) {
            case 'DELETE':
                this.selectedRecord = row;
                this.isDeleteModal = true;
                break;
            case 'EDIT':
                this.navigateToRecordEditPage(event, row.Id);
                break;
            default:
        }
    }

    navigateToRecordEditPage(event, recordId) {
        event.preventDefault();
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: recordId,
                objectApiName: this.records.relatedSobjectApiName,
                actionName: 'edit'
            }
        });
    }

this opens the standard modal and update the record but same is not reflected on datatable. Is there any way we can capture the save callback/event in LWC. I know we have option in aura as force:refreshView event, is there anything similar in lightning as well?

Note: I know this is possible if I use lightning-record-edit-form where I have full control on save and submit but I need this working for the standard navigatoin.
Hi all,
I am wondering what is wrong in my process. The requirement is to set the Company field on Lead to null when the record type changes or has changed from B2B Lead to B2C Lead and only under this condition. However it is not 100% clear to me how to represent this in a process builder.
Here my steps by testing the process builder:
 
I created a Lead record with B2B record type and filled out the Company field
I clicked on 'Change record type' and changed the record to B2C Lead
When I check if the company is now empty (with a Chrome extension for Salesforce), I see Company is not yet empty
I change the record type to B2B Lead again, then I see the company is set to null this time
I see my process needs some adjustments but I don't know what else to use in order to let this work.
This is my process:

User-added image
User-added image

User-added image

I would appreciate your tips, what am I doing wrong?
In this code every time I'm hovering the mouse on a record the topmost row in the component is getting highlighted instead of the corresponding row on which the mouse is hovered. Any suggestion will be appreciated.

HTML file snippet
<template for:each={actions} for:item="action">
            <div class="slds-p-vertical_xxx-small box" key={action.Id} id={action.Id} onmouseover={addColor} onmouseout={removeColor}>
                <div class="slds-p-left_medium">
                    {action.Name}
                </div>
            </div>
</template>

JS File snippet
addColor() {
    this.template.querySelector('.box').classList.add('highlight');
}

removeColor() {
    this.template.querySelector('.box').classList.remove('highlight');
}

CSS File
.highlight {
background-color: rgb(243, 242, 242);
}

Screenshot
User-added image
Here I've my mouse pointed on 'Action 3' record but the 'Action 1' is getting highlighted.
Hello Everyone
kindly help me how to READ AND INSERT RECORDS FROM A CSV FILE _ using LIGHTNING AURA COMPONENT.
Hello Everone,
I ahve the below batch class and was wondering if ther eis a way to throw up a message to let the user know that the update is happening.  Its a batch and some of the recvords have 100+ child records so it will take a awhile for the batch classes to complete. 
public class UpdateNoticeFromAccountQueueableBatch implements Database.Batchable <sObject>, Database.Stateful{
    public List<Notice__c> noticeList = new List<Notice__c>();
    public String vatQueVatValue;
    public UpdateNoticeFromAccountQueueableBatch ( List<Notice__c> records ,String vatValueFromQue ) {
        noticeList = records;
        vatQueVatValue = vatValueFromQue;
        system.debug('noticeList value in batch' + noticeList );
        system.debug('vatQueVatValue value in batch' + vatQueVatValue );
    }
    public List<SObject> start(Database.BatchableContext bc){
        return noticeList;
    }
    public void execute(Database.BatchableContext bc, List<Notice__c> scope){
         List< notice>  NoticeToUpdateFromAccount = new List<Notice__c>();   
         system.debug('scope value ' + scope);
         system.debug('vatQueVatValue value batch' + vatQueVatValue);
         if(!scope.isEmpty()){
             For ( Notice__c noticess : scope){  
               noticess.Any_other_Lessor_Info_VAT_Number__c  = vatQueVatValue;
             }
         Database.update(scope, false);
         ---- add label message here to notify user that batch is running?
         }   
       
    }

Just don't want the user guessing what is going on.

Thanks you.
P
Hello,

I am new to development and I need some assistance.
Context: I am attempting to make a LWC that lives on the Home Page of our Org's App and lists a series of accounts in an accordion with related contacts nested in an additional accordion section. My code works so far, but now we need the lightning button listed on the contact to take the user when clicked to the appropriate Contact record page.

I have set up the Navigation but at first I was getting the error: "Cannot Find Page". So I attempted to pull the contact Id as it is listed in the button via data-key={con.Id} and feed that through the [NavigationMixin.Navigate] but now I receive a new error:  [Cannot read property 'dataset' of undefined]

We need the button to dynamically know what contact the button is being clicked from and direct the user to that contact's record page. Any help would be greatly appreciated! Also, apologies if the code is really muddy, I have been attempting many things to fix this and so there may be code that is not  needed.

HMTL:
<template>
    <lightning-card>
        <div class="slds-m-left_small">
            <div class="slds-text-heading_medium">
                <lightning-icon icon-name="standard:account" size="medium"></lightning-icon><strong> Client Accounts and Contacts</strong> 
            </div>
        </div>
        <template if:true={accounts}>
            <!-- accordion component with muliple sectio open -->
        <lightning-accordion allow-multiple-sections-open>
            <template for:each={accounts} for:item="acc" for:index="indexVar">
                <lightning-accordion-section key={acc.Id} name={acc.Name} label={acc.Name}>
                    <template for:each={acc.Contacts} for:item="con">
                        <lightning-accordion-section name={con.Name} label={con.Name} key={con.Id}>
                            {con.Title}
                            <lightning-button variant="brand" label="Go to Record" title="Primary action" onclick={navigateToObjectContact} class="slds-m-left_x-small" value={con.Id} name={con.Name} data-key={con.Id}></lightning-button>
                        </lightning-accordion-section>
                    </template>
                </lightning-accordion-section>
            </template>
        </lightning-accordion>
        </template>
    </lightning-card>
</template>

JavaScript:
import { api, LightningElement, track, wire} from 'lwc';
// importing apex class method to get the accounts
import retriveAccounts  from '@salesforce/apex/GetAccountContactData.getAccountData';
// imported to show toast messages
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
// imported to allow page navigation
import { NavigationMixin } from 'lightning/navigation';
export default class AccordinLWCDemo extends NavigationMixin(LightningElement) {
    @track accounts;
    @api title;
    @api greetings;
    @api recordId;
    navigateToObjectContact() {
        // Navigate to the Contact home page
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                        recordId: this.selectedRecordId,
                        objectApiName: 'Contact',
                        actionName: 'view',
            },
        });
        this.selectedRecordId = Event.target.dataset.key;
    }
    // wire service to fetch the slesforce data
    @wire(retriveAccounts)
    wiredAccount({ error, data }) {
        if(data) {
            this.accounts = data;
            this.error = undefined;
        }
        else if(error) {
            this.error = error;
            this.accounts = undefined;
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error!!',
                    message: error.message,
                    variant: 'error',
                }),
            );
        }
    }
}

Apex:
public with sharing class GetAccountContactData {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountData() {
        return [SELECT Id, Name ,(Select Id, Name, Email, Phone, Title from Contacts) from Account WHERE Active__c = TRUE AND RecordTypeId = '0122K000001Dio1QAC' ORDER BY Name];
    }
}
 

We are currently creating a LWC community registration page and we want to implement the Googlge reCAPTCHA module. We are unable to use this module because of the locker services, which prevents access to the DOM. 

 

Does anyone perhaps know a method to implement the reCAPTCHA module in an LWC communtiy page?

Hello,
I have 2 parents record types (Contact):
  • Physical Person
  • Juridical Person
My child object (Form) has 4 record types:
  • Physical Pre Form
  • Physical Form
  • Juridical Pre Form
  • Juridical Form
When I create a new Form using the related list button "New" is it possible to display only Physical Pre Form and Physical Form options if my Contact is a Physical Person?

I'm using a validation rule, but it's a big form and users will only get the notification that are filling out the wrong form when they save, after all the filling work.
Can someone guide me step by step.
How can we integrate Einstein Bot with whatsapp?
Verify Image selection pop up size issue in form through vf page embedded in LWC/Lightning User-added image
Hello!

I'd like to preface this with the fact that I have 0 dev knowledge and struggle to understand all this, so feel free to speak to me like I'm 5 if you can help! :D

I'm trying to implement reCAPTCHA v2 onto my Community Self-Registration page. I've gotten pretty far and I'm still having some trouble, but I have two questions regarding it's functionality to start with (screenshot below).
  1. Is there a way to get rid of the Submit button? I don't want the user's to have to fill out the form, check the reCAPTCHA box, then click the reCAPTCHA "Submit" button, then finally click our Register button. I want the reCAPTCHA to be verified when they check the box.
  2. Will I have to update my Site Key regulary? I saw a concern about it breaking weekly from a couple years ago, and while I don't think it's a valid concern anymore, I want to make sure. I have added the necessary Trusted Sites.

For reference, I followed these two resources:
  • https://www.learncommunitycloud.com/s/article/Implementing-reCAPTCHA-in-Community-Cloud
  • http://varasi.com/salesforce/embedding-google-recaptcha-v2-in-salesforce-lightning-component-to-increase-security/

User-added image
how can I integrate einstein chatbot to facebook? like for our users ther should be chatbot on facebook with whom they can chat?
Hi,
I have successfully added the reCAPTCHA widget to the lead submission form after registering domain and receiving a public and private key pair. (Documentation: https://help.salesforce.com/articleView?id=customizesupport_web_to_case_enable_recaptcha.htm&type=0&language=en_US&release=206.9)
Spring'17 release note: https://releasenotes.docs.salesforce.com/en-us/spring17/release-notes/rn_sales_web_to_lead_recaptcha.htm

During testing this functionality, I observed that an individual can bypass the recaptcha and submit the form. There's no validation that requires the user to click "I'm not a robot" in order to post the data.

My question is:
How is the "Verifying the user's response" process done in Salesforce?  Ref. : https://developers.google.com/recaptcha/docs/verify  

Do I need to create an Apex Class for this?
Has anyone successfully implemented this feature.  Salesforce Support was unable to help.

Any help is greatly appreciated!
 
Overall task is scan the barcode in saledforce.

Suppose my comoputer is connect with barcode scanner machine.
In salesforece  i've a custom object ITEM.  create a visualforce page of this item object and when we  click on new button the page will display.
we can scan the barcode then barcode id should be display on the page in row.
and finally when we click on saved button then record will be saved

How to achieve overall this functionality.

Please suggest.
 
Hi,

I have a Google reCaptcha class and VF page created separately in the Org. i want to use this reCaptcha on one other VF page (register page) existing on the same org for which I have embedded the below line in the VF page. This is somehow making the captcha images available on the register page, but the functionality is not at all working.

<apex:include pageName="reCAPTCHA"/>

I would need your expertise on this.

 
I have a reuirement like i need to scan the barcode with i-pad and the related barcode comes in the input field in apex and then i will do further modifications based on this.ANY IDEAS?
Hello All, 

We are working on one of our client requirement to have a barcode scanning fucntionlity on Salesforce1.
Requirement reads as, on One Custom object we got barcode image and barcode number.
We need a search functionality where User may click an image of barcode or provide the same from the application tray from mobile and based on barcode scan, it will search for available barcode records if any and returns the same.

Would appriciate your help on this.
Thanks in advance.
 

Hi 

Do anyone ever worked with scanning barcodes from barcode reader harware into salesforce?

Hi All,

 

We would like to scan a bar code and have it create a record in Salesforce on a custom object, as well as an activity record.  Has anyone had success doing this?

 

--David

Hi,

 

How to Integrate Facebook without using Facebook ToolKit?

 

please help me.

 

 

  • February 14, 2011
  • Like
  • 0