05-12-2020 07:27 AM
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?
05-15-2020 08:11 PM
05-13-2020 12:08 AM
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.
05-13-2020 07:13 AM
Thank you very much.. This work very well!
05-13-2020 09:15 AM
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
05-15-2020 07:57 PM
Hi,
You can not call ajax from rule script as it is server side script.
Explore our Alfresco products with the links below. Use labels to filter content by product module.