You need to sign in to do that
Don't have an account?
Olanre Awolowo
How to create a trigger if a i have made an attachment on an account record, make the checkbox ticked automatially with Apex trigger urgent
Hi i have been given a task at work which requires me coding with apex trigger
Please see below:
The Request:
“We need a notification to be sent to the fraud department whenever an attachment gets edited on the Account record. Please can you set this up?”
I would suggest keeping the following in mind when you approach this scenario;
--------------------------------------
The task looks straight forward. I have created a checkbox that will return true if an attachment have been uploaded on the account record, later on i will create a workflow that if the checkbox ticked = TRUE, send email to the users.
I have start to code this but i keep top get error such as:
trigger Attachmentchangenotif on Account (before update, before insert) {
/** for(Account c: trigger.new){
If (label.attachments == True)
That is just thebit i know. I have created a checkbox called attachment trigger.
I need help please
Please see below:
The Request:
“We need a notification to be sent to the fraud department whenever an attachment gets edited on the Account record. Please can you set this up?”
I would suggest keeping the following in mind when you approach this scenario;
--------------------------------------
The task looks straight forward. I have created a checkbox that will return true if an attachment have been uploaded on the account record, later on i will create a workflow that if the checkbox ticked = TRUE, send email to the users.
I have start to code this but i keep top get error such as:
trigger Attachmentchangenotif on Account (before update, before insert) {
/** for(Account c: trigger.new){
If (label.attachments == True)
That is just thebit i know. I have created a checkbox called attachment trigger.
I need help please
Thanks
All Answers
Let me know if this helps :)
Thanks,
Amit Singh
Thanks for the response
I have used the code you gave me and I inserted it. The only thing I change is the "Attachment_Trigger__c " to "AccountTrigger which is the right field for this (This is a checkbox field type)
Please see error and advise where i did mistake
Thanks
Do you mean, if someone changes any attachment like Name or Body then make that checkbox to true? Use the below code trigger should be written in Attachment.
Believe that It will do the trick :)
Thanks,
Amit Singh
Thanks for the quick response, really pleased. What i meant is if someone will change the attachment file. Such as if a user changes the attachment on the account record
Thanks
Thanks for the quick response, really pleased. What I meant is if someone changes the attachment file, Such as if a user changes the attachment on the account record. In this case, if this has been changed, i want the checkbox field TriggerAccount_c to be Ticked automatically
Still gives me error :( . I think we almost there now.. Just the Line 5 behaving tricky
Thanks,
Amit
Still error, it regarding the body
Thanks,
Just a last question then i leave you, What of if i want to make it to be possible if i upload a new attachment the checkbox should be ticked automatically for example.
That my last question. What isyour email by the way, will like to have it
Thanks
Olanre
Thanks
cse.amitallenhouse@gmail.com
Mark as best answer if this works.
Thanks,
Amit Singh
after that I will hide the checkbox field.
So for this apex code, now each time I insert a new attachment or make an update a new one the checkbox will be ticked. what about if the name of the attachment gets edited?
Many thanks
Olanre
Make this small adjustment in your trigger. :)
Thanks,
Amit
Appreciate
each time an update is made, email will fire with workflow, Each time i edit the name of the attachment with edit email will be sent?
Many thanks
Olanre
Thanks
What of if someone deletes the attachment, is possible to make another checkbox ticked?
I will have to create another custom checkbox to make it ticked if the attachment is deteleted to tick the checkbox automatically.
I will like the piece of code.
Ps are you on LinkedIn i want to endorse you
Thanks
Olanre
How do you think i can improve this .
I just want to make that if there is updates such as new attachment/attachment has been deleted, an email should be sent and this is each time
Thanks
Dont worry about the question i asked you, Last help i will need will be if you can code the delete Query for me.
I want when an attachment is deleted, checkbox should be ticked automatically.
Thanks
Thanks for the help