In email plugin script, how to find the display na...
# ask-stanley-ai
v
In email plugin script, how to find the display name of the sender
c
AI generated answer (using internal Slack threads):
In order to find the display name of the sender in an email plugin script, you would need to use the
getSender()
method from the
nlobjEmail
object. This method returns the email address of the sender. However, to get the display name, you would need to perform a search on the
entity
record type using the email address as a filter. The display name can then be obtained from the search result. Here is a sample code snippet:
Copy code
javascript
var email = nlobjEmail.getSender();
var filters = [];
filters[0] = new nlobjSearchFilter('email', null, 'is', email);
var columns = [];
columns[0] = new nlobjSearchColumn('entityid');
var searchresults = nlapiSearchRecord('entity', null, filters, columns);
if (searchresults != null && searchresults.length > 0) {
    var displayName = searchresults[0].getValue('entityid');
}
In this code,
nlobjEmail.getSender()
is used to get the email address of the sender. A search is then performed on the
entity
record type using the email address as a filter. The display name (entityid) is then obtained from the search result. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.815064311
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.812962
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810260892
Please provide your feedback on this answer.