Reputation: 11
I developed a schedule script to send emails. while I click "save and execute" on the schedule script it is not sending any emails even to the "logged in user" and I tested the same script using user event which is able to send emails to the "logged in user".
Upvotes: 0
Views: 1471
Reputation: 235
This is encountered when the Email Preference of the sandbox account is set to Send Email To Logged In User. This can be found by navigating to Setup > Company > Email Preferences > Sandbox and Release Preview.
When the nlapiSendEmail is executed in a debugger, the system is able to get the currently logged in user and the email is received. But when this API is executed in a scheduled script, the lines of code are being placed in a queue and no "logged in user" can be determined. This is why the email is not received.
Emails can be received when executing nlapiSendEmail in a scheduled if the Sandbox account set the Email Option to a specific email address.
i hope this is helpfull
Upvotes: 1
Reputation: 8847
Scheduled Scripts do not run as any particular user. You will have to choose which user the Scheduled Script should send the email as, and pass the internal ID of that user to nlapiSendEmail
.
Upvotes: 1