Table Scripting: Difference between revisions
From Sage CRM Knowledge Base
Created page with " This sample shows you how to check if the field has been changed from one value to another function UpdateRecord() { if (Values("case_AssignedUserId")+""=="undefined") re..." |
No edit summary |
||
| Line 3: | Line 3: | ||
This sample shows you how to check if the field has been changed from one value to another | This sample shows you how to check if the field has been changed from one value to another | ||
function UpdateRecord() | function UpdateRecord() | ||
{ | { | ||
if (Values("case_AssignedUserId")+""=="undefined") | if (Values("case_AssignedUserId")+""=="undefined") | ||
return; //bad update from crm..or field not changed | |||
var CaseRec=CRM.CreateQueryObj("SELECT * FROM Cases WITH (NOLOCK) WHERE " + WhereClause); | var CaseRec=CRM.CreateQueryObj("SELECT * FROM Cases WITH (NOLOCK) WHERE " + WhereClause); | ||
CaseRec.SelectSQL(); | CaseRec.SelectSQL(); | ||
if (CaseRec("case_assigneduserid")!=Values("Case_AssignedUserId")) | if (CaseRec("case_assigneduserid")!=Values("Case_AssignedUserId")) | ||
{ | { | ||
ErrorStr="field value has changed from "+CaseRec("case_assigneduserid") +" to "+Values("Case_AssignedUserId"); | |||
} | } | ||
} | } | ||
---- | ---- | ||
Revision as of 13:02, 8 February 2012
This sample shows you how to check if the field has been changed from one value to another
function UpdateRecord()
{
if (Values("case_AssignedUserId")+""=="undefined")
return; //bad update from crm..or field not changed
var CaseRec=CRM.CreateQueryObj("SELECT * FROM Cases WITH (NOLOCK) WHERE " + WhereClause);
CaseRec.SelectSQL();
if (CaseRec("case_assigneduserid")!=Values("Case_AssignedUserId"))
{
ErrorStr="field value has changed from "+CaseRec("case_assigneduserid") +" to "+Values("Case_AssignedUserId");
}
}