Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Update Account field when related Case is closed
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Update Account field when related Case is closed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-14-2012 12:58 PM
Hello,
Newbie question...
I need to update an Account date field ("Last_QA_Audit") when a Case related to that Account (via Contact) is closed, but only when that case is a particular record type. Does anyone have a snippet to share to get me started? Thank you!
Don
Re: Update Account field when related Case is closed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-16-2012 11:32 PM
you need to write a triiger on case object that will update the Account's Field info.
like
set<id> setAccountIds=new set<Id>();
trigger CaseTriggers on Account (after update) {
for(Case ObjCase:Trigger.new){
if(ObjCase.Status='Closed' && ObjCase.AccountId!=null){
setAccountIds.add(ObjCase.AccountId);
}
}
Account[] updateAccount=[Select Id,Last_QA_Audit from Account where id:insetAccountIds];
for(Account acc: updateAccount){
acc.Last_QA_Audit=system.today();
}
update updateAccount;
}
//Add Record Type in above trigger logic . Please see above sample code. Also update Field API accordingly.

