• Dan Gillham
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 11
    Replies
I completed this challenge, and everything works correctly, but when I check the challenge, I get the following error...

User-added image

As a check, I went to the next chapter, about sharing reports and dashboards, and that worked correctly.  Any ideas on what may be wrong?
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);
    carry.add(t); 
    }
   }
     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.
I receive this error when I check my challenge.

User-added image
Challenge not yet complete... here's what's wrong: 
An account with a related opportunity did not calculate the correct potential value.

The task was to Create a rollup summary field that determines the potential value of the opportunities associated with an account.
Add a custom field to the standard account object that provides a rollup summary of the total expected revenue from all related opportunities.The rollup summary field should be labeled 'Potential Value' and have the Field Name of 'Potential_Value'. The resulting API name should be 'Potential_Value__c'.
The rollup summary should calculate the total expected revenue of all the opportunities related to the account.

Here is a snap shot of my work. Any suggestions as to why this is failing?

User-added image

Thanks,
Darren

the above error i am getting wen i am executing thi program..... plz help me

 

 

 

 

public with sharing class ChatterUnitTests {

/*
* Test the ChatterActivity trigger which inserts chatter feed posts whenever a task is inserted on the parent object
*/
public static testMethod void testChatterActivity() {
//create the test account

Account a = new Account(name='Test Account');
insert a;

//create a task on that account
Task t = new Task(whatId=a.id);
t.Subject = 'This is a test activity for chatter';
t.ActivityDate = System.today();
t.Status = 'In Progress';
t.Description = 'Hello, this will be chattered';

insert t;

//Make sure Account has the feed enabled. If it does, make sure the chatter feed post is there
Schema.DescribeSObjectResult r = Account.SObjectType.getDescribe();
if (r.isFeedEnabled()) {
List<AccountFeed> posts = [SELECT Id, Type FROM AccountFeed WHERE ParentId = :a.id];
System.assertEquals(1, posts.size());
}
}
}