Proposal summary
Swyft would like to implement a CRM Email Capture upon sending an Email from a salesperson to contact.
Requirement
Swyft needs to store email messages in NetSuite under the corresponding Opportunity, Prospect record and Contact record when the Salesperson sends an email through Gmail to Contact.
Key Points
- The email sync job should allow emails to be synced back to an opportunity record in NS. The only way to do this is to have the opportunity ID within the email body or subject (To be decided by Swyft). For example, the email subject/body always starts with [opp: 1234] or similar.
- Once the job parses the email and identifies the relevant opportunity, the email message and attachment will be linked to all 3 records – opportunity, the corresponding prospect, and contact (if available).
- If the opportunity ID is invalid or if the email does not contain any pattern to identify the opportunity, then the email will be linked to the prospect and contact record that match with the To, CC fields.
- In the above step, if the job finds multiple prospects or contacts available for the same email (rare but valid case), then the email will be linked to each of the prospects and contacts that matched.
Our Solution
Prerequisites
– Swift needs to grant the permission to Customer and message record
- Navigate to Setup > Users/Roles > Manage Roles
- Edit the Custom role Swyft_Implementation_External
- Go to Permissions Tab
- Click Setup
- Click Lists
- Add Customers and set the Access Level to Edit/Full
- Add Track Messages and set the Access Level to Edit/Full
- Click Save
– Upon sending the mail from Salesperson to Contact use cc as Email capture plugin Email id
– Opportunity ID should be included within the email body or subject (To be decided by Swyft). For example, the email subject/body always starts with [opp: 1234]
Email Capture Plug-in General details
Email Capture Plug-in can be used to define NetSuite behavior based on the properties and contents of an inbound email message. When NetSuite receives an email sent to an email address associated with an implementation of the plug-in, NetSuite executes the business logic defined in the implementation.
We need to create a SuiteScript with one function that must accept an “email”. This function is mandatory for all Email Capture plug-in implementations and is called automatically by NetSuite when an email is sent to the email address associated with the plug-in implementation.
“Email” is an object that represents an email message sent to the Email Capture plug-in implementation. The methods available to the “email” object for header attributes are date sent, subject, body (text and HTML). There are also methods to access “addresses” attributes (name and email address) and “attachments” (name, type and value).
We can have multiple Email Capture plug-in implementations active in a single account.
The email address is the address associated with the plug-in implementation that appears on the Manage Plug-ins page. This same email can be used by all users to allow capturing of emails.
Description of the task
We need to complete the implementation setup and need to deploy the script which captures the email and creates a message record in order to associate it with the Lead/prospect/customer record.
This requirement can be achieved by using an email capture plugin. We will complete the implementation setup and create an email capture plugin email id in the Swyft netsuite account . This email id should be used as “cc” when the Salesperson sends an email through Gmail to Contact. The email can be synced back to an opportunity record in NS, if the opportunity ID is within the email body or subject (To be decided by Swyft).
It will create a trigger in Netsuite and that trigger can be captured in a script. The script will create a message record under Lead/Prospect/Customer(Entity) and Contact record that contains an email in the standard email field as same as the recipient email address on the email. Also that message record will be added to the Opportunity record if Email Subject/Body starts with the Netsuite Opportunity Unique Identifier.
Example of using email capture plugin email id as “cc” when sending gmail from a salesperson to Contact is shown in below screenshot. The email subject/body always starts with [opp: 1234]
Below screenshot represent example of message record is attached to Contact record
- The email message and attachment will be linked to all 3 records – opportunity(IF identifies the relevant opportunity), the corresponding prospect, and contact (if available).
- If the opportunity ID is invalid or if the email does not contain any pattern to identify the opportunity, then the email will be linked to the prospect and contact record that match with the To, CC fields.
- In the above step, if the job finds multiple prospects or contacts available for the same email (rare but valid case), then the email will be linked to each of the prospects and contacts that matched.
If we can find an Opportunity Id, then we can add it to the Opportunity as well as its Prospects even if the email address is not matching with the Email address on the Prospect record. Also, we can add it to the Contact based on the email address match on Contact Record and email.
Note
- Without file attachments, normal speed of message record creation will be between 1-60 seconds. It may vary due to some external factors such as internet speed, netsuite account etc.
- Attachments file types accepted are .jpg, jpeg, png, pdf
We can fetch the files that are supported by Netsuite. If any of the attached files are not supported by Netsuite, then they will not be received in NetSuite Plugin so that we cannot recreate that message in Netsuite. The files such as CSV, Excel, and Powerpoint can be retrieved on Plugin. However, we will process the file creation within an error handling module. So in case, the file creation fails due to any unexpected content(unsupported strings), then will create the message by skipping Files.
- The size of the email content and file should be less than 10 MB.
- Distribution email also can be captured in Netsuite. But need to ensure that the Plugin mail id should be included in the Distribution List
Risk:
- Email that are sending without CC to the plugin email cannot be captured
- As per the current proposal, we have considered that, Swift will either use a common structure for email subjects to include the Opportunity ID or the email message should start with Opportunity ID
- Speed of message record creation in NetSuite will be dependent on the attachment file size. If the file size is high, message record creation time will be increased.
- The maximum size of an email that can be captured is 25,000,000 bytes (25 MB). The maximum size of an individual attachment in an email is 10 MB. If the size of the email is more than that, then that message will not be recreated in Netsuite since we cannot get that trigger in Plug in.
- The email id used by salesperson and contact in gmail, must be the same as email id in netsuite employee record or contact record. Then only message records can be attached to an entity record on a netsuite account.
- Reply from the lead cannot be captured if the lead sends the reply without the Plugin CC email.
- If the lead replies to all, then that trigger will get in the Netsuite. however, that can be added only as a separate message record. And we cannot attach it to the Opportunity Record if the Unique Identifier is going to be included in the email Body. Otherwise, the common format needs to be followed by the sender also(message should be started with Opportunity ID). However, it cannot be assured from the customer side. So in that case, we can add it into the Entity Record instead of Opportunity
Regarding the Opportunity identification, if it is included in between predefined special characters set, we can find Opportunity ID by considering the string that is enclosed within special characters. We will have to look into the last set string to assure that we are not taking any content from the message. So we can identify and attach the message to the corresponding Opportunity
- We assume that the email will be normal mail with some text message content. If swyft is using any templates with a styled layout, then the feasibility of recreating that in the netsuite message record needs to be confirmed. This is not included in this scope.
- The Plug-in will not be applied to previously received emails (prior to plugin being set to active)
Discussions
I’ve reviewed the updated proposal. Looks like we’re headed in the right direction. A few follow up questions about the highlighted parts below, before I send it up for approval.
1. “It will create a trigger in Netsuite and that trigger can be captured in a script. The script will create a message record under Lead/Prospect/Customer(Entity) and Contact record that contains an email in the standard email field as same as the recipient email address on the email. Also that message record will be added to the Opportunity record if Email Subject/Body starts with the Netsuite Opportunity Unique Identifier”
Ensuring that the understanding of the order of executing this is correct. If opportunity ID is present in the email, the mail is attached to 1) the opportunity, then 2) the corresponding prospect (irrespective of whether the prospect email address matches with the addresses in the incoming email), and then 3) the contact (if available)
If we can find an Opportunity Id, then we can add it to the Opportunity as well as its Prospects even if the email address is not matching with the Email address on the Prospect record. Also, we can add it to the Contact based on the email address match on Contact Record and email.
2. “Attachments file types accepted are .jpg, jpeg, png, pdf”
What happens for other attachment types? Will the sync fail OR will only the attachment be ignored? Are MS Office file types not supported?
We can fetch the files that are supported by Netsuite. If any of the attached files are not supported by Netsuite, then they will not be received in NetSuite Plugin so that we cannot recreate that message in Netsuite. The files such as CSV, Excel, and Powerpoint can be retrieved on Plugin. However, we will process the file creation within an error handling module. So in case, the file creation fails due to any unexpected content(unsupported strings), then will create the message by skipping Files.
3. “If the lead replies to all, then that trigger will get in the Netsuite. however, that can be added only as a separate message record. And we cannot attach it to the Opportunity Record if the Unique Identifier is going to be included in the email Body. Otherwise, the common format needs to be followed by the sender also(message should be started with Opportunity ID). However, it cannot be assured from the customer side. So in that case, we can add it into the Entity Record instead of Opportunity”
Let’s assume the opportunity pattern [opp:1234] is used near the signature in the original email sent by the Swyft sales team. If the lead responds to that email, won’t the pattern be still available in the email body text of the trail mail? Why will that not be readable? That way you can identify which opportunity the reply belongs to. Like we discussed, it’s ok if the reply is a separate message and not shown like a thread in NS.
Regarding the Opportunity identification, if it is included in between predefined special characters set, we can find Opportunity ID by considering the string that is enclosed within special characters. We will have to look into the last set string to assure that we are not taking any content from the message. So we can identify and attach the message to the corresponding Opportunity