...
- The Contacts module is available.
- A Web container (for example, nodejs) is available, which can listen for HTTP requests.
Preserving the DeviceRowID
...
- Start the Admin application.
- Click Map Settings, and then select Module Settings on the vertical application bar.
- Click More next to the Contact module, click JavaScript, and then select Add JavaScript Code.
- Select onSave from the Type drop-down list, and then enter the onSave JavaScript code.
...
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> |