You need to sign in to do that
Don't have an account?
d3developer
Toggling Chatter Email Notifications
Is there some way to toggle email notifications via APEX code?
If possible, I'd like to be able to turn them off and on for all users.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Is there some way to toggle email notifications via APEX code?
If possible, I'd like to be able to turn them off and on for all users.
Ok I couldn't leave it alone. What about something like the following. This should get you pretty close to the data you want.
All Answers
If you are talking about the Chatter email preferences are not currently exposed via the API. If you think it is important to expose though, definitely add an idea There is however, a UserPreference, UserPreferencesDisableAutoSubForFeeds, which you might be able to do some fun things with.
If you are talking about general emails, check out DMLOptions.EmailHeader for the ability to manage some email notification on a case by case basis (I already tried it on FeedPosts though).
HTH
Well, I guess I can explain what I am trying to do and you can tell me if it can be done or if there is a better way to do it.
In order to get all of the information I need to build my Admin Charts (http://fwd4.me/IkQ), I query NewsFeed (like Chatter Bubbles). Even if I don't include any WHERE clause, it only gives me items back that are a part of the active user's feed. So, in order to get all the items that are in the feed, I am temporarily subscribing the active user to all other user's feeds and all other objects that I care about.
Whenever someone starts following you, you get an email (if Chatter email is enabled). So I get a lot of emails :)
Right now, I reset the subscriptions to the original list of subscriptions after it is finished executing the query on NewsFeed, so what I'd like to do is temporary disable the emails for the short time that the query is running, since none of the subscriptions are permanent. I would like to leave Chatter email updates enabled in general.
I'm not sure if I can do this via DMLOptions. In the docs it says it only manages the following cases:
* Creation of a new case or task * Creation of a case comment * Conversion of a case email to a contact * New user email notification * Password reset
Does the Chatter email also utilize this?
As an aside, I would like to use a Logger object to follow everything but DevAngel said in the techTalk that records can't follow objects! :smileysurprised:
Do you want to post a code sample and I can see what you are trying to do. As with many things, there is more than one way to skin a cat.
I was re-reading for initial posts and I dont think you will be able to get all posts for all users from the newsfeed. This could potentially be massive amounts of data, and the platform limits that ability.
Ok I couldn't leave it alone. What about something like the following. This should get you pretty close to the data you want.
You are right. I can just query the feed for each of my Sobjects in order to do what I want.
Although this does present the problem of knowing which SObjects are generating feeds. My understanding (I think from something I read in the Dev Zone) is that there is no Describe call by which I can find out whether or not an object has a feed. Is that right?
What does the USERPREFERENCESDISABLEAUTOSUBFORFEEDS field on the User object control? If I set it to True, what behavior will it change?
Although this should probably be on a new thread, I'm pretty sure that disables the subscription for feeds that a user would automatically be subscribed to (at the very least, objects created and/or owned by a user) .