VIES
From Sage CRM Knowledge Base
http://ec.europa.eu/taxation_customs/vies/
var myMailObject = CRM.GetBlock("Messageblock");
with (myMailObject){
DisplayForm = false;
var strEmailId=new String(ctQueueRec.ctqu_data1);
if(strEmailId=="" || strEmailId=="undefined")strEmailId="";
if(strEmailId!=""){
var strSubject=new String(ctQueueRec.ctqu_data2);
if(strSubject=="" || strSubject=="undefined")strSubject="";
var strBody=new String(ctQueueRec.ctqu_data3);
if(strBody=="" || strBody=="undefined")strBody="";
mSubject =strSubject;
mBody =strBody;
AddRecipient(strEmailId,strEmailId,"TO");
Mode = 2;
//CRM.AddContent(myMailObject.execute());
if (true){
var RecordComm = CRM.CreateRecord("Communication");
RecordComm.comm_action="EmailOut";
RecordComm.comm_status="Complete";
RecordComm.comm_priority="Normal";
RecordComm.comm_type="Task";
RecordComm.comm_to=strEmailId;
RecordComm.comm_email=strBody;
RecordComm.comm_subject=strSubject;
RecordComm.comm_note=strSubject;
RecordComm.comm_datetime=executiondate.getVarDate();;
RecordComm.SaveChanges();
var RecordComm_Link = CRM.CreateRecord("Comm_Link");
RecordComm_Link.CmLi_Comm_CommunicationId=RecordComm.comm_communicationid;
RecordComm_Link.CmLi_Comm_UserId=1;
var ipersonId=new String(ctQueueRec.ctqu_data4);
if(ipersonId=="" || ipersonId=="undefined")ipersonId=0;
if(ipersonId!=0)
RecordComm_Link.CmLi_Comm_PersonId=ipersonId;
//RecordComm_Link.cmli_comm_companyid=strCompanyId;
RecordComm_Link.SaveChanges();
Response.Write("done"+ipersonId);
}
else{
Response.Write("There has been a problem: "+mErrorMessage);
}
}
}