You need to sign in to do that
Don't have an account?
Send an email when cases hit certain criteria
Hello,
I am attempting to set up a workflow process that will send me and a few other admins an email when the number of cases for a certain location hits 7 within 7 days. I was looking at this, and it seems to be somewhat close to what I am tring to do, but not quite.
If anyone has any suggestions I would appreciate it!
Thank you!
I am attempting to set up a workflow process that will send me and a few other admins an email when the number of cases for a certain location hits 7 within 7 days. I was looking at this, and it seems to be somewhat close to what I am tring to do, but not quite.
If anyone has any suggestions I would appreciate it!
Thank you!
- In Case object, create a new checkbox field: "Send Alert" (Send_Alert__c)
- Create a new Case trigger and paste the code below
- Set up a new Workflow Rule for Case object to check if Send_Alert__c = true
- Send an email alert
- Set the Send_Alert__c back to false
And here is the code for the Case trigger:All Answers
I made the tweak to the code from Daniel. Assuming you have a Location__c field in the Case object, the code looks like below. Put the code inside the Case before insert trigger.
- In Case object, create a new checkbox field: "Send Alert" (Send_Alert__c)
- Create a new Case trigger and paste the code below
- Set up a new Workflow Rule for Case object to check if Send_Alert__c = true
- Send an email alert
- Set the Send_Alert__c back to false
And here is the code for the Case trigger:Thank you!
Need more info:
- 7 days from what date?
- From where is the location coming from? (which object: a field from same record or a parent object has the location)
- How many locations are there?
Regards,Deepak Rathinavelu
I believe that I am on the right track with the info that Raidan provided, however when I went to upload the new apex trigger from my sandbox to the producation org, it is giving me the below error:
so perhaps I am going to need to do it another way? I was under the assumption that my org was able to do this, but it looks like I was mistaken.
Its more off a permission then an error, hope you have the necessary access and permissions.
Check out this link,
https://developer.salesforce.com/forums/?id=906F0000000902tIAA
I believe that it may have to do with the fact that I do not have a 'Location__c' feild on my cases so I am using the custom feild that we have which is basically the same thing. THat's my only guess.
Thank you so much for all of your support while I figure this out, this community rocks! :)
You probably want to run all test in your sandbox first to make sure all is good.
I believe it's because we are using a slightly different set up with our service, instead of having the location on the account we have a list of location (sites) associated with the account below the main info. They have the field SVMXC__Site__c appended to them. I tried to use this field to update the account, and it didn't work though. I'm guessing this has something to do with the fact that we're using service max...
other than this field I am not sure what I could use to make thetrigger
could it be that the check box field should be in the location, not the case? I tried switching it to a field in the location, but the apex trigger now has to be changed to reference it in the new location and I'm not sure how to do that.
Things to check:
- In the Workflow Rule criteria, make sure you select: "criteria are met". And choose the Send Alert from the Field dropdown, then Operator is Equals and value is TRUE.
- In the Email Alert action, make sure an email template is selected and you are the recipient.
You can also enable Debug Log to see what is going on behind the scene
I also temporarily removed the field update for the workflow rule, on the offchance that their was a problem with that. With the field update disabled the checkbox stayed 'true' but I still didn't recieve an email, so there is definately a problem with that part of the proces...I double checked the email template and sent a test and it came straight to me, so that's not it. I have no idea why it's giving me so much trouble!
So now I just need to figure out how to work around these test classes... ;) You m entioned something about going into the test classes and fixing lines? Any pointers on where to start with that? I really appreciate all of the help, this project has definately been more of a headache than I first suspected it would be!
If it is too much, you can take a shortcut by unchecking the Required box, deploying the changes, then checking it back. However, this has to be done when people are not using Salesforce (down-time) to make sure nobody is entering an invalid record.
and this is my code it is referencing:
Can you point me in the right direction of what I will have to fix? I should be able to do the other ones by myself if I can just get the general idea of what I'm trying to do here.
The Required checkbox is in the Short Name field (when you click Edit). I believe it is one of the Account custom fields.
It seems that the problem comes from a Workflow Rule for the SVMXC Installed Product object. I can't see what it is doing, though, so it's hard to tell you what to do. Perhaps you can just deactivate the workflow during deployment and reactivate it back after. However, test it first to make sure that the workflow is the cause of the problem.
The apex trigger is imported, and it's running just how we needed it too. *sigh* that was quite the process. Thank you so much for your help. I'm almost afraid to ask this last question...but would you be willing to direct me to where I can figure out how to insert a hyper link into these auto generated emails that will take the reciever directly to the location referenced? If not its no biggie. You've literally saved me days of frustration. Thank you so much for all of your help! ;)
Are you referring to the link of the Case or the Location object? If it is the Case, in you template merge field, select the Detail Link. It will give you the URL of the Case record. However, it will be tricky for the Location object. You will probably have to create your own link. Something like: https://<instance>.salesforce.com/{!Case.Location__c}. Replace the <instance> with your org na number (e.g.: na23). And if you are using a different field, replace the Location__c with the other field's name.
and this is what it is coming out as:
The location is coming through fine, but the link is not populating correctly
https://na15.salesforce.com/{!SVMXC__Site__c}