• Anonymous Developer
  • NEWBIE
  • 55 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 30
    Replies
Good Day Everyone I have a question about email templates although the receipt generates when I test it on opportunities it does not send an email what do I do?


The access level of the deliverability of the email is already set to all emails.

The process automation settings already enabled the record locking and unlocking in apex.

What did I miss? Need Help.

Thanks
Here's my code

Apex Class:
global class ASOverrideContacRegion implements Database.Batchable<sObject>{
    List<Contact> conlist = new List<Contact>();
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT MailingPostalcode,MailingCity,Region_Override__c,Region__c FROM Contact WHERE MailingPostalcode != null AND Region_Override__c = FALSE';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Contact> batch) {
        System.debug('batch=='+batch);
            
        Set<String> postcodes = new Set<String>();
        for (Contact a : batch) {
            postcodes.add(a.MailingPostalcode);
        } 
            
        Map<String,Id> mapregcode = new Map<String,Id>();
        for(Region__c reg: [SELECT Id,Postcode__c,Suburb_Name__c FROM Region__c WHERE Postcode__c IN :postcodes]) {
            mapregcode.put(reg.Postcode__c,reg.Id);
        }

        for(Contact con : batch) {
            if(mapregcode.containskey(con.MailingPostalcode)) {        
                Contact conTemp = new Contact();
                conTemp.Id = con.Id;
                conTemp.Region__c = mapregcode.get(con.MailingPostalcode);
                conlist.add(conTemp);
            }
        }

        System.debug('postcodes >>>> ' +postcodes);
        System.debug( 'mapregcode >>>>>' +mapregcode );
        update conlist;
        
        system.debug('conlist=='+conlist);
    }

    global void finish(Database.BatchableContext BC) {
    
    }
                                               
}


Test Class:

@isTest
public class ASOverrideContacRegionTest {
    
     
    static testMethod void setup(){
    List<Contact> tempConList = new List<Contact>();
        Contact con = new Contact();
      con.FirstName = 'Erin';
      con.LastName = 'Daly';
            con.MailingCity = 'Brisbane';
            con.MailingPostalCode = '4000'; 
            con.Region_Override__c = TRUE; 
      tempConList.add(con);
        insert tempConList;
    update tempConList;

    Contact con1 = new Contact();
      con1.FirstName = 'Erin';
      con1.LastName = 'Daly';
      con1.MailingPostalCode = '4008';
    insert con1;


        Region__c reg = new Region__c();
      // con.FirstName = 'Erin';
      // con.LastName = 'Daly'; 
            reg.Suburb_Name__c = 'Brisbane'; 
            reg.Postcode__c = '4000';
        insert reg;

        
      Test.startTest();
      ASOverrideContacRegion OCR = new ASOverrideContacRegion();
      Id jobId = Database.executeBatch(OCR);
      Test.stopTest();

    }

}

User-added image

I have a lookup field to Region on Contact I want the batch to run every midnight. the batch updates the region if the field postcode on contact is changed and the region override is false.


Contact Fields:
Region Override - checkbox
Region(Lookup) 

Custom Object:

Region

Region Fields:

Postcode - text


any idea on how to make it? The output for example is like when a contact is created and the postcode has been filled, the batch will update the region with the postcode overnight.

I have a lookup field to Region on Contact I want the batch to run every midnight. the batch updates the region if the field postcode on contact is changed and the region override is false.

Contact Fields:

Region Override = checkbox

Region(Lookup)

any idea on how to make it? The output for example is like when a contact is created and the postcode has been filled, the batch will update the region overnight.

Create a report of Recurring Donations created in the last 7 days, where neither Received Welcome SMS or Received Welcome Email is ticked. Group by Agency

Report shows Contact name, Recurring Donations name, Recurring Donations Created date, Agency, Received Welcome SMS, Received Welcome Email

If either Received Welcome SMS, Received Welcome Email is ticked, the line will be removed from the report.
Create a report of Recurring Donations created in the last 7 days, where neither Received Welcome SMS or Received Welcome Email is ticked. Group by Agency
 
The report shows Contact name, RD name, RG Created date, Agency, Received Welcome SMS, Received Welcome Email
If either Received Welcome SMS, Received Welcome Email is ticked, the line will be removed from the report
Good Day everyone 

how do I target this in the community? As I am using font awesome icon as a button. I want the button to go back to the previous page that i visited.


<div><a href="javascript:history.go(-1)"onMouseOver="
self.status.referrer; return true">Back Page</a><div>

Need help. Thanks in advance
 
Build tests for all cases (positive, negative, and bulk) specified in the business requirements by using a class named MaintenanceRequestHelperTest. You must have 100% test coverage to pass this section and assert values to prove that your logic is working as expected. Choose Run All Tests in the Developer Console at least once before attempting to submit this section. Be patient as it may take 10-20 seconds to process the challenge check.


Here's my code:

User-added image

User-added image

User-added image

User-added image

User-added image
 

 Equipment__c =cc.Equipment__c,

                    Origin = 'Web',

                    Date_Reported__c = Date.Today()

                    

                );

                

                If (maintenanceCycles.containskey(cc.Id)){

                    nc.Date_Due__c = Date.today().addDays((Integer) maintenanceCycles.get(cc.Id));

                }

                

                newCases.add(nc);

            }

            

           insert newCases;

            

           List<Equipment_Maintenance_Item__c> clonedWPs = new List<Equipment_Maintenance_Item__c>();

           for (Case nc : newCases){

                for (Equipment_Maintenance_Item__c wp : closedCasesM.get(nc.ParentId).Equipment_Maintenance_Items__r){

                    Equipment_Maintenance_Item__c wpClone = wp.clone();

                    wpClone.Maintenance_Request__c = nc.Id;

                    ClonedWPs.add(wpClone);

                    

                }

            }

            insert ClonedWPs;

        }

    }

}

MaintenanceRequest.apxt :-

trigger MaintenanceRequest on Case (before update, after update) { if(Trigger.isUpdate && Trigger.isAfter){ MaintenanceRequestHelper.updateWorkOrders(Trigger.New, Trigger.OldMap); } }


ERROR: Challenge Not yet complete... here's what's wrong:
We could not find the class 'MaintenanceRequestHelperTest' using assertions in the unit tests.
Does anyone know about this error?

User-added image


Need Help I've been stuck on this problem for almost 3 hours. Thanks in advance
Does anyone know how to solve the second challenge? 
  • Relationships
  • Shift Tracking Fields
  • Hours Tracking Fields
  • Other Fields


Create app fields

Add the fields described to establish object relationships, track shifts, calculate hours, and more.

User-added image

 
public with sharing class AS_customTopbarNotification{
    
    @AuraEnabled
    public static Boolean getMessages(String communityId) {
        
        ConnectApi.FeedElementPage unread = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(communityId, ConnectApi.FeedType.DirectMessages);
        Boolean hasUnread = false;
        
        for (ConnectApi.FeedElement feedEl : unread.elements) {
            if (!feedEl.capabilities.readBy.isReadByMe) {
                hasUnread = true;
                break;
            }
        }
        System.debug('hasUnread ' + hasUnread);
        return hasUnread;
    }
}


Can anyone make a test class out of this code?

Thanks in advance.
Is it possible to delete a direct message inside the community or not? If so can you explain in detail how to do it?


Many thanks in advance.
Good Day to All,

I have a question regarding a custom component on Experience Builder. I created a custom notification in the community and even though the condition of the notification badge is correct the badge does not disappear when I read my message/s. Here are my codes.

HTML:

<template>
    <div class={messageBadge}>
        <i class="inbox__icon fal fa-inbox" style = "font-size: 2em;" onclick={navigateToMessage}></i>
    </div>
</template>

CSS:

.inbox {
    cursor: pointer;
    display: block;
    position: relative;
    width: 25px;
}
.inbox__icon{
    align-items: center;
    color: var(--lwc-colorTextDefault);
    cursor: pointer;
    font-size: 50px;
    justify-content: center;
}
.inbox-unread::before{
    background-color: var(--lwc-colorBorder);
    border-radius: 50%;
    content: '';
    display: block;
    height: 10px;
    left: 20px;
    position: absolute;
    top: 0;
    width: 10px;
}

JS:

import { LightningElement, track , api} from 'lwc';
import {NavigationMixin} from "lightning/navigation";
import communityId from '@salesforce/community/Id';
import getMessages from '@salesforce/apex/AS_customTopbarNotification.getMessages';
export default class AS_InboxMessage extends NavigationMixin(LightningElement)
{
    @api getMessages;
    communityId = communityId;
        navigateToMessage(event){
       
            console.log('clicked');
            const url = '/messages/Home';
            console.log(url);
       
            this[NavigationMixin.Navigate]({
                type: 'standard__webPage',
                attributes: {
                    url : url
                }
            });
            }
        connectedCallback() {
            getMessages({
                communityId : this.communityId
            }).then((result) => {
                    console.log(result);
                    this.getMessages = result;
            }).catch((error) =>{
                    console.log(error);
            });
        }
    get messageBadge() {
        if(this.getMessages != null){
            return this.getMessages ? 'inbox-unread' : 'inbox';
        }else{
            return 'inbox';
        }
    }
}

JS-META.XML:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>52.0</apiVersion>
    <isExposed>true</isExposed>
    <masterLabel>AS Message Inbox</masterLabel>
    <targets>
        <target>lightningCommunity__Default</target>
        <target>lightningCommunity__Page</target>
    </targets>
</LightningComponentBundle>

APEX CLASS:

public with sharing class AS_customTopbarNotification{
    
    @AuraEnabled
    public static Boolean getMessages(String communityId) {
        
        ConnectApi.FeedElementPage unread = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(communityId, ConnectApi.FeedType.DirectMessages);
        Boolean hasUnread = false;
        
        for (ConnectApi.FeedElement feedEl : unread.elements) {
            if (!feedEl.capabilities.readBy.isReadByMe) {
                hasUnread = true;
                break;
            }
        }
        System.debug('hasUnread ' + hasUnread);
        return hasUnread;
    }
}



This is LWC if anyone is wondering.

Thanks in advance.​​​​​​
Good Day to all,

Is it possible for a custom component notification created in the community to receive the same notifications as the custom notification inside your org, if so please explain to me how it works?

 
Can anyone make a test class example using these custom fields:
 
  • Option Name
  • Option Value
  • Option Type
  • Community ID

any example will do.


Thanks in advance.
Good Day Everyone I have a question about email templates although the receipt generates when I test it on opportunities it does not send an email what do I do?


The access level of the deliverability of the email is already set to all emails.

The process automation settings already enabled the record locking and unlocking in apex.

What did I miss? Need Help.

Thanks
Here's my code

Apex Class:
global class ASOverrideContacRegion implements Database.Batchable<sObject>{
    List<Contact> conlist = new List<Contact>();
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT MailingPostalcode,MailingCity,Region_Override__c,Region__c FROM Contact WHERE MailingPostalcode != null AND Region_Override__c = FALSE';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Contact> batch) {
        System.debug('batch=='+batch);
            
        Set<String> postcodes = new Set<String>();
        for (Contact a : batch) {
            postcodes.add(a.MailingPostalcode);
        } 
            
        Map<String,Id> mapregcode = new Map<String,Id>();
        for(Region__c reg: [SELECT Id,Postcode__c,Suburb_Name__c FROM Region__c WHERE Postcode__c IN :postcodes]) {
            mapregcode.put(reg.Postcode__c,reg.Id);
        }

        for(Contact con : batch) {
            if(mapregcode.containskey(con.MailingPostalcode)) {        
                Contact conTemp = new Contact();
                conTemp.Id = con.Id;
                conTemp.Region__c = mapregcode.get(con.MailingPostalcode);
                conlist.add(conTemp);
            }
        }

        System.debug('postcodes >>>> ' +postcodes);
        System.debug( 'mapregcode >>>>>' +mapregcode );
        update conlist;
        
        system.debug('conlist=='+conlist);
    }

    global void finish(Database.BatchableContext BC) {
    
    }
                                               
}


Test Class:

@isTest
public class ASOverrideContacRegionTest {
    
     
    static testMethod void setup(){
    List<Contact> tempConList = new List<Contact>();
        Contact con = new Contact();
      con.FirstName = 'Erin';
      con.LastName = 'Daly';
            con.MailingCity = 'Brisbane';
            con.MailingPostalCode = '4000'; 
            con.Region_Override__c = TRUE; 
      tempConList.add(con);
        insert tempConList;
    update tempConList;

    Contact con1 = new Contact();
      con1.FirstName = 'Erin';
      con1.LastName = 'Daly';
      con1.MailingPostalCode = '4008';
    insert con1;


        Region__c reg = new Region__c();
      // con.FirstName = 'Erin';
      // con.LastName = 'Daly'; 
            reg.Suburb_Name__c = 'Brisbane'; 
            reg.Postcode__c = '4000';
        insert reg;

        
      Test.startTest();
      ASOverrideContacRegion OCR = new ASOverrideContacRegion();
      Id jobId = Database.executeBatch(OCR);
      Test.stopTest();

    }

}

User-added image

I have a lookup field to Region on Contact I want the batch to run every midnight. the batch updates the region if the field postcode on contact is changed and the region override is false.

Contact Fields:

Region Override = checkbox

Region(Lookup)

any idea on how to make it? The output for example is like when a contact is created and the postcode has been filled, the batch will update the region overnight.

Create a report of Recurring Donations created in the last 7 days, where neither Received Welcome SMS or Received Welcome Email is ticked. Group by Agency

Report shows Contact name, Recurring Donations name, Recurring Donations Created date, Agency, Received Welcome SMS, Received Welcome Email

If either Received Welcome SMS, Received Welcome Email is ticked, the line will be removed from the report.
The below mentioned is not properly working, only first time it is working, If I am checking and unchecking and clicking on the button it is in false stage only.

<template>
    <lightning-input type="checkbox" checked={Item}></lightning-input>
    <lightning-button label="reset" onclick={resetcheckboxhandler}></lightning-button>
</template>

==================================================
import { LightningElement,track } from 'lwc';
export default class Checkboxcheck extends LightningElement {
     @track Item = false;
    resetcheckboxhandler(event){
        this.Item = true;
       
    }
}
Good Day everyone 

how do I target this in the community? As I am using font awesome icon as a button. I want the button to go back to the previous page that i visited.


<div><a href="javascript:history.go(-1)"onMouseOver="
self.status.referrer; return true">Back Page</a><div>

Need help. Thanks in advance
 
I need to generate pdf from a button in my aura component and also want the data in table format in pdf. plz help me. I have searchd alot on google & got one solution but facing error in that solution also. please help me..
I got an "unexpected error" on a superbadge, and it said to post here with the error ID, which was KSDJVGLC. I'm not sure what info I'm allowed to share/receive, but I'm using a new DE. Can I get some help with this?
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: KSDJVGLC
Thanks for any help you're allowed to provide!
Does anyone know about this error?

User-added image


Need Help I've been stuck on this problem for almost 3 hours. Thanks in advance
Hi,

Im stucked on this report for 10 days i tried every setting but couldnt make it work, i dont know what i'm doing wrong ??
User-added imageUser-added imageUser-added image

I use the correct fields, i summarize shift hours by sum
I use correct filters
I use the correct report type!

thanks