Hi..
I am creating rules for a folder. I want a JavaScript function to be executed when creating a file. Where do I add this JavaScript function?
Solved! Go to Solution.
Hi,
You need create xxx.js with your function inside Repository->Data Dictionary->Scripts folder.
Create rule : Select Folder: Manage rule->Create New rule with following parameter.
Name : Provide rule name
Define rule : Select relevant option from dropdown.
Perform Action : Select execute script and choose your created xxx.js file.
Other Options: Select relevant option.
Thank you very much.. This work very well!
I have followed all these steps that you told me. Apparently the script I select doesn't run. Please check.
My file is called GravityForm.js with this content
function traer(){
var user = "Luis";
var name ="Diaz";
alert("Nombre: " + user + " Apellido: " + name);
$.ajax({
type: "POST",
url: "http://localhost/alfresco/index.php/wp-json/gf/v2/workflow/webhooks/10/Fytn4QUNj9XWrzcvRzAPG79CB",
data:{Nombre:user, Apellido:name},
success: function(data)
{
alert ("Muy bien");
}
});
} // Cierra de la funcion TRAER
traer();
The rule is created this way
I add the GravityForm.js file in the /Repository/DataDictionary/Script directory
This does not run. I tested this code in a local installation and it works fine. Also try printing only one value like this console.log ("Test"); and it doesn't work either. I want it to run when a document is created.
Thank you
Hi,
You can not call ajax from rule script as it is server side script.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.