• Celio Xavier
  • 15 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 9
It is a simple page here is the code 
<apex:page standardController="Opportunity">
            <apex:outputField value="{! Opportunity.Name}"/>
            <apex:outputField value="{! Opportunity.Amount}"/>
            <apex:outputField value="{! Opportunity.CloseDate}" />
            <apex:outputField value="{! Opportunity.AccountName}" />
What's wrong

While I am trying to complete Trailhead module for platform events, this is the error message which I am getting.
User-added image

This is the code which I have written as of now,
User-added image
Kindly advise if any changes are required.

Create a Visualforce page without the standard Salesforce header and display an image using the Visualforce image component.
The page must be named 'DisplayImage'.
It must NOT display the standard Salesforce header.
It must use a Visualforce apex:image component to display this image - https://developer.salesforce.com/files/salesforce-developer-network-logo.png

<apex:page showHeader="false" title='DisplayImage'> 
    <apex:pageBlock >
        <apex:image url="https://developer.salesforce.com/files/salesforce-developer-network-logo.png"/>

Challenge Not yet complete... here's what's wrong: 
The 'DisplayImage' page was not found.
I keep failing the challenge
"Challenge Not yet complete... here's what's wrong: An inactive user with 'guestadmin' in the username was not found. Make sure that the user is inactive and that the Username includes the 'guestadmin' string"

Here are my users
User-added image

And here is my guestadmin test user and no I don't have any mention of guest user in Test Nicky
User-added image

What am I doing wrong?
Hi All,
I'm new to salesforce and started working on Trailhead's. I facing issue with the Trigger Challenge. Here is the triger code im writing 

trigger AccountAddressTrigger on Account (before insert) {
    for(Account a : Trigger.new){
        if(a.Match_Billing_Address__c && a.BillingPostalCode != null){
            a.ShippingPostalCode = a.BillingPostalCode;

but i'm getting the following error. Not sure where i'm doing wrong. can someone please help me here. Thanks in advance.

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TestTrigger: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.TestTrigger: line 3, column 1: []
I Keep failing this challenge for the below reason:
The user's profile was not set to System Administrator

Here is my screen shot of my users profile Please what am I doing to fail this?
User-added image
trigger ClosedOpportunityTrigger on Opportunity (after insert,after update) {
List<task> carry=New List<task>();

  for(opportunity opp:trigger.new){
   if(opp.stagename=='closed own'){
    task t=new task(whatid=opp.id);
     insert carry;


 The trigger will add a task to any opportunity inserted or updated with the stage of 'Closed Won'. The task's subject must be 'Follow Up Test Task'.The Apex trigger must be called 'ClosedOpportunityTrigger'
With 'ClosedOpportunityTrigger' active, if an opportunity is inserted or updated with a stage of 'Closed Won', it will have a task created with the subject 'Follow Up Test Task'.
To associate the task with the opportunity, fill the 'WhatId' field with the opportunity ID.
This challenge specifically tests 200 records in one operation.

I tried with the above code, task is not created.
public class VerifyDate {
//method to handle potential checks against two dates
public static Date CheckDates(Date date1, Date date2) {
//if date2 is within the next 30 days of date1, use date2. Otherwise use the end of the month
if(DateWithin30Days(date1,date2)) {
return date2;
} else {
return SetEndOfMonthDate(date1);
//method to check if date2 is within the next 30 days of date1
private static Boolean DateWithin30Days(Date date1, Date date2) {
//check for date2 being in the past
if( date2 < date1) { return false; }
//check that date2 is within (>=) 30 days of date1
Date date30Days = date1.addDays(30); //create a date 30 days away from date1
if( date2 >= date30Days ) { return false; }
else { return true; }
//method to return the end of the month of a given date
private static Date SetEndOfMonthDate(Date date1) {
Integer totalDays = Date.daysInMonth(date1.year(), date1.month());
Date lastDay = Date.newInstance(date1.year(), date1.month(), totalDays);
return lastDay;

I need test class for this class.Please provide me
My Trigger is as following:-

trigger RestrictContactByName on Contact (before insert, before update)
{ //check contacts prior to insert or update for invalid data
For (Contact c : Trigger.New)
if(c.LastName == 'INVALIDNAME')
{ //invalidname is invalid
c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');

And my Test class as follows:-
private class TestRestrictContactByName
    @isTest static void TestContact()

        Contact con=new Contact(FirstName='Arjun', LastName='Mahi');
             con.AddError('The Last Name "'+con.LastName+'" is not allowed for DML');
        }else{insert con;}  
        Contact conn=new Contact(FirstName='Arjun', LastName='Kapur');
             conn.AddError('The Last Name "'+conn.LastName+'" is not allowed for DML');
        }else {update conn;}  
        Contact com=new Contact(FirstName='Rama', LastName='INVALIDNAME');
             com.AddError('The Last Name "'+com.LastName+'" is not allowed for DML');
        }else {insert conn;}

plz help me complete this Challenge :)
Thanx in Advance :)