Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sam-nolan-tearfund opened this issue Nov 6, 2023 · 4 comments

Comments

@sam-nolan-tearfund
Copy link

sam-nolan-tearfund commented Nov 6, 2023

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:

String body = '\nError Type: ' + error.Error_Type__c;
body += '\nError Date: ' + error.Datetime__c;
body += '\nMessage: "' + error.Full_Message__c + '"';

I'm happy to contribute a fix, as I'm sure it would be very trivial.

@judisohn
Copy link
Contributor

judisohn commented Nov 6, 2023

"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
Copy link
Author

sam-nolan-tearfund commented Nov 6, 2023

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?

@sam-nolan-tearfund sam-nolan-tearfund changed the title NPSP error dates are printed in UTC rather than Salesforce Timezone. NPSP error dates are printed in UTC rather than scheduled user's timezone. Nov 6, 2023
@judisohn
Copy link
Contributor

judisohn commented Nov 6, 2023

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants