function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
guitardjguitardj 

SOQL question

Hi all,

I wonder if anyone can help me with this problem.  In the opportunity, there is a field called "close date", so whenever I use excel connector to retrieve opportunities, I would like to write a SOQL statement to only retrieve the opportunity with the most recent close date. 

Please let me know what you think.  I am currently using excel connector's callable function, soql_table.. here is my statement

soql_table("Opportunity", "Workspace_ID__c = " & "'" & sourceWSID & "'")

This statement sometimes returns mutiple opportunities, so if i can add in the SOQL statement on close date, then it will be perfect and return only the "most recent close date opportunity"

Your help is much appreciated.
Sincerely,