Open sam-nolan-tearfund opened 11 months ago
"the timezone of the salesforce organization" - there's no such thing. Timezones are by user, not organization (the timezone on the Company Information page is the default for the following user created). If there were a change in the error notification code, it would be based on the user who ran the job, not an organization-wide setting.
Ah ok, that makes sense, Sorry I'm somewhat new to salesforce. So simply calling .format()
on the datetime would correctly format it in the timezone of the user who scheduled the job? I'd be happy with that as well.
I can't actually find documentation on the default "toString()" of datetime, so I assume that must format to GMT unlike .format
?
Would you like me to submit a PR for that change?
Welcome to Salesforce @sam-nolan-tearfund - while NPSP is technically open source, employees rarely engage here and haven't encouraged or accepted PRs for a long time. I am not a Salesforce employee or maintainer of this repo, but I follow it.
You may be better off submitting an Idea on the Idea Exchange: https://ideas.salesforce.com/s/search#t=All&sort=relevancy&f:@sfcategoryfull=[Nonprofit%7CNonprofit%20Success%20Pack]
You can also post in the Trailblazer Community. The error handling has been in NPSP for years, so given the new attention on Nonprofit Cloud and this is not business-breaking, this might not be something that will get prioritized anytime soon. Why is it important that the date/time in the email match the UI? Just curious. :-)
Ah, understood. It's not super important to me, it's just something that deceived me, made me think something happened at 1am rather than a few minutes ago when I was debugging. I imagine has a very small cost of fixing and is very unlikely to break anything, so I thought I would look out for fellow NPSP users that may get fooled by that as well.
I maybe incorrectly assumed this was a "proper" open-source project that would be accepting PRs for bug fixes, in which case this would be a fairly normal workflow. IdeaExchange definitely feels like a strange place to put a very specific bug with a known solution, especially considering it's in no way business critical and I'm just doing a tiny effort to look out for others. I probably won't post there. Maybe this issue can be left open as a reminder for the next salesforce developer to come along and patch it? Do what you want with this.
Whenever I get emails for salesforce npsp problems, the error date appears to be printed in GMT regardless of the timezone of the salesforce organization:
They appear correctly in the salesforce interface:
This seems to be caused by this section of code: https://github.com/SalesforceFoundation/NPSP/blob/53157c1b1528c73a07e379fff72a07a3a2803739/force-app/main/default/classes/ERR_Notifier.cls#L335-L339
I'm happy to contribute a fix, as I'm sure it would be very trivial.