Some guidelines to avoide Time out errors caused by Table Level Scripts

By | June 21, 2009

For handeling any of your Post Recod insert activity the very first option that comes to your mind is the Table Level Script. You can make use of PostInsertRecord function in order to handle the Post Insert Record activities. It is quites simple to make use of this standard functionality provided by Sage CRM, but still it has some limitations. Suppose you want to query a table data from PostInsertRecord function. Now, for querying the data in this section you cannot make use of SELECT statement as it causes the Time Out errors many times. So instead of this you can get the values by Values() collection method and use them as shown in below example.

function PostInsertRecord()
{
// Handle post insert record actions here
leadId = Values(‘lead_leadid’);

StrSql = “UPDATE Lead SET lead_assigneduserid = 3, lead_channelid = 3 where lead_leadid = ” + leadId;

eWare.ExecSql(StrSql);
}

Well, this is just the case of PostInsertRecord function, while in case of UpdateRecord function you can query table data by using SELECT statement. Here also you can avoid the possibilities of the crashing Errors by making use of the WhereClause to get the current record ID instead of Values or GetContextInfo methods(see the example below).

function UpdateRecord()
{
// Handle update record actions here
StrSql = “SELECT lead_source from lead where “+ WhereClause;
LeadRec = eWare.CreateQueryObj(StrSql);
LeadRec.SelectSql();

StrSql = “UPDATE Lead SET lead_source = ‘Email’ where “+ WhereClause;
eWare.ExecSql(StrSql);
}

If you find this useful, Please drop us a mail on crm@greytrix.com.