js:
// alert(Department);
var url = "/bpm/app.nsf/WF_RunRule?openagent&RuleNum=RUC0003_01&Department=" + Department ;
Ext . onReady ( function ( ) {
Ext . Ajax . request ( {
method : 'POST' ,
url : url ,
success : function ( reps ) {
var data = Ext . util . JSON . decode ( reps . responseText ) ;
var EBS_Department = document . getElementById ( "EBS_Department" ) ;
var EBS_ID = document . getElementById ( "EBS_ID" ) ;
var EBS_OU_ID = document . getElementById ( "EBS_OU_ID" ) ;
EBS_Department . value = data [ 0 ] . EBS_Department_Name ;
EBS_ID . value = data [ 0 ] . EBS_Department_ID ;
EBS_OU_ID . value = data [ 0 ] . EBS_OU_ID ;
}
} ) ;
});
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
规则:
Sub Initialize
On Error Goto errormsg
'表单最后保存时执行LotusScript代码
msgbox "连接上了..."
dim sql as string,fldLst as new lcfieldList
dim doc as notesdocument
dim EBS_Department_Name as string
dim EBS_Department_ID as string
dim EBS_OU_NAME as string
dim Department as string
dim EBS_OU_ID as string
Department=WF_Document.Department(0)
msgbox "Department="+Department
sql=|select EBS_Department_Name,EBS_Department_ID,EBS_OU_NAME,EBS_OU_ID from OA_EBS_Department where OA_Department_Name='|+Department+|'|
msgbox "SQL="+sql
call rdb.connect()
call WF_Con.Execute(sql,fldLst)
while WF_Con.fetch(fldLst)>0
EBS_Department_Name=fldLst.lookup("EBS_Department_Name").text(0)
EBS_Department_ID=fldLst.lookup("EBS_Department_ID").text(0)
EBS_OU_NAME=fldLst.lookup("EBS_OU_NAME").text(0)
EBS_OU_ID=fldLst.lookup("EBS_OU_ID").text(0)
msgbox "EBS_OU_NAME="+EBS_OU_NAME
msgbox "EBS_Department_Name="+ EBS_Department_Name
msgbox "EBS_Department_ID="+EBS_Department_ID
'json = json + |{"serialno":"|+fldLst.lookup("bm).text(0)+|"},|
' json = json + "{'serialno':'"+fldLst.lookup("bm").text(0)+"'},"
' json = json + "{'serialno':'"+bb+"'},"
' json = json + "{'serialno':'["+bb+"'},]"+"{'Sponsors':'"+ee+"'},"
' json = json + "{'serialno':'["+bb+"'},]"+"{'Sponsors':'"+ee+"'},"
json = json + |{"EBS_Department_Name":"|+EBS_Department_Name+|",|
json = json + |"EBS_Department_ID":"|+EBS_Department_ID+|",|
json = json + |"EBS_OU_ID":"|+EBS_OU_ID+|",|
json = json + |"EBS_OU_NAME":"|+EBS_OU_NAME+|"},|
wend
json = |[|+left(json,len(json)-1) +|]|
print "content-type:application/text;charset=utf-8"
msgbox "lsy="+json
print json
Exit Sub
errormsg:
Msgbox "Rule Error:" & Str(Erl) & " " & Error
End Sub