Sunday, June 23, 2019

Ability to find the latest send message from user

Find the latest send message from the user and in order to achieve this she search message record and add "messagedate" as filter and need to set "true" on the setSort method to sort in descending order 

var columns = new Array();
columns[0] = new nlobjSearchColumn('subject');
columns[1] = new nlobjSearchColumn('internalid');
columns[2] = new nlobjSearchColumn('messagedate').setSort(true);

var filters =  new Array();
filters[0] = new nlobjSearchFilter( 'recipientemail', null, 'is', '')

var searchresults = nlapiSearchRecord( 'Message', null, filters , columns);
if (searchresults != null && searchresults != '') {
var emailinfoid = searchresults[0].getValue('internalid');

var emailinfosubject = searchresults[0].getValue('subject');

No comments:

Post a Comment