You need to sign in to do that
Don't have an account?
Dean Rourk 2
Activity History
Can you guide me if I want to extract the field values of Activity history in your query, how would I do it?
I am trying to use this code but I don't understand how to write the wrapper
public ActivityHistory[] getHistory() {
// List<Activities> act {get;set;}
List<Account> AccountsWithActivityHistories = [
// you can't query ActivityHistory directly; only in a subquery against another object type
SELECT
Id
,Name
,( SELECT ActivityDate, Description, whoid, whatid,Status, subject, istask, ActivityType
FROM ActivityHistories)
FROM Account WHERE Id = :accountId
];
// ActivityHistories on Account
for (Account a : AccountsWithActivityHistories) {
for (ActivityHistory ah : a.getSObjects('ActivityHistories')) {
if (((string)ah.WhatId).startsWith('001')) {
// only add ActivityHistory's tied directly to an Account
activities.add(new ActivityWrapper(ah));
}
}
}
}
I am trying to use this code but I don't understand how to write the wrapper
public ActivityHistory[] getHistory() {
// List<Activities> act {get;set;}
List<Account> AccountsWithActivityHistories = [
// you can't query ActivityHistory directly; only in a subquery against another object type
SELECT
Id
,Name
,( SELECT ActivityDate, Description, whoid, whatid,Status, subject, istask, ActivityType
FROM ActivityHistories)
FROM Account WHERE Id = :accountId
];
// ActivityHistories on Account
for (Account a : AccountsWithActivityHistories) {
for (ActivityHistory ah : a.getSObjects('ActivityHistories')) {
if (((string)ah.WhatId).startsWith('001')) {
// only add ActivityHistory's tied directly to an Account
activities.add(new ActivityWrapper(ah));
}
}
}
}