You need to sign in to do that
Don't have an account?
Josh Davis 47
APEX code working with Polymorphic ID (Event and Case)
I am working with events and cases but am having trouble on the concepts of joining two queries. I need to query all events that:
I am having a hard time figuring out how I work with values from two seperate arrays to come up with a calculation. I was trying to use MAPs but I wasn't quite able to get it to work.
Can someone explain the approach? Code examples would be great but I am more interested in the approach of how to do this... So here is an example:
My SOQL Query to build the map between event and case
If all the values existed on the same object I can get it to work, but trying to make a calculation off of two of them is where my problem is. Thanks in advance for any help/direction.
- completed yesterday
- are related to a case (WhatId starts with 500)
- are of event Type = 'Example'
- Event Date + (If caseType__c = "Example" + 14, 60)
I am having a hard time figuring out how I work with values from two seperate arrays to come up with a calculation. I was trying to use MAPs but I wasn't quite able to get it to work.
Can someone explain the approach? Code examples would be great but I am more interested in the approach of how to do this... So here is an example:
My SOQL Query to build the map between event and case
Map<WhatId, Event> eventCaseMap = new Map<WhatId, Event>([Select Id, WhatId, ActivityDate, Ended_Yesterday__c From Event WHERE WhatId LIKE '500%' AND Type='Example' AND Ended_Yesterday__c = TRUE]);Now that I have the map, I need to iterate through this to determine the caseType__c value to calculate the days until due, and then add that to the event ActivityDate so that I can update the case next_due_date__c.
If all the values existed on the same object I can get it to work, but trying to make a calculation off of two of them is where my problem is. Thanks in advance for any help/direction.
HTH
Andrew
All Answers
HTH
Andrew