I am new in alfresco and I create a rule that execute a javascript file when a file arrives in a directory (My javascript it inside data dictionnary script file). However, this javascript script must send a http get request to a remote server but I can not use the alfresco remote. Can you suggest a solution? Thank you
My javascript code:
function main() {
var name = document.name;
var username = "";
var msgContent = "";
var siteName = document.siteShortName;
var firstName = person.properties.firstName;
var lastName = person.properties.lastName;
if (siteName == null) {
if (logger.isLoggingEnabled())
logger.log("Erreur");
return;
}
if (firstName != null) {
username = username + firstName + " ";
}
if (lastName != null) {
username = username + lastName;
}
msgContent = username + " a ajouté un nouvel élément de contenu " + name + " au site " + siteName;
if (logger.isLoggingEnabled()) {
logger.log(encodeURIComponent(msgContent));
}
var connector = remote.connect("gedrepportremote");
var result = connector.get("/api/sendSMS?siteName=" + encodeURIComponent(siteName) + "&msgContent="+encodeURIComponent(msgContent));
if (result.status == 200) {
return JSON.parse(result);
} else if (result.status == 403) {
} else {
return null;
}
}
main();