• Maria Machado
  • 0 Points
  • Member since 2016

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
  • 2
I have a team that works different tasks daily. I am trying to design how to add those tasks to each one to then assign them the tasks they are able to work. I though of adding a picklist to the user's object, but I am not sure if that is the best way to design it.
Anyone has any thoughts to help me?
On this one, I have this as my code which I'm pretty sure is correct. But I'm lost because its stating that there are no contacts or leads with that last name. How exactly do I add these?

public class ContactAndLeadSearch{
    public static List<List< SObject>> searchContactsAndLeads(String first)
         List<List<sObject>> searchList=[FIND 'Smith' IN ALL FIELDS RETURNING Lead(FirstName,LastName),Contact(FirstName,LastName)];
            return searchList;



As part of the Challenage proposed for the 'Getting Started with Apex' trailhead topic, I am tryting the following:
Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter. 
The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.

If I create a class just with the first 3 lines of the following code and execute the rest in an anonymous windows, it works as expected. However, could I have everything just in one class?

public class StringArrayTest {
    public static Integer generateStringArray = 10;
        for(Integer i=0;i<StringArrayTest.generateStringArray;i++) {
            System.debug('Test '+ i);

Many thanks!