• Sachin Ks 5
  • NEWBIE
  • 20 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Error I am getting is "Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, User: id value of incorrect type: 00528000003zbMiAAI: [User__c]"

In the question, one point is "
Add a custom field to Campsite Reservation with the type 'Lookup' related to the 'User' object with the field name and label of 'User' and Child Relationship Name of 'Campsite_Reservations'. The resulting API name should be 'User__c'."  I am little confused about this, should we create a a new object called User? or should we put lookup to 'Campsite' Object and name the Field User??This is the Campsite Reservation Object
Hi there,

I am new to Triggrs, and trying to bulkify the below Trigger. The Trigger will create a Task when stage is Closed Won. It will also check if the Opportunity already has a Task with the same Subject, and it won't create the tasks in this case.

The Trigger is:
trigger ClosedOpportunityTrigger on Opportunity (after insert, after update) {
	
    //create a list of tasks to be added
    List<Task> listTasks = new List<Task>();
    
    for (Opportunity opp : Trigger.New){
 		//create a list of Tasks already created with same subject on opp
        List<Task> existingTasks = [SELECT Id
                                      FROM Task
                                     WHERE WhatId = :opp.Id
                                       AND Subject = 'Follow Up Test Task'];
        
        //add new task only if stage is Closed Won and no existing task with same subject on opp
        if ((opp.StageName == 'Closed Won') && (existingTasks.size() == 0) ){
        Task newTask    = new Task();
        newTask.WhatId  = opp.Id; 
        newTask.Subject = 'Follow Up Test Task';
        newTask.Status  = 'Not started';
        newTask.OwnerId = opp.OwnerId;
        listTasks.add(newTask); 
        }
    }
    insert listTasks;
}
I want to move the SOQL query our of the For loop, but if I do it, it will look for Tasks with this subject throughout the whole Trigger.New opportunity list. How can I move it out and keep count of each opportunity having this task with this subject?

Thanks.
Walid
 
  • January 11, 2017
  • Like
  • 0
Hello All,
I am stuck in below trailhead chanllange. Please help me.

Using the Contact standard controller, create a Visualforce page which displays a Contact's First Name, Last Name and the Email address of the Contact's Owner.The page must be named 'ContactView'.
It must reference the Contact standard controller.
It should include a bound variable that uses the standard controller to display the first name of the Contact.
It should include a bound variable that uses the standard controller to display the last name of the Contact.
It should include a bound variable that uses the standard controller to display the Contact Owner's email.

I am getting below error..
Challenge not yet complete... here's what's wrong:
The page does not include a bound first name variable for the Contact record
Please refer below screenshot for vf code.
User-added image
hi
i am new to salesforce platform.
Install a simple Apex class, write unit tests that achieve 100% code coverage for the class, and run your Apex tests.The Apex class to test is called 'VerifyDate', and the code is available here. Copy and paste this class into your Developer Edition via the Developer Console.
'VerifyDate' is a class which tests if a date is within a proper range, and if not will return a date that occurs at the end of the month within the range.
The unit tests must be in a separate test class called 'TestVerifyDate'.
The unit tests must cover scenarios for all lines of code included in the Apex class, resulting in 100% code coverage.
Run your test class at least once (via the Developer Console) before attempting to verify this challenge.

In the above challege i am not able to write a 'TestVerifyDate' class. I dont unsertstand how to write it for a date.
plz help..