使用脚本二次开发Sage CRM.ppt
文本预览下载声明
* * * * * * * * * * * * * * * * * * * * * * * * Sage: Scripting for Sage CRM: Using JScript Expressions and Operators Use online references for complete description /en-us/library/hbxc2t98.aspx See resource CD for electronic Help documentation Sage: Scripting for Sage CRM: Using JScript Statements in JScript A program is a sequence of statements Expression Statements Any expression that can stand alone as a statement is an Expression statement strMessage = “hello world”; myBlock = eWare.GetBlock(“noteboxlong”); Compound Statements curly brackets Consider if(eWare,Mode=View) strMessage=“Hello World”; eWare.Mode=Edit; //second line will ALWAYS run And if(eWare,Mode=View) { strMessage=“Hello World”; eWare.Mode=Edit; } //both lines of code treated as single unit Sage: Scripting for Sage CRM: Using JScript Functions and Parameters Typical Example used in Screen Custom Content. Interacts with onChange script this.value = checkCase(this.value) Functions can be instantiated from strings via new Function constructor in JScript. functionName = new Function( [argname1, [... argnameN,]] body ); var myRecord = eWare.FindRecord(myscripts,scrp_scriptid=217);var obJScript = new Function(x,myRecord.scrp_text);Valid = false;ErrorStr = obJScript(test);This has basically the equivalent of creating the function like this:function obJScript(x){return x.toUpperCase();} Either use a custom entity to stored the scripts or make use of a table like the custom_captions var obJScript = new Function(x,eWare.GetTrans(“customscripts”,”myscript”));Valid = false;ErrorStr = obJScript(test); Sage: Scripting for Sage CRM: Using JScript Using with “with” can simplify the code written var myBlock = eWare.GetBlock(CustomBlock); with(myBlock) { FormAction = mypage.asp; DisplayButton(Button_Default) = true; ButtonTitle = Click me; } var myBlock = eWare.GetBlock(CustomBlock); myBlock .FormAction = mypage.asp; myBlock.DisplayButton(Button_Default) = true; myBlock.Bu
显示全部