...
Code Block |
---|
<html><head><title>devicerowidExample</title><script type="text/javascript">
function onSaveJSON() {
return "[{\"action\":\"select\",\"invoke\":\"updateDSDeviceRowId\",\"parameters\":[{\" modulefields\": [ { \"module\":\"2\", \"fields\":\"uid,devicerowid\"} ],\"filter\":\"2.uid=$2.uid\"} ] } ]";
}
function updateDSDeviceRowId(rows) {
var jsonscript = "[";
if(rows.length > 0){
jsonscript += "{\"action\":\"update\",\"module\":\"2\",\"uid\":\"" + rows[0]._2.uid + "\",\"fields\":[ { \"field\":\"CONTTXT01\", \"value\":\""+rows[0]._2.devicerowid+"\"} ], \"upsync\":\"yes\", \"filter\":\"2.uid ="+rows[0]._2.uid+"\" }";
}
jsonscript += "]";
return jsonscript;
}
function onErrorInvoke(rows){
if(rows.length > 0){
window.location="melt://showAlert:"+ rows[0].message;
}
}
</script></head><body></body></html>
|
2. Writing the openExternalApp Function
...
An example of the complete code for the openExternalApp function, with header and footer information, is as follows.
...
Code Block |
---|
<html><head><title>Example External App</title><script type="text/javascript">
function openExternalApp(rows) {
var externalAppURL="http://localhost/Test.html";
externalAppURL+="?ContFrstName="+rows[0]._2.CONTFIRSTNAME; externalAppURL+="&ContLstName="+rows[0]._2.CONTLASTNAME;
externalAppURL+="&PresRowId="+rows[0]._2.CONTTXT01; externalAppURL+="&Id="+rows[0]._2.uid;
return "[ {\"action\":\"goToURL\",\"noescape\":\"true\",\"url\":\"" + externalAppURL + "\"} ]";
}
</script></head></html>
|
In this example, note the following key points:
...