• Prateek Singh Sengar
  • SMARTIE
  • 1728 Points
  • Member since 2016
  • Sr Technical Architect
  • Cognizant


  • Chatter
    Feed
  • 57
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 278
    Replies
Hi,
 
I have custom field 'Request Date' and custom button called 'Send Request' that redirects to send an email template. I need to stamp today's date into the custom field when the button is clicked and the email has been sent. 
 
Is there any way of doing this? How?
 
Thanks,
Arman
  • November 21, 2016
  • Like
  • 0
Please help me with code for adding two numbers on visualforce page using javascript on the page
So I have custom object (invoice__c) with master-detail to opportunity. I have a custom field (AF_LastSyncTime__c ) on invoice__c that Im trying to access.
so here is my query:
for (Opportunity opp : [select Id, (select id, AF_LastSyncTime__c from Invoices__r),
                       (select Id, Invoice_No__c, QuotetoInvoice__c, CreatedDate
                         from Quotes 
                         order by CreatedDate DESC)
                  from Opportunity
                  where Id IN :oppsId]) 
{

 if (opp.Invoices__r.AF_LastSyncTime__c==null) return 'blah blah blah'; 

 }

No error with query, but I get invalid foreign key relationship in the if statement....why is that?

Thanks.
  • November 01, 2016
  • Like
  • 0
Is anyone able to download the Winter 17 Release Overview Deck at this URL: https://success.salesforce.com/0693A000004mwCf?

I tried with a production login and a developer login and neither had access.
Hi everyone, 

I'm trying to create a custom field that populates with the name of whomever had the last activity on the lead. I'm currently trying to do this using a trigger.

This is the Apex Trigger that I have written:

trigger lastactassigned on task(after insert) {
  map<id,lead> leads = new map<id,lead>();
  for(task record:trigger.new) {
    if(record.ownerid.getsobjecttype()==user.sobjecttype) {
      if(record.whoid!=null&&record.whoid.getsobjecttype()==lead.sobjecttype) {
        leads.put(record.whoid,new lead(id=record.whoid,Last_Act_Assigned_To_Test__c=record.ownerid));
      }
    }
  }
  update leads.values();
}


AND this is the Apex Class that I have written to test the trigger:

@isTest 
public class lastactassignedTest1 
{
    static testMethod void testMethod1() 
    {
        User user = new User();
        
        Lead lead = new Lead();
        lead.LastName ='Test';
        lead.FirstName ='New';
        // Add all required field
        insert lead;
        
        Task task = new Task();
        task.WhoId = user.Id;
        task.Subject = 'Other';
        task.Status = 'Not Started';
        task.Description = 'New  Work';
        insert task;
    }
}

So as of right now, both of them save without any problems; however, when I hit 'run test' on the Apex Class, it fails. 

I'm thinking that there may be something wrong with the trigger, but I am not completely sure. I would love some input!

Thank you,
Evelyn 
I'm just trying to write a simple if statement to check the piclist value for TeammemberRole on Account Team object. I've tried it with double equalls signs "==" and using string method .equals().  No matter what I try I continue to get the error. "Condition expression must be of type boolean.  It should be a simple thing but it's stopping me cold. 
Here's how it looks currently:
 
for(AccountTeamMember member:  ATM ){
            if (member.TeamMemberRole == 'CRD - Back-up' ){
               BackupCRDMap.put(member.Account.id, member.user.name);
               }

 



 
Hi, 

I need a custom discount percentage field that would be dependent on a custom picklist field. This picklist field is named "value full" with two options: 'yes' and 'no'. I want the discount field to be auto update to 100% if and when value full is yes otherwise don't update anything leave it blank for the user to fill in. 

How can I do this? 

Thanks, 
Arman
  • October 25, 2016
  • Like
  • 0
Would appreciate any help with creating a custom field for a start time for a meeting?  Field would be start time and they should be able to enter 7pm or 10am etc.  Wondering if there's a way to create some sort of 'time field' or whether a text field is the best option?
Hello,
I'm trying to query attachments and add an attachment to a custom business segment object. I'm getting a null pointer exception when trying to retrieve te value from an attachment map. Any ideas on how to optimize/fix? In the debugger the map is populated with values, but I'm still getting an exception.

The error hits at this line:
if(bizAttachMap.size() > 0 && bizAttachMap.containsKey(ptrBizMap.get(psd.Partner_Account__c).Id))


Thanks.
Map<Id, Attachment> bizAttachMap = new Map<Id, Attachment>();
         for(Attachment attach: bizAttach){
             bizAttachMap.put(attach.ParentId, attach);
         }
         system.debug(bizAttachMap.values());
		List<Business_Segment__c> bizSegInsert = new List<Business_Segment__c>();
		List<Attachment> attachmentToInsert = new List<Attachment>();
        for(Partner_Locator_Detail__c psd : newMap.values()){
            if(acctPldMap.containsKey(psd.Partner_Account__c) && psd.Publication_Status__c=='Draft' && psd.isClone()){
                if(ptrBizMap.size() >0 && ptrBizMap.containsKey(acctPldMap.get(psd.Partner_Account__c).id)){
                    Business_Segment__c bizs = ptrBizMap.get(acctPldMap.get(psd.Partner_Account__c).id);
                    Business_Segment__c bizClone = bizs.clone(false,true);
                   
                    bizClone.Partner_Locator_Detail__c = psd.id;
                    BizSegInsert.add(bizClone);
                     if(bizAttachMap.size() > 0 && bizAttachMap.containsKey(ptrBizMap.get(psd.Partner_Account__c).Id)){
                    	Attachment biza = bizAttachMap.get(ptrBizMap.get(psd.Partner_Account__c).Id);
                        Attachment bizaClone = biza.clone(false,true);
                        bizaClone.ParentId = psd.id;
                        attachmentToInsert.add(bizaClone);
                	}
                    
                }
                
            }
            
        }
         if(BizSegInsert !=null && BizSegInsert.size()>0){
             insert BizSegInsert;
         }
         if(attachmentToInsert !=null && attachmentToInsert.size() > 0){
             insert attachmentToInsert;
         }


 
Hi , 
 I already have the custom setting in my sandbox org and my test class with seealldata=true. So why am I getting this:
EXCEPTION_THROWN|[33]|System.NullPointerException: Attempt to de-reference a null object
When I test the same EXACT  test class in my developer org, I get 86% coverage. It drops to 21% in sandbox org....whats going on?
 
  • October 06, 2016
  • Like
  • 0
Hi all,

This may sound like a dumb question, but I am currently unable to change the field level securities for the Private standard field under Events. I have users in specific regions and one needs to be able to see this field while the other does not want it. When attempting to edit the FLS clicking the check boxes is not an option. Any advice? 
I am on the sytem admin profile and would think I should beable to edit this.

User-added image

Hello everyone,

I am trying to make a simple web shop. I have a custom object Basket (the shopping cart) that holds BasketLineItems (the chosen goods, custom objects as well) and has a field with a lookup for Contact objects (representing the customer). The Basket doesn't need to have the contact field filled in at the point of its creation, but if it doesn't get filled within 24 hours, the Basket record in question should be deleted.

I've searched around and so far, the best way seems to make a Scheduled Apex class and have it run frequently, every hour or so, checking creation times and deleting accordingly, but that means it's possible for a record to exist for more than 24 hours, plus it's a pain and a strain to schedule the job more frequently. Can't I make something that's basically a timebomb and stick it to the record?

Hi,

I am creating a trigger where  it will only fire if the user matches these criteria:(fields from user object)

1. Global_ID__c like 'esi1%'
2. Profile.Name != 'System_Admin'

Here is my trigger. 

trigger Time_Off_Terrirtory_more_than_90_days_old on Time_Off_Territory_vod__c (before delete,before insert,before update){
    
    if(Trigger.isDelete)
        {
        for(Time_Off_Territory_vod__c tot: trigger.old)
            if((tot.Date_vod__c < (system.today()- 90 )) && tot.Admin__c != True )
                {
                tot.adderror('You cannot delete or cancel Paid Time Off record that is 90 or more days old.' );
                }   
            else if((Date.today() > Date.NewInstance(Date.today().year(), 1, 10)) && (tot.Date_vod__c < Date.NewInstance(Date.today().year(), 1, 1)) && tot.Admin__c != True)
                {
                tot.adderror('You cannot delete or cancel Time Off Entry Record of Last Fiscal Year' );
                }  
        }
    
    if (Trigger.isInsert)
        {
        for(Time_Off_Territory_vod__c tot: trigger.new)
            if(
                (tot.Date_vod__c < Date.NewInstance(Date.today().year(), 1, 1)) 
                && 
                ( system.today() > Date.NewInstance(Date.today().year(), 1, 10)) 
                && 
                (tot.Admin__c != True)
               )
            {
            tot.adderror('Error4');    
            }
        }
    }
 
 
Hi,

In Standart Object "Users" we have one field "Employee Number" an we only view this field on edit mode of one user.

My questions are;
How can we put this field in the layout of users (view mode)?
Can we grant this field access (read and write permission) to a specific Profile?

Thanks in advance
I am writing a trigger that will Query Child records of a custom object and return 1 value. As there should only be 1 child record we need to pull back the email address of the assigned Drafter. Once we have the Drafters email we will use that in process builder to send out emails when a change is made if it affects the Department. I think there is something wrong with my SOQL as I am getting an error around the expected ; and got o.id. I am not sure what I did wrong. a fresh set of Eyes would help. Thanks 

Trigger (Not Complete)
trigger updateDrafterEmail on Order__c (before insert) {
    String drafterEmail;
    for (Order__c o : Trigger.new){
        //Get all the Drafting records in a list where drafting is on the order
        List<Drafting> myDrafting = new List<Drafting> {
            myDrafting = [SELECT Id, 
                                 SAP_Order__c,
                                 Drafting_Kingspan__c,
                                 Drafting_Email__c, 
                            WHERE Id
                            In 
                            (SELECT Drafter__c, 
                                     Drafter_Email__c 
                             FROM    Drafting__r 
                             WHERE   Drafter__c != null ) 
                             Limit 1;
        }
        //check if list is empty if not we will update the order with the Drafters email
        if(myDrafting > 0 && o.Drafter_Email__c != null){


        }
    }
}
 
Hi,

I have time dependent workflow on the opportunity which should send an email 30 days before the opportunity close date. But the email alert is being sent when ever an opportunity is created with a close date of next week. Let me  know what the issue could be. Below are screenshots of the time dependent workflow:-

I am using the below trigger condition, 

30 Days before opportunity close date.

Let me know what the issue could be.
Error: Compile Error: Illegal variable declaration: oli.Annual_Revenue_Upside__c at line 109 column 70

Here is the line of code: (it is the first line of code)  Annual_Revenue Upside is a Number .  I am not sure what the Illegal Variable Declaration is. do I need to start over and make the field a Currency?

    private Decimal add(Decimal rollup, Decimal UnitPrice, Decimal oli.Annual_Revenue_Upside__c)
    {
        UnitPrice = (oli.Annual_Revenue_Upside__c != null) ? oli.Annual_Revenue_Upside__c : UnitPrice;
        return rollup + ((UnitPrice == null) ? 0 : UnitPrice);
    }
 
Hello,

I've written an Apex test which tests to see if a trigger is modifying a related object or not. The goal of the trigger is to update the related record so the LastModifiedDate is updated from the previous value.

The issue I'm having is due to LastModifiedDate not having millisecond precision the old and new lastmodifieddate are the exact same values after the trigger runs. Essentially the insert/update/delete is happening too quickly for any delta to be registered.

In reality there will be hours/days in-between record updates but during the Apex test run the test is completing in less than a second.

Is there a way to somehow delay in call the test method in the future (even a second or two) so I can see a time difference during the test run?

Thanks,

MIke
Hi
I am trying to write a test class for a trigger. The trigger is on attachement object , basically the trigger has a buch of .addError statements based on some fields of parent object of attachement which is to prevent user from updating, deleting or inserting attachements to that object based on a piclist field of that object. But i am strugling here with the test class, Only 65% coverage so far.
    How should I create test data for attachment for testing purpose and I need to test for all the differnt scenarios, insert, update and delete.
Please help mw eith some examples, I can post my trigger if required.
Thank you
Hi All,
I have a requirement where, we need to send an Email on the status of failed Bulk Data Load jobs. But I am not sure the Object Name or how to refer those jobs programatically in my APex code. When I use 'AsyncApexJob', it's referring to Scheduled Apex Jobs. But I want the reference of Bulk Data Load Jobs. (Bulk Data Load jobs will be submitted by Mule ESB process using Salesforce Connectors.) Any info on this helps.
Thanks.
  • September 07, 2016
  • Like
  • 0
I am stuck in the "Implement a basic Domain class and Apex trigger" challenge. The challenge states
Implement a basic Domain class and accompanying Apex trigger with default and update logic based upon domain conventions.

Create a basic Domain class named Accounts that extends fflib_SObjectDomain.
Create a trigger named AccountsTrigger for Account that calls the fflib_SObjectDomain triggerHandler method for all trigger methods.
Implement defaulting logic that executes when a record is inserted and sets the Description field to the value Domain classes rock!
Implement update logic that calculates the Levenshtein distance between the phrase Domain classes rock! and whatever the contents of the Description field is when an Account is updated. Use the Apex String method getLevenshteinDistance(stringToCompare) and store the result in the Annual Revenue field.



I am getting the following error:
Challenge Not yet complete... here's what's wrong: 
The 'Accounts' class 'onBeforeUpdate' method does not appear to be calculating the Levenshtein distance between the phrase default Description ‘Domain classes rock!’ and the value in the updated Description and storing the result in the Annual Revenue field correctly.

My Domain class code is
public class Accounts extends fflib_SObjectDomain {
    public Accounts(List<Account> sObjectList)
    {
        super(sObjectList);
    }
    
    public class Constructor implements fflib_SObjectDomain.IConstructable {
        public fflib_SObjectDomain construct(List<SObject> sObjectList) {
            return new Accounts(sObjectList);
        }
    }
    
    public override void onApplyDefaults()
    {
        // Apply defaults to account
        for(Account acc: (List<Account>) Records)
        {
            acc.Description = 'Domain classes rock!';
        }
    }
    
    public override void onbeforeUpdate(Map<Id,SObject> existingRecords)
    {
        updateAnnualRevenue(existingRecords);    
        
    }
    
    private void updateAnnualRevenue(Map<Id,SObject> existingRecords)
    {
        //calculate value and assign to annualrev
		String defaultStr = 'Domain classes rock!';
        for(Account acc: (List<Account>)Records)
        {
            Account oldVal = (Account)existingRecords.get(acc.Id);
            String s = oldVal.Description; 
            acc.AnnualRevenue = defaultStr.getLevenshteinDistance(s);
        }    
    }
    
}

 
I am stuck in the "Implement a basic Domain class and Apex trigger" challenge. The challenge states
Implement a basic Domain class and accompanying Apex trigger with default and update logic based upon domain conventions.

Create a basic Domain class named Accounts that extends fflib_SObjectDomain.
Create a trigger named AccountsTrigger for Account that calls the fflib_SObjectDomain triggerHandler method for all trigger methods.
Implement defaulting logic that executes when a record is inserted and sets the Description field to the value Domain classes rock!
Implement update logic that calculates the Levenshtein distance between the phrase Domain classes rock! and whatever the contents of the Description field is when an Account is updated. Use the Apex String method getLevenshteinDistance(stringToCompare) and store the result in the Annual Revenue field.



I am getting the following error:
Challenge Not yet complete... here's what's wrong: 
The 'Accounts' class 'onBeforeUpdate' method does not appear to be calculating the Levenshtein distance between the phrase default Description ‘Domain classes rock!’ and the value in the updated Description and storing the result in the Annual Revenue field correctly.

My Domain class code is
public class Accounts extends fflib_SObjectDomain {
    public Accounts(List<Account> sObjectList)
    {
        super(sObjectList);
    }
    
    public class Constructor implements fflib_SObjectDomain.IConstructable {
        public fflib_SObjectDomain construct(List<SObject> sObjectList) {
            return new Accounts(sObjectList);
        }
    }
    
    public override void onApplyDefaults()
    {
        // Apply defaults to account
        for(Account acc: (List<Account>) Records)
        {
            acc.Description = 'Domain classes rock!';
        }
    }
    
    public override void onbeforeUpdate(Map<Id,SObject> existingRecords)
    {
        updateAnnualRevenue(existingRecords);    
        
    }
    
    private void updateAnnualRevenue(Map<Id,SObject> existingRecords)
    {
        //calculate value and assign to annualrev
		String defaultStr = 'Domain classes rock!';
        for(Account acc: (List<Account>)Records)
        {
            Account oldVal = (Account)existingRecords.get(acc.Id);
            String s = oldVal.Description; 
            acc.AnnualRevenue = defaultStr.getLevenshteinDistance(s);
        }    
    }
    
}

 
Hi,
 
I have custom field 'Request Date' and custom button called 'Send Request' that redirects to send an email template. I need to stamp today's date into the custom field when the button is clicked and the email has been sent. 
 
Is there any way of doing this? How?
 
Thanks,
Arman
  • November 21, 2016
  • Like
  • 0
Trying to query AccountHistory table using the bulk api or workbench. The OldValue and NewValue do not appear in the results, except when you put them at the beginning of the select clause.

1) SOQL where NewValue, OldValue disappear:

SELECT AccountId,CreatedById,CreatedDate,Field,Id,NewValue,OldValue FROM AccountHistory WHERE Field = 'Owner'

2) SOQL that results in duplicate rows, one with Id and other with Name for OldValue, NewValue, column headers are Unknown_Field__1 and Unknown_Field__2 instead of NewValue and OldValue:

SELECT NewValue,OldValue, AccountId,CreatedById,CreatedDate,Field,Id FROM AccountHistory WHERE Field = 'Owner'

The values do not disappear when using developer console, but I still get duplicate rows as mentiond above.
Please help me with code for adding two numbers on visualforce page using javascript on the page
Hi, 

 In below method when i call from visualforce page i am getting Number of SOQL queries: 100 out of 100

 Please suggest me how to modify the code i think query inside the code is the issue please suggest me how to modifiy 
/* calculate disti discount */  
  public static Decimal reCalRslrDisc(Decimal listprice,String productcat, Decimal reslrdistdiscount){
        Boolean isService = false;
        Decimal s;
        
        system.debug('listprice = ' + listprice);
        system.debug('productcat = ' + productcat);
        system.debug('reslrdistdiscount = ' + reslrdistdiscount);
        
        if ( reslrdistdiscount == null || reslrdistdiscount < 1 ){
            reslrdistdiscount = 0;
         } 
        
        if ( productcat=='C' || productcat=='E'|| productcat=='D'|| productcat=='H'|| productcat=='I'|| productcat=='J' ){
            isService = true;
          }
        
        if ( isService == true && Limits.getQueries() <   Limits.getLimitQueries()) { 
            try
            {
            NSP_Margin_Schedule__c NMS =  [ Select Distributor_Discount__c From NSP_Margin_Schedule__c 
                                           where  Reseller_Discount__c = :reslrdistdiscount and 
                                           Service__c = :isService 
                                           and createddate < 2015-01-17T00:00:00-08:00 ];
                                           
            System.debug('Total Number of SOQL Queries allowed in this Apex code context: ' +  Limits.getLimitQueries());                               
            System.debug('1. Number of Queries used in this Apex code so far: ' + Limits.getQueries());
                    
                                        
                s = NMS.Distributor_Discount__c;
                 
             }
            
            catch (System.NullPointerException e) {
             system.debug('Null Exception');
             }
                return s;
         
                                       
        }
        else {
            return 0;
        }      
        
  }

Thanks
Sudhir
Hi good afternoon,

Is there any way to get metadata (custom fields, custom objects and others things, created in the sandbox) in Force.com IDE (Eclipse)? If yes, can i do a deploy with these metadata  to my production org?

I tried get but only came apex code. (Nothing declaratively)

How can i do that?
So I have custom object (invoice__c) with master-detail to opportunity. I have a custom field (AF_LastSyncTime__c ) on invoice__c that Im trying to access.
so here is my query:
for (Opportunity opp : [select Id, (select id, AF_LastSyncTime__c from Invoices__r),
                       (select Id, Invoice_No__c, QuotetoInvoice__c, CreatedDate
                         from Quotes 
                         order by CreatedDate DESC)
                  from Opportunity
                  where Id IN :oppsId]) 
{

 if (opp.Invoices__r.AF_LastSyncTime__c==null) return 'blah blah blah'; 

 }

No error with query, but I get invalid foreign key relationship in the if statement....why is that?

Thanks.
  • November 01, 2016
  • Like
  • 0
Hi There

I want to have a question presented to the user if a field is blank. I understand that ill need a VF page on the record which calls a jquery popup where the user can make the section. The popup would only show if 'field1' is blank, if the users selects yes then it would write yes to field 1, if they select no then it will write no to field 1. I will need to add an if statement to the start of the script.

So far i have made a VF page and put it on the opportunity however the VF page just displays the script in text, it does not execute it. At this stage im just trying to make the popup appear. 

This is a mashup of some scripts if found on here. Any help is appreciated. 

 
<apex:page StandardController="Opportunity">


    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
	<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>

window.document.onload = new function(e)
<script>
try{
  jQuery(function() {
    /*Append the jQuery CSS CDN Link to the Head tag.*/
    jQuery('head').append('<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/start/jquery-ui.css" type="text/css" />');
    
    /*Create the HTML(DIV Tag) for the Dialog.*/
    var html = 
      '<div id="dialog" title="Question 1 Title"><p>Question 1</p>Some supporting test.</div>';
    
    /*Check if the Dialog(DIV Tag) already exists if not then Append the same to the Body tag.*/
    if(!jQuery('[id=dialog]').size()){
      jQuery('body').append(html);
    }    

    /*Open the jQuery Dialog.*/ 
    jQuery( "#dialog" ).dialog({
      autoOpen: true,
      modal: true,
      show: {
        effect: "highlight",
        duration: 1000
      },
      hide: {
        effect: "fold",
        duration: 200
      },
      buttons: {
        "Yes": function() {
          location.replace('/home/home.jsp');
          jQuery( this ).dialog( "close" );
        },
        "No": function() {
          location.replace('/home/home.jsp');
          jQuery( this ).dialog( "close" );
        },
        Cancel: function() {
          jQuery( this ).dialog( "close" );
        }
      }
    });
  }); 
}
catch(e){
alert('An Error has Occured. Error: ' + e);
}
</script>

</apex:page>

 
I have two objects - Object A and Object B
Object A has a field that looks up to Object B and is the record label
On object B there is a text field with a user's full name in the firmat of "firstname Lastname"
I need to be able to look at that field and then make the user in the text field on Object B be the owner of the record in Object A

Example
Object B
Record name = 107 Mark*John
Text field data = Mark Jones

Object A
Lookup field has a link to Object B and in that field is "107 Mark*John"
Since that is the record connected to Object A and "Mark Jones" is in the text field on Object B, I want the owner of that record in Object A to now be Mark Jones and updated any time the look up field on Object A changes

Any help welcomed!
Hello,

I have a custom app with a login page that allow the user to enter their credentials.  We then authenticate to Salesforce via the apis.   However, this requires each user to append a security token to their password.  How can I whitelist so that all users can just enter their username/pw without the security token?
Note:  I've tried whitelisting a blanket range under Security Controls/Network Access but this does not achieve the desired result for ALL users.
Help much appreciated.

Thanks,
Paul
Is anyone able to download the Winter 17 Release Overview Deck at this URL: https://success.salesforce.com/0693A000004mwCf?

I tried with a production login and a developer login and neither had access.
Hi everyone, 

I'm trying to create a custom field that populates with the name of whomever had the last activity on the lead. I'm currently trying to do this using a trigger.

This is the Apex Trigger that I have written:

trigger lastactassigned on task(after insert) {
  map<id,lead> leads = new map<id,lead>();
  for(task record:trigger.new) {
    if(record.ownerid.getsobjecttype()==user.sobjecttype) {
      if(record.whoid!=null&&record.whoid.getsobjecttype()==lead.sobjecttype) {
        leads.put(record.whoid,new lead(id=record.whoid,Last_Act_Assigned_To_Test__c=record.ownerid));
      }
    }
  }
  update leads.values();
}


AND this is the Apex Class that I have written to test the trigger:

@isTest 
public class lastactassignedTest1 
{
    static testMethod void testMethod1() 
    {
        User user = new User();
        
        Lead lead = new Lead();
        lead.LastName ='Test';
        lead.FirstName ='New';
        // Add all required field
        insert lead;
        
        Task task = new Task();
        task.WhoId = user.Id;
        task.Subject = 'Other';
        task.Status = 'Not Started';
        task.Description = 'New  Work';
        insert task;
    }
}

So as of right now, both of them save without any problems; however, when I hit 'run test' on the Apex Class, it fails. 

I'm thinking that there may be something wrong with the trigger, but I am not completely sure. I would love some input!

Thank you,
Evelyn 
Hello...I have completed the 500 pts Challenge for Using the Report Builder in Reports & Dashboard Module, but I have not received my points.  I am signed into Developer Edition, what do I need to do for the system to acknowledge the completion of my challenge.