-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
3Questions
-
1Replies
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));
}
}
}
}
- Dean Rourk 2
- July 20, 2016
- Like
- 0
- Continue reading or reply
Account level security in VF pages and controller
We use the account owner and their manager to control who can view accounts. Owners can only see there accounts. Works great.
I created a VF page and controller to display a custom object that has a master detail relationship with account. Everyone can all the accounts. I don't understand why the the account security is not following through on the VF page.
Any help would be greatly appreciated.
I created a VF page and controller to display a custom object that has a master detail relationship with account. Everyone can all the accounts. I don't understand why the the account security is not following through on the VF page.
Any help would be greatly appreciated.
- Dean Rourk 2
- July 18, 2016
- Like
- 0
- Continue reading or reply
apex trigger for approval process
I keep getting a compile error: Error: Compile Error: Method does not exist or incorrect signature: [Approval.ProcessSubmitRequest].setNextApproverIds(Id)
Eventually I will not hard code the user name 'john Taylar' and get it from the object.
Has anyone been able to get this to work.
trigger SDRStartApprovalProcess on SDR__c (after update) {
for( id aId : Trigger.newMap.keySet() )
{
if( Trigger.oldMap.get( aId ).Account_Owner_id__c!= Trigger.newMap.get( aId ).Account_Owner_id__c )
{
// do something here because your field has changed
List<User> users = [select Name from User where Name= 'John Taylor'];
id approver= users.get(0).Id ;
//Approver = userMap(Trigger.newMap.get( aId ).Account_Owner__c).Id
Approval.ProcessSubmitRequest app = new Approval.ProcessSubmitRequest();
app.setObjectId(aid);
app.setNextApproverIds(approver);
Approval.ProcessResult result = Approval.process(app);
}
}
}
Eventually I will not hard code the user name 'john Taylar' and get it from the object.
Has anyone been able to get this to work.
trigger SDRStartApprovalProcess on SDR__c (after update) {
for( id aId : Trigger.newMap.keySet() )
{
if( Trigger.oldMap.get( aId ).Account_Owner_id__c!= Trigger.newMap.get( aId ).Account_Owner_id__c )
{
// do something here because your field has changed
List<User> users = [select Name from User where Name= 'John Taylor'];
id approver= users.get(0).Id ;
//Approver = userMap(Trigger.newMap.get( aId ).Account_Owner__c).Id
Approval.ProcessSubmitRequest app = new Approval.ProcessSubmitRequest();
app.setObjectId(aid);
app.setNextApproverIds(approver);
Approval.ProcessResult result = Approval.process(app);
}
}
}
- Dean Rourk 2
- June 25, 2014
- Like
- 0
- Continue reading or reply
Account level security in VF pages and controller
We use the account owner and their manager to control who can view accounts. Owners can only see there accounts. Works great.
I created a VF page and controller to display a custom object that has a master detail relationship with account. Everyone can all the accounts. I don't understand why the the account security is not following through on the VF page.
Any help would be greatly appreciated.
I created a VF page and controller to display a custom object that has a master detail relationship with account. Everyone can all the accounts. I don't understand why the the account security is not following through on the VF page.
Any help would be greatly appreciated.
- Dean Rourk 2
- July 18, 2016
- Like
- 0
- Continue reading or reply