Skip to content

Instantly share code, notes, and snippets.

@mephistoc
Created December 6, 2018 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mephistoc/2903b992f8ece71732f1d9c8109ce182 to your computer and use it in GitHub Desktop.
Save mephistoc/2903b992f8ece71732f1d9c8109ce182 to your computer and use it in GitHub Desktop.
Trigger an Auto Lookup every 10 seconds in eForm #AgilePoint
/*
* Auto trigger an Auto Lookup every 10 seconds.
* 2018-Dec-07, Vincent Chu, AgilePoint Taiwan
*/
// Wire round-robin schedule on form load completed.
eFormEvents.onFormLoadComplete = function ()
{
setInterval(TriggerPIRAutoLookup, 10000);
}
function TriggerPIRAutoLookup(){
var options = {fieldId: 'ReadFrontDoorPIR'};
var fieldOpts = {fieldId: 'FakeParameter'};
// Modify hidden field which been use as fake parameter to the Auto Lookup which will be trigger.
// Same Auto Lookup won't be trigger, so it would need to make some difference.
eFormHelper.getFieldValue(fieldOpts, function(res){
eFormHelper.setFieldValue({fieldId: 'FakeParameter', value: res.data += 1}, function(resres){
debugger;
console.log(resres);
});
});
eFormHelper.triggerAutoLookup(options, function(result){
if (result.isSuccess){
console.log(result.data); //logs the data holds the empty object
}
else{
console.log(result.error); // logs the hold exception object
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment