• Vinicius Vandre 5
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 0
    Replies

Hello! I'm having trouble figuring this one out. So any help will be highly appreciated!

I have a custom picklist field in Order.

I wish to retrieve all the most recent records for each value in the picklist.

Let's say that there are 10 Order records and that the picklist has values A,B,C. What I would like to retrieve (in a single query to avoid SOQL limits) is a list of the 3 most recent records that have each value.

How would you achieve this?

 

I'm trying to use Database.leadConvert to set Account fields based on a condition, as such: 

 Database.LeadConvert lc= new Database.LeadConvert();
        lc.setLeadId(lead.Id);
        lc.setConvertedStatus('Closed-Converted');
        lc.accountrecord.CustomField = 'Value';
        Database.leadConvertResult lcr = Database.convertLead(lc);


However I get a "Variable does not exist: CustomField" Error.

How would I go about achieving the task using Database.LeadConvert  class?

Huge thanks in advance
 

Is it possible to create a MAP<Field1, Field2> directly using SOQL [SELECT Field1, Field2 from Obj_Test] without iterating over LIST returned by SOQL.

For example, if I have an Employee object and want to create a MAP<Emp_Id, Emp_Salary> by using SOQL- SELECT Emp_Id, Emp_Salary FROM Employee__c; I know we can achieve it by using for loop over List returned by SOQL and put these two fields in a map.

Can anyone please let me know if is there another way to do this?

Thanks,
Rajneesh