-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
9Questions
-
6Replies
Trigger to send case assigned email to Case owner and Manager using a round robin queue assignment.
The case history looks like this: (assigned to queue and reassigned to queue member in single action)
2/23/2015 9:06 AM G.Dickens Changed Case Owner from L1 Case Queue to Luke S.
- Gdickens3
- February 23, 2015
- Like
- 0
- Continue reading or reply
I have a custom java script button that I need to modify to look at the user; is that possible?
Current Code (working):
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")};
if('{!Account.RecordType}' == "Unitrends - End User" || '{!Account.Account_Status__c}'=="Prospect")
alert ("Cases should be created from the Asset for current customers or from an Opportunity for Prospects");
else
open('500/e?retURL=%2F500%2Fo&RecordType=012300000000Xth&ent=Case');
NEW CODE for USER:
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")};
if('{!User.Id}'= "00540000001sVhY" )
alert ("Cases should be created from the Asset for current customers or from an Opportunity for Prospects");
else
open('500/e?retURL=%2F500%2Fo&RecordType=012f0000000D63a&ent=Case');
- Gdickens3
- November 21, 2014
- Like
- 0
- Continue reading or reply
Can the query timeout be increased?
- Gdickens3
- November 06, 2014
- Like
- 1
- Continue reading or reply
Update Report/Dashboard Folder Permissions
My company has been using SFDC since 2005 - there are a lot of report/dashboard folders. The new sharing does not automatically allow owners of the folders to add users to the auto refresh unless they have been added. How can I add "all users" as individual users? I can and have created groups but it would be nice to let the owner of the folders add whoever they want without me creating groups as needed.
- Gdickens3
- September 30, 2013
- Like
- 0
- Continue reading or reply
Trigger Error
I have a custom object with a trigger that was created before my time - I am just learning triggers. I have pasted my code below. My Users are getting the error when saving "Error:Apex trigger chassis_notification caused an unexpected exception, contact your administrator: chassis_notification: execution of BeforeUpdate caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing target address (target, to, cc, bcc): []: Trigger.chassis_notification: line 149, column 1"
trigger chassis_notification on Warranty__c (before update) { for(Warranty__c w : Trigger.new) { // If this is a Chassis, send email to notify accounting if(w.Chassis_Unit__c == True && w.Warranty_Status__c == 'Approved' && w.ChassisNotificationSent__c != True && w.Replace_with_vRecovery__c == False ) { Account company = [select Id, Name from Account where Id = :w.Account_Name__c]; Contact contact = [select Id, Name from Contact where Id = :w.Contact_Name__c]; User caseOwner = [select Id, Email from User where Id = :w.OwnerId]; Asset asset = [select Id, name from Asset where Id = :w.Asset_Tag__c]; Case myCase = [select Id, CaseNumber from Case where Id = :w.Associated_Case__c]; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses; mail.setReplyTo('support@unitrends.com'); mail.setSenderDisplayName('Unitrends Support'); if(w.Is_GE__c == True) { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; mail.setSubject('GE Customer: A New Warranty Request has been Approved & Includes a Chassis or Unit Replacement'); mail.setPlainTextBody ('This customer warranty to be fulfilled by RAVE.' + '\n\n\n' + 'The following Warranty Request has been approved and may require' + '\n' + 'your attention as it includes a chassis or unit replacement:'+ '\n\n' + 'Company:\t\t\t' + company.Name + '\n' + 'Contact\t\t\t' + contact.Name + '\n' + 'Asset Tag:\t\t\t' + asset.Name + '\n' + 'Associated Case:\t\t' + myCase.CaseNumber + '\n' + 'Warranty Shipment Number:\t' + w.Name + '\n\n' + 'Click on the link to access the Warranty:\n' + 'https://na2.salesforce.com/' + w.Id ); } else if(w.Platinum_Support__c == True) { if(w.Manufacturer__c == 'Rave') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'unitrendsccd@chipcocomputer.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } else if(w.Manufacturer__c == 'CHIPCO') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'unitrendsccd@chipcocomputer.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } else if(w.Manufacturer__c == 'MBX') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'support@mbx.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } mail.setSubject('Platinum Customer: A New Warranty Request has been Approved & Includes a Chassis or Unit Replacement'); mail.setPlainTextBody ('This customer has platinum support and requires next day shipping!!!' + '\n\n\n' + 'The following Warranty Request has been approved and may require' + '\n' + 'your attention as it includes a chassis or unit replacement:'+ '\n\n' + 'Company:\t\t\t' + company.Name + '\n' + 'Contact\t\t\t' + contact.Name + '\n' + 'Asset Tag:\t\t\t' + asset.Name + '\n' + 'Associated Case:\t\t' + myCase.CaseNumber + '\n' + 'Warranty Shipment Number:\t' + w.Name + '\n\n' + 'Click on the link to access the Warranty:\n' + 'https://na2.salesforce.com/' + w.Id ); } else { if(w.Manufacturer__c == 'CHIPCO') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'unitrendsccd@chipcocomputer.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } else if(w.Manufacturer__c == 'MBX') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'support@mbx.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } mail.setSubject('A New Warranty Request has been Approved & Includes a Chassis or Unit Replacement'); mail.setPlainTextBody ('The following Warranty Request has been approved and may require' + '\n' + 'your attention as it includes a chassis or unit replacement:'+ '\n\n' + 'Company:\t\t\t' + company.Name + '\n' + 'Contact\t\t\t' + contact.Name + '\n' + 'Asset Tag:\t\t\t' + asset.Name + '\n' + 'Associated Case:\t\t' + myCase.CaseNumber + '\n' + 'Warranty Shipment Number:\t' + w.Name + '\n\n' + 'Click on the link to access the Warranty:\n' + 'https://na2.salesforce.com/' + w.Id ); } mail.setToAddresses(toAddresses); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); w.ChassisNotificationSent__c = True; } } }
- Gdickens3
- September 10, 2012
- Like
- 0
- Continue reading or reply
Display Account Owner on Case
I have modified a code for inserting the account owner on an opportunity record to show the same on a case object, but getting error: Compile Error: Incompatible element type Schema.SObjectField for collection of Id at line 4 column 36
I am new to apex and have only successfully modified current triggers when fields change, any help is appreciated.
trigger trgAccOwner on Case (before insert,before update) { Set<Id> acctIDs = new Set<Id>(); for(Case tl:Trigger.new) { if(case.AccountId != null) acctIDs.add(case.AccountId); } Map<Id, Account> acctMap = new Map<Id, Account>([select Owner.Name from Account where Id in :acctIDs]); for(Case tl: Trigger.new) { if(case.AccountId != null) case.Account_Owner__c = acctMap.get(Case.AccountId).Owner.Name; } }
- Gdickens3
- September 04, 2012
- Like
- 0
- Continue reading or reply
Task Subject Update
First time poster/coder
I have tried to create a workflow to update a task subject when my user sends an email using the BCC to Salesforce. However I think it might need to be updated 'before' rather than how a workflow operates on user action. It seems simple enough, but I've never created a code. Is there any help out there?
Thanks!
- Gdickens3
- March 29, 2012
- Like
- 0
- Continue reading or reply
Limit Last Activity by UserID
We have a formula to track "last activity age" (formula is: TODAY() - LastActivityDate) However since we have Eloqua making daily automatic activity this field is not a true representation of our employee activity. I can filter this somewhat in reports by omitting the Eloqua id - but management this field to dynamically look at a view to determine account rep's activity.
Is there a way to limit this field to update only if the activity is not done by the Eloqua userid (0054000000195mL)
- Gdickens3
- January 23, 2012
- Like
- 0
- Continue reading or reply
Can the query timeout be increased?
- Gdickens3
- November 06, 2014
- Like
- 1
- Continue reading or reply
Can the query timeout be increased?
- Gdickens3
- November 06, 2014
- Like
- 1
- Continue reading or reply
Update Report/Dashboard Folder Permissions
My company has been using SFDC since 2005 - there are a lot of report/dashboard folders. The new sharing does not automatically allow owners of the folders to add users to the auto refresh unless they have been added. How can I add "all users" as individual users? I can and have created groups but it would be nice to let the owner of the folders add whoever they want without me creating groups as needed.
- Gdickens3
- September 30, 2013
- Like
- 0
- Continue reading or reply
Trigger Error
I have a custom object with a trigger that was created before my time - I am just learning triggers. I have pasted my code below. My Users are getting the error when saving "Error:Apex trigger chassis_notification caused an unexpected exception, contact your administrator: chassis_notification: execution of BeforeUpdate caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing target address (target, to, cc, bcc): []: Trigger.chassis_notification: line 149, column 1"
trigger chassis_notification on Warranty__c (before update) { for(Warranty__c w : Trigger.new) { // If this is a Chassis, send email to notify accounting if(w.Chassis_Unit__c == True && w.Warranty_Status__c == 'Approved' && w.ChassisNotificationSent__c != True && w.Replace_with_vRecovery__c == False ) { Account company = [select Id, Name from Account where Id = :w.Account_Name__c]; Contact contact = [select Id, Name from Contact where Id = :w.Contact_Name__c]; User caseOwner = [select Id, Email from User where Id = :w.OwnerId]; Asset asset = [select Id, name from Asset where Id = :w.Asset_Tag__c]; Case myCase = [select Id, CaseNumber from Case where Id = :w.Associated_Case__c]; Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); String[] toAddresses; mail.setReplyTo('support@unitrends.com'); mail.setSenderDisplayName('Unitrends Support'); if(w.Is_GE__c == True) { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; mail.setSubject('GE Customer: A New Warranty Request has been Approved & Includes a Chassis or Unit Replacement'); mail.setPlainTextBody ('This customer warranty to be fulfilled by RAVE.' + '\n\n\n' + 'The following Warranty Request has been approved and may require' + '\n' + 'your attention as it includes a chassis or unit replacement:'+ '\n\n' + 'Company:\t\t\t' + company.Name + '\n' + 'Contact\t\t\t' + contact.Name + '\n' + 'Asset Tag:\t\t\t' + asset.Name + '\n' + 'Associated Case:\t\t' + myCase.CaseNumber + '\n' + 'Warranty Shipment Number:\t' + w.Name + '\n\n' + 'Click on the link to access the Warranty:\n' + 'https://na2.salesforce.com/' + w.Id ); } else if(w.Platinum_Support__c == True) { if(w.Manufacturer__c == 'Rave') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'unitrendsccd@chipcocomputer.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } else if(w.Manufacturer__c == 'CHIPCO') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'unitrendsccd@chipcocomputer.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } else if(w.Manufacturer__c == 'MBX') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'support@mbx.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } mail.setSubject('Platinum Customer: A New Warranty Request has been Approved & Includes a Chassis or Unit Replacement'); mail.setPlainTextBody ('This customer has platinum support and requires next day shipping!!!' + '\n\n\n' + 'The following Warranty Request has been approved and may require' + '\n' + 'your attention as it includes a chassis or unit replacement:'+ '\n\n' + 'Company:\t\t\t' + company.Name + '\n' + 'Contact\t\t\t' + contact.Name + '\n' + 'Asset Tag:\t\t\t' + asset.Name + '\n' + 'Associated Case:\t\t' + myCase.CaseNumber + '\n' + 'Warranty Shipment Number:\t' + w.Name + '\n\n' + 'Click on the link to access the Warranty:\n' + 'https://na2.salesforce.com/' + w.Id ); } else { if(w.Manufacturer__c == 'CHIPCO') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'unitrendsccd@chipcocomputer.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } else if(w.Manufacturer__c == 'MBX') { toAddresses = new String[] {'dcrosby@unitrends.com', 'briant@unitrends.com', 'luke@unitrends.com', 'support@mbx.com', 'twallick@unitrends.com', 'dsapp@unitrends.com', 'geisenhower@unitrends.com', caseOwner.Email, 'dmccraw@unitrends.com', 'jrast@unitrends.com', 'accounting@unitrends.com' }; } mail.setSubject('A New Warranty Request has been Approved & Includes a Chassis or Unit Replacement'); mail.setPlainTextBody ('The following Warranty Request has been approved and may require' + '\n' + 'your attention as it includes a chassis or unit replacement:'+ '\n\n' + 'Company:\t\t\t' + company.Name + '\n' + 'Contact\t\t\t' + contact.Name + '\n' + 'Asset Tag:\t\t\t' + asset.Name + '\n' + 'Associated Case:\t\t' + myCase.CaseNumber + '\n' + 'Warranty Shipment Number:\t' + w.Name + '\n\n' + 'Click on the link to access the Warranty:\n' + 'https://na2.salesforce.com/' + w.Id ); } mail.setToAddresses(toAddresses); Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); w.ChassisNotificationSent__c = True; } } }
- Gdickens3
- September 10, 2012
- Like
- 0
- Continue reading or reply
Display Account Owner on Case
I have modified a code for inserting the account owner on an opportunity record to show the same on a case object, but getting error: Compile Error: Incompatible element type Schema.SObjectField for collection of Id at line 4 column 36
I am new to apex and have only successfully modified current triggers when fields change, any help is appreciated.
trigger trgAccOwner on Case (before insert,before update) { Set<Id> acctIDs = new Set<Id>(); for(Case tl:Trigger.new) { if(case.AccountId != null) acctIDs.add(case.AccountId); } Map<Id, Account> acctMap = new Map<Id, Account>([select Owner.Name from Account where Id in :acctIDs]); for(Case tl: Trigger.new) { if(case.AccountId != null) case.Account_Owner__c = acctMap.get(Case.AccountId).Owner.Name; } }
- Gdickens3
- September 04, 2012
- Like
- 0
- Continue reading or reply
trigger to get the account owner name
Hi,
I have a custom object "xyz" with a look up field to accounts
We need to see the name of the account owner, I cannot get it via formula (well, I could, but then I would need to modify the formula each time a new user is created and TEXT( Account__r.Ownership ) didn´t work)
I guess this is a simple trigger, to get the account owner name populated in the "xyz" object...
Any sample trigger you may have please to direct me to the right direction....
Thank you!!:)
- Depton
- November 04, 2011
- Like
- 0
- Continue reading or reply