Skip to content

Instantly share code, notes, and snippets.

@YoannArasLab
Last active December 1, 2017 17:29
Show Gist options
  • Save YoannArasLab/54c11526acb173917a400708014eef6b to your computer and use it in GitHub Desktop.
Save YoannArasLab/54c11526acb173917a400708014eef6b to your computer and use it in GitHub Desktop.
onAfterGet Method for inter-Aras Instance federation
// Retrieve Local Innovator instance
Innovator inn = this.getInnovator();
// make connection
HttpServerConnection foreignAras = IomFactory.CreateHttpServerConnection("http://localhost/InnovatorServer","InnovatorDBName", "<loginName>", "<md5password>");
Item login = foreignAras.Login();
// test if login succeeded
if (login.isError()) {
// if failed return Error
return inn.newError("Couldn't Login to external Aras database");
} else {
// retrieve existing items
Innovator innext = IomFactory.CreateInnovator(foreignAras);
Item ExternalCustomers = innext.newItem("customer","get");
ExternalCustomers = ExternalCustomers.apply();
// append foreign results to local result set of items
for (int i = 0; i < ExternalCustomers.getItemCount();++i ){
ExternalCustomers.getItemByIndex(i).setProperty("_external","yes");
this.appendItem(ExternalCustomers.getItemByIndex(i));
}
// return full result
return ExternalCustomers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment