Resco: Send Email With Attachment
Introduction:
Resco is a platform that enables users to create apps that are connected to other cloud services like Microsoft Dynamics, Salesforce, or the Resco Cloud.
Resco platform contains a set of components:
RescoCloud : the backend of your system where data is handled.
Application: mobile,desktop,and web client application.
Woodford: a tool that allows you to customize your mobile application.
Other Tools .
In this blog, we‘ll go through all the steps to learn how to send an email with an attachment.
To achieve this, follow the steps given below:
1-First and foremost, the user should enable the entity in order to be seen by the project
2-Create View and form
3-Activate the multi-select button:
In the view, click the MutltiSelect button then you can use pre-defined functions or create a custom command.
3-JavaScript Bridge Code :
you can follow this approach. In our case, we used three functions :
a-Loads the file as base64 string
function loadFileDocumentBody(fileId,fileName){
MobileCRM.DynamicEntity.loadDocumentBody("sf_files",fileId,
function (base64str) {
//To do Work
}, MobileCRM.bridge.alert, null);
}
b- Write the file in the local application folder
MobileCRM.Application.writeFileFromBase64(“Test.pdf”, base64str, function () {}, MobileCRM.bridge.alert);
//base64str = the file body converted in basestring
c-Send Email with attachments
function(attachments: Array<string>) {MobileCRM.Platform.emailWithAttachments( entity.properties.email ??“”,
“Sales Literature”,“ “,
attachments,null, null,
function(errorMsg) {onError(“Email: “, errorMsg);}, null);}
3-Compile typescript code and Upload the Javascript code file as shown below.
4-Then, we added an ‘HTML’ file (with ‘JavaScript’ code) in the “Iframe” of Entity Form of the entity.
Please refer to the below screenshot:
Notes:
In order to send the Email from Resco Mobile App, we need to configure ‘Online Exchange’ (i.e. Outlook) in the Resco Mobile Project.While using ‘Offline Mode’, we need to sync the Resco Mobile App after clicking the ‘Send’ button in order to send an email to the recipient.
For the files storage , They will not get clean unless you uninstall the application. It is a good practice to always use the same file so it will get overwritten each time you use the app or you can delete the file each time directly.
Conclusion
By following these steps you‘ll be able to send emails with documents as attachments through Resco Mobile App.