• Marlimar MS
  • NEWBIE
  • 0 Points
  • Member since 2020

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

So here is our business need. We need to use the SOQL REST api to pull all "appointments" from the "appointments" object that are exactly 10 days old that are in "Demo, not sold" result. We want to send these people a message, but ONLY if they don't have a subsequent appointment setup after. So if 10 days ago the result was "Demo, not sold" and they have no appointments setup after that, they qualify. 

I don't want to do this in 2 queries. I can go into details why if needs be, but for the sake of this post, I need to accomplish this in 1 single query. I need to get all appointments that resulted in "Demo, not sold" from the appointment table exactly 10 days ago BUT have not had any other kind of appointment setup within the last 9 days. 

More details. I need the SOQL query to return exactly the result set that I need. I don't want to have to do logic or a 2nd query. We are doing it with 2 queries right now, but with a new business need I need to get my expected results in 1 query with no further need to process logic after the API call. I just need to be able to loop over the exact result set and know that I can call each of these people and not have anyone that had another type of appointment setup in the days since the "Demo, not sold" result.

Can someone help? I don't need an exact query, just how I can do it. 
Hi. 

So here is our business need. We need to use the SOQL REST api to pull all "appointments" from the "appointments" object that are exactly 10 days old that are in "Demo, not sold" result. We want to send these people a message, but ONLY if they don't have a subsequent appointment setup after. So if 10 days ago the result was "Demo, not sold" and they have no appointments setup after that, they qualify. 

I don't want to do this in 2 queries. I can go into details why if needs be, but for the sake of this post, I need to accomplish this in 1 single query. I need to get all appointments that resulted in "Demo, not sold" from the appointment table exactly 10 days ago BUT have not had any other kind of appointment setup within the last 9 days. 

More details. I need the SOQL query to return exactly the result set that I need. I don't want to have to do logic or a 2nd query. We are doing it with 2 queries right now, but with a new business need I need to get my expected results in 1 query with no further need to process logic after the API call. I just need to be able to loop over the exact result set and know that I can call each of these people and not have anyone that had another type of appointment setup in the days since the "Demo, not sold" result.

Can someone help? I don't need an exact query, just how I can do it.