码迷,mamicode.com
首页 > 其他好文 > 详细

Siebel script for Pre Events

时间:2014-09-17 18:15:02      阅读:265      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   ar   strong   for   div   

Pre events should only be used for data validation, not manipulation.

such as PreSetFieldValue, PreDeleteRecord and PreWriteRecord

function BusComp_PreWriteRecord () 
{. . . . . .
var cost = GetFieldValue("Cost Price");
var price = GetFieldValue("Price");
var costNum = ToNumber(cost);
var priceNum = ToNumber(price);
if(priceNum < costNum)  
{
    throw "Price should more than cost price!";  
}
WriteRecord();
. . . . }

Consequence

The reason for this is that the pre event occurs before the Siebel application runs field level validations and other processes in the C++ class underlying the object that might fail.  If these processes fail the pre event is exited, but any changes to other objects are not rolled back.

Recommendation

The companion event such as SetFieldValue, WriteRecord and DeleteRecord occurs after the internal and field level validations have succeeded.  In the case of SetFieldValue, remember that the user can still undo the record so the WriteRecord event is the best place to put script that should only execute once a record is committed.

Siebel script for Pre Events

标签:style   blog   color   io   os   ar   strong   for   div   

原文地址:http://www.cnblogs.com/Flamo/p/3977724.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!