SalesforceFoundation / NPSP

The current version of the Salesforce.org Nonprofit Success Pack
http://www.salesforce.org/nonprofit/nonprofit-success-pack/
BSD 3-Clause "New" or "Revised" License
623 stars 362 forks source link

NPSP error dates are printed in UTC rather than scheduled user's timezone. #7208

Open sam-nolan-tearfund opened 11 months ago

sam-nolan-tearfund commented 11 months ago

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: image

They appear correctly in the salesforce interface: image

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.

judisohn commented 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.

https://salesforce.stackexchange.com/questions/26951/is-there-a-default-timezone-in-which-date-fields-are-stored-in-salesforce

sam-nolan-tearfund commented 11 months ago

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?

judisohn commented 11 months ago

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. :-)

sam-nolan-tearfund commented 11 months ago

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.