I am using simple-salesforce to assign a case to an agent from a Queue. If I do this via the application i have the check box that says "send email notification" as pictured below.
How can i trigger that same option via code using Simple-Salesforce?
Current Case assignment code looks like this and will actually assign the case but does not trigger the email:
case = SFType("Case", session_id, instance)
# Get the actual record Id for the case
case_id = sf.query(f"SELECT Id FROM Case WHERE CaseNumber ='{case_id}'").get('records')[0]['Id']
# Set the Owner Id
update_data["OwnerId"] = tsa_id
case.update(case_id, update_data)
not sure if i can do something like case.send_email(ownerId)
but just wondering if that email trigger is possible.
Best Answer
I actually found a solution that works.
The solution was emailSimple invoke option from here: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_actions_invocable_standard.htm
For the issues on the simple salesforce github page, there was solution at the i used to customize the API to make it easy.
Just add the following method to the simple salesforce api.py file:
and to call it use
SF.invoke_action('emailSimple', {'inputs': [{'emailAddresses': '[email protected]', 'emailBody': 'body 1', 'emailSubject': 'subject 1'}, {'emailAddresses': '[email protected]', 'emailBody': 'body 2', 'emailSubject': 'subject 2'}]})
.The discussion about adding this to simple salesforce and dellsystem's solution can be found here: https://github.com/simple-salesforce/simple-salesforce/issues/163