Create automatic follow up tasks for Quotes?

Hi All,

I am trying to create an automatic follow up task when a new quote is created. A developer created a table script but it doesn't work, I actually can't see anything happening in the log myself, not sure how to tell if it's being logged properly. He now is not responding to me at all, so I've given up and hope that you guys can help me tweak it and get it working. Here's the table script, can you see anything wrong with this?

function InsertRecord()

{

// Handle insert record actions here

}


function PostInsertRecord()

{

intid = CRM.getContextInfo('company','comp_companyid');

personid = CRM.getContextInfo('person','pers_personid');

opporec = CRM.FindRecord('opportunity',WhereClause);

var d=new Date();
d.setDate(d.getDate() + 3);

var CmLiRec;
var CommRec;

var CompRec=CRM.FindRecord("Company","Comp_CompanyId="+intid);

var PersRec=CRM.FindRecord("Person","Pers_personid="+personid);

var OppoRecs=CRM.FindRecord("Opportunity","Oppo_Opportunityid="+opporec);

if ( (CompRec.Comp_PrimaryUserId +""!="undefined") && (CompRec.Comp_Name !="Costco Online UK Ltd" && CompRec.Comp_Name !="Amazon Orders" && CompRec.Comp_Name !="Amazon Orders - SPAIN" && CompRec.Comp_Name !="Amazon Orders - ITALY" && CompRec.Comp_Name !="Amazon - GERMANY" && CompRec.Comp_Name !="Amazon Orders - FRANCE" && CompRec.Comp_Name !="EBAY Order" ))

{

CommRec=CRM.CreateRecord("Communication");

CommRec.Comm_Action='NewEnquiry';

CommRec.Comm_opportunityid=opporec.oppo_opportunityid;

CommRec.Comm_Type='Task';

CommRec.Comm_Status='Pending';

CommRec.Comm_channelid=1;

CommRec.Comm_note="Please get in contact with "+CompRec("comp_name");

CommRec.Comm_Priority='Normal';

CommRec.Comm_DateTime = d.getVarDate();

CommRec.SaveChanges();

CmLiRec=CRM.CreateRecord("Comm_Link");

CmLiRec.CmLi_Comm_CommunicationId=CommRec.Comm_CommunicationId;

CmLiRec.Cmli_Comm_CompanyId=intid;

CmLiRec.Cmli_Comm_PersonId=personid;

CmLiRec.Cmli_Comm_UserId=opporec.oppo_assigneduserid;

CmLiRec.Cmli_Comm_NotifyTime = d.getVarDate();

CmLiRec.SaveChanges();

}


}


function UpdateRecord()

{

// Handle update record actions here

}


function DeleteRecord()

{

// Handle delete record actions here

}