• want fall
  • 0 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 3

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. 
Get Started with Service Cloud

I am trying to add a Case Team Role, but cannot find it in my trailheard org.

any ideas?

I have an APEX Trigger that runs when a Task is created/updated, so it can update the related Case. 


Somehow, the trigger is causing the Case Assignment Rules to re-fire, but I don't know what.  Any thoughts?




trigger caseLastActivityDate on Task (after insert, after update) { Map<String, Task> tMap = new Map<String, Task>(); for (Task t : System.Trigger.new) { String whatId = t.WhatId; System.debug('whatId is ' + whatId); if(whatId <> null && whatId.startsWith('500') == true) { Case c = [select Id from Case where Id = :whatId]; if(c.Id <> null) { c.Last_Activity_Date__c = t.LastModifiedDate; update c; } } } }