Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The Contacts module is available.
  • A Web container (for example, nodejs) is available, which can listen for HTTP requests. 

Preserving the DeviceRowID

...

  1. Start the Admin application.
  2. Click Map Settings, and then select Module Settings on the vertical application bar.
  3. Click More next to the Contact module, click JavaScript, and then select Add JavaScript Code.
  4. 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>