• Princes91221
  • NEWBIE
  • 44 Points
  • Member since 2020


  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 5
    Replies
Hope you're doing well.
I want to print an error toast, the pop-up appearing but the message is not printing.
I researched and tried a lot about that but was unsuccessful.
Below is my JS controller.
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
handleTimesheet() {
    saveData({
        firstName :this.firstName,
        lastName :this.lastName,
        accountId :this.recordId
    })
    .then(result => {
        //Shows Success Toast Event
        const e = new ShowToastEvent({
            title: 'Success',
            message: result,
            variant: 'success',
            mode: 'dismissable',
        });
        this.dispatchEvent(e);
        // console.log('result: ' +result);
    })
    .catch(error => {
        //Shows Error Toast Event
        const e = new ShowToastEvent({
            title: 'Error Occured',
            message: error.body.message,
            // I TRIED THIS AND THE BELOW LINE AS WELL
            message: error.body.output.errors[0].message,
            // I GOT ERROR ON THIS LINE "Cannot read properties of undefined (reading 'errors')"
            variant: 'error',
            mode: 'dismissable',
        });
        this.dispatchEvent(e);
        console.log('Error: ', JSON.stringify(error));
    })
}

Any help would be appreciated.

Thanks and Regards,
Prince Sharma.
Hello all,

Hope you guys are safe and doing well.

I'm new to Salesforce Development and trying to iterate an array but enable to do it.

I want to display 7 input fields.

While opening the org I'm getting the following error
"Error during LWC component connect phase: [Cannot read properties of undefined (reading 'inputHours')]"

Here's my HTML Code
<div class="slds-form-element slds-var-p-around_small">
    <div class="slds-grid">
        <template if:true={projectHoursDatas}>
            <template for:each={projectHoursDatas} for:item="projectHoursData">
                <div class="slds-col slds-size_2-of-12" key={projectHoursData.id}>
                    <b>{ projectHoursData.projectName }</b>
                </div>
                <template for:each={projectsHoursData.inputHours} for:item="inputHourValue">
                    <div class="slds-col slds-size_1-of-12 slds-text-align_center" key={inputHourValue}>
                        <!-- <input type="text" class="slds-input" key={inputHourValue} /> -->
                        <span>{inputHours}</span>
                    </div>
                </template>
                <div class="slds-col slds-size_1-of-12 slds-text-align_center" key={projectHoursData}>
                    <p>00.00</p>
                </div>
            </template>
        </template>
    </div>
</div>

and here's my JS Controller
import { LightningElement } from 'lwc';

export default class Time extends LightningElement {
    headers = [
        {
            day: 'Mo',
            date: '08 - 11'
        },
        {
            day: 'Tu',
            date: '09 - 11'
        },
        {
            day: 'We',
            date: '10 - 11'
        },
        {
            day: 'Th',
            date: '11 - 11'
        },
        {
            day: 'Fr',
            date: '12 - 11'
        },
        {
            day: 'Sa',
            date: '13 - 11'
        },
        {
            day: 'Su',
            date: '14 - 11'
        }
    ];

    projectHoursDatas = [
        {
            Id: 1,
            projectName: 'Manage Time',
            inputHours: [0, 0, 0, 0, 0, 0, 0]
        }
    ];

    enteredValues= [
        {
            Id: 1,
            hours: '00.00'
        },
        {
            Id: 2,
            hours: '00.00'
        },
        {
            Id: 3,
            hours: '00.00'
        },
        {
            Id: 4,
            hours: '00.00'
        },
        {
            Id: 5,
            hours: '00.00'
        },
        {
            Id: 6,
            hours: '00.00'
        },
        {
            Id: 7,
            hours: '00.00'
        }
    ];
}

 
Hello,

I'm trying to send mail using apex class.

While I'm executing via Execute Anonymous Apex with Editors Content it throws an error stating "Unexpected token 'body' on line #3".

Below I'm pasting my code.

List<String> address = new List<String> { 'prince.sharma930@gmail.com', 'rahuls91221@gmail.com' };
String subject = 'Topcoder Challenge Sample Mail';
String body = 'Hi, Hope you stay safe and healthy during the COVID-19.;
WelcomeEmailProcessor.sendMail(address, subject, body);

Kindly Help.
Thanks you!
Hello, 
Hope you guys are doing well in this tough situation.
I'm trying to send welcome email to customers.
I did setup in Classic Email Templates.

public with sharing class WelcomeEmailProcessor {
    // public WelcomeEmailProcessor() {
        
    // }
    public static void sendMail(List<String> address, String subject, String body) {
        EmailTemplate emailTemplate = [Select Id, Subject, Email Body FROM EmailTemplate where name = 'Dreamhouse welcomes e-mail'];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(address);
        mail.setSubject(subject);
        mail.setHtmlBody(body);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}


I'm getting an error stasting only aggregate expressions use field aliasing on line number 6.
{
     "owner": "deploy-errors",
    "severity": 8,
    "message": "only aggregate expressions use field aliasing (6:39)",
    "source": "ApexClass",
    "startLineNumber": 6,
    "startColumn": 39,
    "endLineNumber": 6,
    "endColumn": 39
}

Thank you in advance! :-)
I am stuck on this challenge from past 2 days.
Kindly help.

Challenge Not yet complete... here's what's wrong:
The '# of Volunteers Still Needed' field on the 'Volunteer Shift' record is not working as expected.

I have attached a sreenshot of "# of Volunteers Still Needed" custom field.
User-added image
Thanks.
Regards Prince.
Kindly help.
I have attached an image below stating the error.

User-added image

Thanks!
Regards Prince.
I want to create a validation rule in case object.
User-added image

Kindly help.
Thanks in advance.
Regards, Prince Sharma
I want to create a validation rule in case object.
User-added image

Kindly help.
Thanks in advance.
Regards, Prince Sharma
Hope you're doing well.
I want to print an error toast, the pop-up appearing but the message is not printing.
I researched and tried a lot about that but was unsuccessful.
Below is my JS controller.
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
handleTimesheet() {
    saveData({
        firstName :this.firstName,
        lastName :this.lastName,
        accountId :this.recordId
    })
    .then(result => {
        //Shows Success Toast Event
        const e = new ShowToastEvent({
            title: 'Success',
            message: result,
            variant: 'success',
            mode: 'dismissable',
        });
        this.dispatchEvent(e);
        // console.log('result: ' +result);
    })
    .catch(error => {
        //Shows Error Toast Event
        const e = new ShowToastEvent({
            title: 'Error Occured',
            message: error.body.message,
            // I TRIED THIS AND THE BELOW LINE AS WELL
            message: error.body.output.errors[0].message,
            // I GOT ERROR ON THIS LINE "Cannot read properties of undefined (reading 'errors')"
            variant: 'error',
            mode: 'dismissable',
        });
        this.dispatchEvent(e);
        console.log('Error: ', JSON.stringify(error));
    })
}

Any help would be appreciated.

Thanks and Regards,
Prince Sharma.
Hello,

I'm trying to send mail using apex class.

While I'm executing via Execute Anonymous Apex with Editors Content it throws an error stating "Unexpected token 'body' on line #3".

Below I'm pasting my code.

List<String> address = new List<String> { 'prince.sharma930@gmail.com', 'rahuls91221@gmail.com' };
String subject = 'Topcoder Challenge Sample Mail';
String body = 'Hi, Hope you stay safe and healthy during the COVID-19.;
WelcomeEmailProcessor.sendMail(address, subject, body);

Kindly Help.
Thanks you!
Hello, 
Hope you guys are doing well in this tough situation.
I'm trying to send welcome email to customers.
I did setup in Classic Email Templates.

public with sharing class WelcomeEmailProcessor {
    // public WelcomeEmailProcessor() {
        
    // }
    public static void sendMail(List<String> address, String subject, String body) {
        EmailTemplate emailTemplate = [Select Id, Subject, Email Body FROM EmailTemplate where name = 'Dreamhouse welcomes e-mail'];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setToAddresses(address);
        mail.setSubject(subject);
        mail.setHtmlBody(body);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}


I'm getting an error stasting only aggregate expressions use field aliasing on line number 6.
{
     "owner": "deploy-errors",
    "severity": 8,
    "message": "only aggregate expressions use field aliasing (6:39)",
    "source": "ApexClass",
    "startLineNumber": 6,
    "startColumn": 39,
    "endLineNumber": 6,
    "endColumn": 39
}

Thank you in advance! :-)
I am stuck on this challenge from past 2 days.
Kindly help.

Challenge Not yet complete... here's what's wrong:
The '# of Volunteers Still Needed' field on the 'Volunteer Shift' record is not working as expected.

I have attached a sreenshot of "# of Volunteers Still Needed" custom field.
User-added image
Thanks.
Regards Prince.
Hi All, I am having problem in resolving an error in the 'Customization Specialist superbadge' . The error message is 'The '# of Volunteers Still Needed' field on the 'Volunteer Shift' record is not working as expected'. I have tried all the options
i.e. IF( Desired_of_Volunteers__c - Shifts_Taken__c > 0, Desired_of_Volunteers__c - Shifts_Taken__c , 0) 

and Max(Desired_of_Volunteers__c - Shifts_Taken__c,0) also.
But no luck .So it's now no more fun!!  Kindly help me in solving this soon ...