Skip to main content
added 565 characters in body
Source Link

Yes you can handle this bulk in trigger (after update) by using Trigger.oldMap and Trigger.new in a loop and checking oldfield!=newfield values. Then, get the old and new fields values using same map and store it in a string.

I believe we can get the current user Id (who modified the data) using Userinfo.getUserId() then query this Id in User object, to get User's email (if you want to send mail to the user who modified) or if its specific User then set the email inside trigger.

Then, you can send the string using Messaging.SingleEmailMessage (mail) methods ( setToAddresses, setPlainTextBody ) and Messaging.sendEmail (new Messaging.SingleEmailMessage[] {mail}

@chris, on your above commented question: If you want to try in workflow rule, you can create new field for the old value. To get old value, create a workflow rule with Criteria: ischanged(field) [ I believe field is Answer__c ] and Add workflow action: Field update to update the new field with: Priorvalue(field) [ i.e Priorvalue(Answer__c) ]

Now you can add existing field + new field which is updated with the old value in your email alert template. But you can't do this for your bulk update as mentioned above. 5 emails gets fired for 5 updates.

Yes you can handle this bulk in trigger (after update) by using Trigger.oldMap and Trigger.new in a loop and checking oldfield!=newfield values. Then, get the old and new fields values using same map and store it in a string.

I believe we can get the current user Id (who modified the data) using Userinfo.getUserId() then query this Id in User object, to get User's email (if you want to send mail to the user who modified) or if its specific User then set the email inside trigger.

Then, you can send the string using Messaging.SingleEmailMessage (mail) methods ( setToAddresses, setPlainTextBody ) and Messaging.sendEmail (new Messaging.SingleEmailMessage[] {mail}

Yes you can handle this bulk in trigger (after update) by using Trigger.oldMap and Trigger.new in a loop and checking oldfield!=newfield values. Then, get the old and new fields values using same map and store it in a string.

I believe we can get the current user Id (who modified the data) using Userinfo.getUserId() then query this Id in User object, to get User's email (if you want to send mail to the user who modified) or if its specific User then set the email inside trigger.

Then, you can send the string using Messaging.SingleEmailMessage (mail) methods ( setToAddresses, setPlainTextBody ) and Messaging.sendEmail (new Messaging.SingleEmailMessage[] {mail}

@chris, on your above commented question: If you want to try in workflow rule, you can create new field for the old value. To get old value, create a workflow rule with Criteria: ischanged(field) [ I believe field is Answer__c ] and Add workflow action: Field update to update the new field with: Priorvalue(field) [ i.e Priorvalue(Answer__c) ]

Now you can add existing field + new field which is updated with the old value in your email alert template. But you can't do this for your bulk update as mentioned above. 5 emails gets fired for 5 updates.

added 118 characters in body
Source Link

Yes you can handle this bulk in trigger (after update) by using Trigger.oldMap and Trigger.new in a loop and checking oldfield!=newfield values. Then, get the old and new fields values using same map and store it in a string.

I believe we can get the current user Id (who modified the data) using Userinfo.getUserId() then query this Id in User object, to get User's email (if you want to send mail to the user who modified) or if its specific User then set the email inside trigger.

Then, you can send the string using Messaging.SingleEmailMessage methods(mail) methods ( setToAddresses, setPlainTextBody ) and Messaging.sendEmail (new Messaging.SingleEmailMessage[] {mail}

Yes you can handle this bulk in trigger (after update) by using Trigger.oldMap and Trigger.new in a loop and checking oldfield!=newfield values. Then, get the old and new fields values using same map and store it in a string.

I believe we can get the current user Id (who modified the data) using Userinfo.getUserId() then query this Id in User object, to get User's email (if you want to send mail to the user who modified) or if its specific User then set the email inside trigger.

Then, you can send the string using Messaging.SingleEmailMessage methods.

Yes you can handle this bulk in trigger (after update) by using Trigger.oldMap and Trigger.new in a loop and checking oldfield!=newfield values. Then, get the old and new fields values using same map and store it in a string.

I believe we can get the current user Id (who modified the data) using Userinfo.getUserId() then query this Id in User object, to get User's email (if you want to send mail to the user who modified) or if its specific User then set the email inside trigger.

Then, you can send the string using Messaging.SingleEmailMessage (mail) methods ( setToAddresses, setPlainTextBody ) and Messaging.sendEmail (new Messaging.SingleEmailMessage[] {mail}

Source Link

Yes you can handle this bulk in trigger (after update) by using Trigger.oldMap and Trigger.new in a loop and checking oldfield!=newfield values. Then, get the old and new fields values using same map and store it in a string.

I believe we can get the current user Id (who modified the data) using Userinfo.getUserId() then query this Id in User object, to get User's email (if you want to send mail to the user who modified) or if its specific User then set the email inside trigger.

Then, you can send the string using Messaging.SingleEmailMessage methods.