You need to sign in to do that
Don't have an account?
Marlimar MS
Need help pulling results in 1 query.
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.
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.
That would save changing the existing API request and ensure you are only hitting those appointments that are 10 days old and have no followup appointment created.
regards
Andrew
What I am trying to accomplish this in 1 query so we can fit this into our wrapper. We can manually interface with each client for this, but to generalie it it has to be done in 1 query. So you are right objectivly. Just change the status of the existing appointment, but, I can't control that all our clients will do it that way. I know some of our clients create new appointments in that situation.
So it still stands that I need to accomplish this in 1 query. I am unsure on the boundaries of SOQL. Can we use nested SELECT statements? Can we use "count" functions like SQL? Any ideas?