• Inbox Outbox
  • NEWBIE
  • 140 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 13
    Replies
Write a SOQL statement that returns the Id and name of 25 accounts from Canada in alphabetical order.
 
        
1. Write a method that takes in a list of Account Ids.  The method should have the return type: map<Id, map<Id, list<OpportunityLineItem>>>. Each account Id passed in should be mapped to a map of its opportunities mapped to the list of their respective opportunity line items.  Only opportunities with an amount of 500,000 or more should be included in the return.  There is a custom boolean field on the opportunity line item with API name Export_Ignore__c.  If this field is true, the account should be removed from the return map.


2. Write a SOSL statement that returns any leads or contacts where either the first or last name contains ‘cha’.  Both lead and contact results should contain the email address, first name, and last name.  Contacts should also include the account Id.

3. Write a SOQL statement that returns the Id of 10 accounts and all of the opportunity names associated with each account.

I have hightlighted the code with bold letters where I have doubt. 
My question is ,why is the variable defined sometimes above the class definition and sometimes within the class.
(the only difference I found is: variables are defined outside the close when it is standard fields)
Variables in question: objectApiName, fields and FIELDS.

My question is only about defining the variables. 
Excuse the way I put my question,  I did not know how to put it  into words. 
JS file 1: 
import { LightningElement, wire } from 'lwc';
import {getObjectInfo, getObjectInfos} from 'lightning/uiObjectInfoApi'
import ACCOUNT_OBJECT from '@salesforce/schema/Account'
import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity'
export default class GetObjectInfoDemo extends LightningElement {
    @wire(getObjectInfo, {objectApiName:ACCOUNT_OBJECT})
    objectInfo
    objectApiNames = [ACCOUNT_OBJECT, OPPORTUNITY_OBJECT]
    objectInfos
    @wire(getObjectInfos, { objectApiNames: '$objectApiNames' })
    objectInfosHandler({data}){
        if(data){
            console.log(data)
            this.objectInfos = data
        }
    }
}

JS file 2: 
import { LightningElement, wire } from 'lwc';
import {getRecord} from 'lightning/uiRecordApi'
import Id from '@salesforce/user/Id'
import NAME_FIELD from '@salesforce/schema/User.Name'
import EMAIL_FIELD from '@salesforce/schema/User.Email'
const fields = [NAME_FIELD, EMAIL_FIELD]
export default class WireDemoUserDetail extends LightningElement {
    userId = Id
    userDetail
    @wire(getRecord, {recordId:'0050p000002MXU6AAO', fields})
    userDetailHandler({data, error}){
        if(data){
            this.userDetail = data.fields
        }
        if(error){
            console.error(error)
        }
    }
    @wire(getRecord, {recordId:'0050p000002MXU6AAO', fields})
    userDetailProperty
}

JS file 3: 

import { LightningElement, api, track, wire } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { getRecord } from 'lightning/uiRecordApi';
const FIELDS = ['Contact.Name', 'Contact.Phone'];
export default class LoadContact extends LightningElement {
    @api recordId;
    @track contact;
    @track name;
    @track phone;
    @wire(getRecord, { recordId: '$recordId', FIELDS })
    wiredRecord({ error, data }) {
        if (error) {
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error loading contact',
                    message: error.message,
                    variant: 'error',
                }),
            );
        } else if (data) {
            this.contact = data;
            this.name = this.contact.fields.Name.value;
            this.phone = this.contact.fields.Phone.value;
        }
    }
}
One of the reasons we call apex methods imperatively (as opposed to using wire) is to call methods from ES6 modules that doesn't extend lightning element.
What does that mean? Could you guys give a use case or a scenario?
Really appreaciate your input. 

If at least 3 key fields (firstname, lastname and website)are populated, create a new Task for each key field populated: 
The name of each Task should be: Verify the <<key field name>> field.
I can create one task but I am not sure how to create three task for each field. 

Not completed code: Below is my helper class:
public class keyFieldsPopulatedHelper {
   List <task> TaskLead= new list <task>();
    public static void keyFieldsPopulatedHelperMethod(list<Lead> LeadList){
        for(Lead L: LeadList){
            if(L.Key_Fields_Populated__c >=3){
                Task T= New Task();
                T.WhatId= L.Id;
            }
        }       
    }
}

 

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
        }
    }
}
 
Sometime you use an array and sometimes an object, how do we know that? How do we know what to use? I am presuming that when we have key value pairs we use object and other times we use array. But there is more to this than what I know.

Please advise. 
 
 Greetings!
Could anyone provide a list of all the processes/methods in  asynchronous Javascript (LWC and AURA)? Please mention just the list of methods.  

Thank you. 
I am trying to create a record using lightning-record-edit-form, however I am kind of stuck as to how to approach this. 
I want to include a toast message after the account creation, I understand that I have to create a handler in the lightning-input-field as well. But I am not sure how to do this. 

https://salesforce.stackexchange.com/questions/274178/lightning-web-components-save-form-data-to-the-controller

The above link shows what I need but it is kind of complicated for me. I am looking for may be a simpler code than this. 
Can anyone help me please?

Here is my code:
<template>
    <lightning-card title= "Lightning">
       <lightning-record-edit-form
       object-api-name={objectName}
       >
       <div class= "slds-box">
        <lightning-input-field field-name={fields.contactName}></lightning-input-field>
        <lightning-input-field field-name={fields.contactTitle}></lightning-input-field>
        <lightning-input-field field-name={fields.contactPhone}></lightning-input-field>
        <lightning-input-field field-name={fields.contactEmail}></lightning-input-field>
        <lightning-input-field field-name={fields.ccountId}></lightning-input-field>
        <lightning-button 
         class= "slds-m-around_xx-small" 
         variant= "neutral" 
         label= "Cancel" 
         onclick={cancelHandler}>
        </lightning-button>
        <lightning-button 
         class= "slds-m-around_xx-small" 
         variant= "brand" 
         label= "Submit" 
         onclick={saveHandler}>
        </lightning-button>
       </div>
       </lightning-record-edit-form>
    </lightning-card>
        </template>

JS:
import { LightningElement, api } from 'lwc';
import CONTACT_OBJECT from '@salesforce/schema/Contact'
import CONTACT_NAME from '@salesforce/schema/Contact.Name'
import CONTACT_TITLE from '@salesforce/schema/Contact.Title'
import CONTACT_PHONE from '@salesforce/schema/Contact.Phone'
import CONTACT_EMAIL from '@salesforce/schema/Contact.Email'
import CCOUNT_ID from '@salesforce/schema/Contact.AccountId'
export default class RecordEditForm extends LightningElement {
    objectName= CONTACT_OBJECT;
    fields= {
        contactName: CONTACT_NAME,
        contactTitle: CONTACT_TITLE,
        contactPhone: CONTACT_PHONE,
        contactEmail: CONTACT_EMAIL,
        ccountId: CCOUNT_ID
    }
    // cancelHandler(event){
    //     event.target.value
    // }
    // saveHandler(event){
    //     event.target.value
    // }
}.

 
 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;
}

 

Greetings!

Please give the class code and also the trigger code completely include the CRON expression. 
I don't know the syntax of how to invoke a trigger and then test it to run.

I just need the syntax to go by.

I'd appreciate the scenario of creating account from lead (account name with the lead's last name. 

Thanks a ton!

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.

public  class queuables implements  queueable{
   
    public void execute(QueueableContext q) {
        Account a= new Account(Name= 'queuable account');
        insert a;
    }
}


trigger QueueableTrgr on Account (before insert) {
if(trigger.isBefore){
    if(trigger.isInsert){
        system.enqueueJob( new queuables(trigger.new));
   
    }
}
}

Error: 
Constructor not defined: [queuables].<Constructor>(List<Account>)
Constructor not defined: [quclass].<Constructor>(List<Account>)

I have questions kind of related to this code as below
Thank you guys for the reply. 

1. I was wondering why we use conditional boolean context variables like isInsert, isbefore when we already mention the DML events (before insert) in the trigger parameter!
2. Can we track the queuable job progress from whithin the same trigger which invokes?
Sunshine!
Do we use both synchonous and asynchronous callouts for external web services? When do we use synchronous and when do we use asynchronous?
Please give me some examples or scenarios. 

 
Greetings!

I was wondering how many sandboxes (count) are used by a company! I am looking for a general version of the answer. 
I want to know about big companies  (tech, banking, transport etc industry) and mid-sized companies (customer support). 

Please excuse my round- about question.

For example, company a has three sandboxes: development, UAT and testing.  

 
I am trying to send a mass welcome email (new customer template) to contacts after we save the contact. All I want is to know why I am getting the error and the solution for that. 
I have the following code with an error. Please advice!

class:
public class massEmail 

{
    public void mail(){
        list<contact> l= [SELECT ID FROM contact LIMIT 2];
        list<ID> I= new list<ID>();
        for(contact c: l){
            I.add(C.Id);    
        }
        
        EmailTemplate e = [SELECT ID FROM EmailTemplate WHERE Name = 'Sales: New Customer Email'];
        messaging.MassEmailMessage  m = new messaging.MassEmailMessage();
        m.setTargetObjectIds(I);
        m.setSenderDisplayName('System Admin');
        m.setTemplateId(e.Id);
        messaging.sendEmail(new messaging.MassEmailMessage [] {m});     
    }
}

Trigger:
trigger NewCustEmail on Contact (after insert)

{
    if(trigger.IsAfter){
         massEmail.mail(trigger.new);
    }
}

Error: 
Method does not exist or incorrect signature: void email(List<Contact>) from the type massEmail
I need help in writing a code to send email both single and mass email with LWC and apex both? Please correct me and advice me. 
I want to be able to create a custom component where we can attach a file (template) and send it. 
I also want to write a trigger with/without a helper class to be able to send a mass email. 
Any use case is fine, please mention the use case so that my silly brain can co-relate.
 
Sometime you use an array and sometimes an object, how do we know that? How do we know what to use? I am presuming that when we have key value pairs we use object and other times we use array. But there is more to this than what I know.

Please advise. 
 
I am trying to create a record using lightning-record-edit-form, however I am kind of stuck as to how to approach this. 
I want to include a toast message after the account creation, I understand that I have to create a handler in the lightning-input-field as well. But I am not sure how to do this. 

https://salesforce.stackexchange.com/questions/274178/lightning-web-components-save-form-data-to-the-controller

The above link shows what I need but it is kind of complicated for me. I am looking for may be a simpler code than this. 
Can anyone help me please?

Here is my code:
<template>
    <lightning-card title= "Lightning">
       <lightning-record-edit-form
       object-api-name={objectName}
       >
       <div class= "slds-box">
        <lightning-input-field field-name={fields.contactName}></lightning-input-field>
        <lightning-input-field field-name={fields.contactTitle}></lightning-input-field>
        <lightning-input-field field-name={fields.contactPhone}></lightning-input-field>
        <lightning-input-field field-name={fields.contactEmail}></lightning-input-field>
        <lightning-input-field field-name={fields.ccountId}></lightning-input-field>
        <lightning-button 
         class= "slds-m-around_xx-small" 
         variant= "neutral" 
         label= "Cancel" 
         onclick={cancelHandler}>
        </lightning-button>
        <lightning-button 
         class= "slds-m-around_xx-small" 
         variant= "brand" 
         label= "Submit" 
         onclick={saveHandler}>
        </lightning-button>
       </div>
       </lightning-record-edit-form>
    </lightning-card>
        </template>

JS:
import { LightningElement, api } from 'lwc';
import CONTACT_OBJECT from '@salesforce/schema/Contact'
import CONTACT_NAME from '@salesforce/schema/Contact.Name'
import CONTACT_TITLE from '@salesforce/schema/Contact.Title'
import CONTACT_PHONE from '@salesforce/schema/Contact.Phone'
import CONTACT_EMAIL from '@salesforce/schema/Contact.Email'
import CCOUNT_ID from '@salesforce/schema/Contact.AccountId'
export default class RecordEditForm extends LightningElement {
    objectName= CONTACT_OBJECT;
    fields= {
        contactName: CONTACT_NAME,
        contactTitle: CONTACT_TITLE,
        contactPhone: CONTACT_PHONE,
        contactEmail: CONTACT_EMAIL,
        ccountId: CCOUNT_ID
    }
    // cancelHandler(event){
    //     event.target.value
    // }
    // saveHandler(event){
    //     event.target.value
    // }
}.

 
 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;
}

 
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.

public  class queuables implements  queueable{
   
    public void execute(QueueableContext q) {
        Account a= new Account(Name= 'queuable account');
        insert a;
    }
}


trigger QueueableTrgr on Account (before insert) {
if(trigger.isBefore){
    if(trigger.isInsert){
        system.enqueueJob( new queuables(trigger.new));
   
    }
}
}

Error: 
Constructor not defined: [queuables].<Constructor>(List<Account>)
Constructor not defined: [quclass].<Constructor>(List<Account>)

I have questions kind of related to this code as below
Thank you guys for the reply. 

1. I was wondering why we use conditional boolean context variables like isInsert, isbefore when we already mention the DML events (before insert) in the trigger parameter!
2. Can we track the queuable job progress from whithin the same trigger which invokes?
Sunshine!
Do we use both synchonous and asynchronous callouts for external web services? When do we use synchronous and when do we use asynchronous?
Please give me some examples or scenarios. 

 
Greetings!

I was wondering how many sandboxes (count) are used by a company! I am looking for a general version of the answer. 
I want to know about big companies  (tech, banking, transport etc industry) and mid-sized companies (customer support). 

Please excuse my round- about question.

For example, company a has three sandboxes: development, UAT and testing.  

 
I am trying to send a mass welcome email (new customer template) to contacts after we save the contact. All I want is to know why I am getting the error and the solution for that. 
I have the following code with an error. Please advice!

class:
public class massEmail 

{
    public void mail(){
        list<contact> l= [SELECT ID FROM contact LIMIT 2];
        list<ID> I= new list<ID>();
        for(contact c: l){
            I.add(C.Id);    
        }
        
        EmailTemplate e = [SELECT ID FROM EmailTemplate WHERE Name = 'Sales: New Customer Email'];
        messaging.MassEmailMessage  m = new messaging.MassEmailMessage();
        m.setTargetObjectIds(I);
        m.setSenderDisplayName('System Admin');
        m.setTemplateId(e.Id);
        messaging.sendEmail(new messaging.MassEmailMessage [] {m});     
    }
}

Trigger:
trigger NewCustEmail on Contact (after insert)

{
    if(trigger.IsAfter){
         massEmail.mail(trigger.new);
    }
}

Error: 
Method does not exist or incorrect signature: void email(List<Contact>) from the type massEmail
I need help in writing a code to send email both single and mass email with LWC and apex both? Please correct me and advice me. 
I want to be able to create a custom component where we can attach a file (template) and send it. 
I also want to write a trigger with/without a helper class to be able to send a mass email. 
Any use case is fine, please mention the use case so that my silly brain can co-relate.