• MedhanieHabte
  • NEWBIE
  • 209 Points
  • Member since 2015
  • Developer Account


  • Chatter
    Feed
  • 1
    Best Answers
  • 12
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 35
    Replies
Hi all, I am working on the Handle Server Error part in Trailhead as part of the Lightning Web Components and Salesforce Data Module

https://trailhead.salesforce.com/en/content/learn/modules/lightning-web-components-and-salesforce-data/handle-server-errors?trail_id=build-lightning-web-components

I am attempting to allow for error handling and write my code as follows

ContactList.js
import { LightningElement, wire } from 'lwc';
import {
    reduceErrors
} from 'c/ldsUtils';
import getContactList from '@salesforce/apex/ContactController.getContactList';

export default class ContactList extends LightningElement {
    @wire(getContactList) contacts;

    handleSelect(event) {
        // 1. Prevent default behavior of anchor tag click which is to navigate to the href url
        event.preventDefault();
        // 2. Create a custom event that bubbles. Read about event best practices at http://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.events_best_practices
        const selectEvent = new CustomEvent('contactselect', {
            detail: { contactId: event.currentTarget.dataset.contactId }
        });
        // 3. Fire the custom event
        this.dispatchEvent(selectEvent);
    }
    get errors() {
        return (this.accounts.error) ?
            reduceErrors(this.accounts.error) : [];
    }
}



contactList.html
<template>
    <template if:true={contacts.data}>
        <template if:true={errors}>
            <p>{errors}</p>
        </template>
        <template for:each={contacts.data} for:item="contact">
            <a
                href="#"
                key={contact.Id}
                data-contact-id={contact.Id}
                onclick={handleSelect}
            >
                <lightning-layout>
                    <lightning-layout-item>
                        <img src={contact.Picture__c} alt="Profile photo" />
                    </lightning-layout-item>
                    <lightning-layout-item padding="horizontal-small">
                        <p>{contact.Name}</p>
                    </lightning-layout-item>
                </lightning-layout>
            </a>
        </template>
    </template>
</template>

ContactController.cls
public with sharing class ContactController {
    @AuraEnabled(cacheable=true)
    public static List<Contact> getContactList() {
        throw new AuraHandledException('Forced error');
        /*return [
            SELECT Id, Name, Title, Phone, Email, Picture__c
            FROM Contact
            WHERE Picture__c != null
            WITH SECURITY_ENFORCED
            LIMIT 10
        ];*/
    }

    @AuraEnabled(cacheable=true)
    public static List<Contact> findContacts(String searchKey) {
        String key = '%' + searchKey + '%';
        return [
            SELECT Id, Name, Title, Phone, Email, Picture__c
            FROM Contact
            WHERE Name LIKE :key AND Picture__c != null
            WITH SECURITY_ENFORCED
            LIMIT 10
        ];
    }

    @AuraEnabled(cacheable=true)
    public static Contact getSingleContact() {
        return [
            SELECT Id, Name, Title, Phone, Email, Picture__c
            FROM Contact
            WITH SECURITY_ENFORCED
            LIMIT 1
        ];
    }
}




But I get this error We can’t find 'reduceErrors' imported into contactList.js. Any steps I need to take here.

 
Hi all, I am working on Step 3 of the Einstein Analytics and Discovery Insights Specialist Superbadge and seem to be getting this unusual trailhead error.

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: ALJNAPDO
Close errors


My Dashboard looks good but oddly It may be tied to something I might be missing with the Tenure Length, not sure.
Has anyone seen this error ? I am getting this when trying to add the report chart to the account page as part of the Challenge 7.

User-added image
I'm struggling with the custom lightning component on this part. I don't have much background coding and am having trouble finding resources to help me achieve coding the lightning component. If someone could help give me some framework code to create a custom lightning component to hold a URL or direct me to a resource that help break this down I'd be very appreciative.
 
I am facing another issue on this superbadge, specifically in Challenge #10, i am getting the following error:
The Campaign Influence Lightning report must have the correct 1. Aggregate, 2. Columns, 3. Groupings, and 4. Filter.

The requirements have no mention about what fields, groupings, filters, aggregates to include in the report. What am I missing?
Hello,
I'm fairly new to coding and I want to create a trigger where I share a document with a certain chatter group automatically and give them contributer rights when I upload a file via the chatter feed.This is how my trigger looks like:

trigger publishFileToGroup on ContentDocumentLink (after insert) {

  List<CollaborationGroup> chattergroup = [SELECT Id FROM CollaborationGroup WHERE Name = 'Apex Trigger Group'];  
  List<ContentDocument> documents = [SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument];

  ContentDocumentLink cdl = New ContentDocumentLink(
 
  LinkedEntityId = chattergroup[0].Id, ContentDocumentId = documents[0].Id, shareType = 'C');
 
  insert cdl;

}

This doesn't work and the following error message appears:
"Apex trigger publishFileToGroup caused an unexpected exception, contact your administrator: publishFileToGroup: execution of AfterInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, publishFileToGroup: execution of AfterInsert

caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Document with ID: 06958000000Aejh is already linked with the entity with ID: 0F9580000005tul: Linked Entity ID: [LinkedEntityId]

From my understanding it says that the document is already linked with the chatter group, which is not true. Any ideas?


 
I know that when an email bounces from a contact, a bounce reason and bounce date are populated, which prompt the 'Confirm Email Address' message to appear 

User-added image

Does anyone know of a way to modify this flag message? For example if i wanted to say 'Invalid Email Address' rather than 'Confirm Email Address'

Best,
Grant Ongstad

Hi all, I am so close to finishing this process automation badge but am stuck in one area in Step 7.

I've built out my process builder as follows

User-added image
User-added image
User-added image

And my date formula as follows
 

Case(MOD(Date__c-DATE(1900,1,7),7),0,"Sunday",1,"Monday",2,"Tuesday",3,"Wednesday",4,"Thursday",5, "Friday",6,"Saturday", "")
 



Challenge Not yet complete... here's what's wrong:  The Robot Setup Day of the Week formula does not seem to be working properly. The Day of the Week should not fall on Saturday or Sunday. 

It works nicely but doesn't seem to pass, what could be up.
 

There was an unhandled exception. Please reference ID: KLNTXAZY. Error: Faraday::ClientError. Message: MALFORMED_QUERY: When retrieving results with Metadata or FullName fields, the query qualificatio​ns must specify no more than one row for retrieval. Result size: 2

I have a flow that allows you to choose the product type, then the product, which creates the product, then asks if you want to add more products and goes back to the start. Seems to work perfectly. Not sure what this error is.

The call for service field description in the requirement is way different than what trailhead is actually validating.

User-added image
Hi,

I am stuck at the Create and Train the Dataset step on the Build a Cat Rescue App That Recognizes Cat Breeds Trailhead module.

I have successfully created the lightning component, uploaded the zip file and clicked on the train button but when I try to Verifiy I get the following error message:
"Challenge Not yet complete... here's what's wrong: 
Could not find a successful cat dataset training. The training may take a couple of minutes after the model is created."

Could you please advise ?

Thanks for your help.
Greetings, I am working on the Salesforce Build a 3D Virtual Reality App project in trailhead and have downloaded Unity and Google's VR tools, but when I attempt to install the VR toolkit, I encounter this error?

Assets/Salesforce/Components/Scripts/Trigger.cs(24,51): error CS0246: The type or namespace name `GazeInputModule' could not be found. Are you missing an assembly reference?

Anything that I am missing.
A Create a Record action for the Closed Won criteria node isn’t properly configured. Make sure that it creates a task and uses the same field settings as the ‘Follow up on new contract’ task action. Make sure that Due Date Only is set by using a formula.
User-added image

Hep me for this Problem!
I've been working on this trail for a bit - and while I undertsand the concepts, I'm stumped on why I'm getting this error: 
 
Challenge Not yet complete... here's what's wrong: 
A Create a Record action for the Closed Won criteria node isn't properly configured. Make sure that it creates a draft contract according to the instructions in the ‘Create contract for closed opportunity’ task action. Make sure that Start Date is set by using a formula.

I've gone over all of the workflow tasks information to recreate the contact. If I activate the process and close an opportunity, it creates a contract with the expected information and the date is 1mo away with 12mo term. The workflow's task (which is the template for the actual contract) specifies the following: 
 
Use the closed opportunity to create a contract for the associated account. 

Account: The account associated with this opportunity
Status: Draft
Contract Start Date: 1 month from today
Contract Term: 12
Here are my actions: 
User-added image

The Contract Start Date is set to the following formula:
DATE(
    YEAR(Today()) +
    FLOOR((1 + MONTH(Today())) / 12) -
    IF (MOD(MONTH(Today()) + 1, 12) = 0,
        1,
        0),

    MOD((1 + MONTH(Today()) - 1), 12) + 1,

    DAY(Today())
)

Again, for all practical purposes I'm passing this, as it functions and the contract is created. But I must be missing some small detail, named field, something that's tripping up the validation settings. Any help is appreciated!