Dear community.
Using Alfresco Process Services I wonder whether I could have costom outcomes based on conditions.
Example:
In a form a user provideds the expected price for something that has to be ordered. If the value is not above 10.000€ the user should get an outcome buttom labelled Send to A. If the value is > 10.000€ an outcome buttom labelled Send to B should be provided.
Is there a way to achieve this just by front end scripting (without implementation)? The modelling interface doesn't seem to provide functionality for this.
Best regards
Marco
Solved! Go to Solution.
Hi Greg.
It seems to be a Browser issue. If I use button.textContent instead of button.innerText it works. I use Firefox 38.4.0.
Here the code I use:
Event: formRendered
var buttons = angular.element(document.getElementsByClassName("activiti-btn"));
for(var i = 0; i < buttons.length; i++){
var button = buttons[i];
if(button.textContent == "OUTCOME 1" || button.textContent == "OUTCOME 2"){
button.disabled = true;
}
}
Event: formFieldValueChanged
Add a javascript function to the formFieldValueChanged event to disable the second "outcome" button if the value entered is < 1000.
e.g.
var buttons = angular.element(document.getElementsByClassName("activiti-btn"));
for(var i = 0; i < buttons.length; i++){
var button = buttons[i];
button.disabled = false;
if(button.innerText == "OUTCOME 2" && field.value < 10){
button.disabled = true;
}
}
I have attached a simple app example.
Cheers,
Greg
Hello Greg.
Thank you very much!
I understand what the script does and wonder why it doesn't work in my environment. We run Alfresco Process Services 1.6.0.
Best regards
Marco
no, unfortunately not
What version are you running? I built this with 1.6.1
Alfresco Process Services 1.6.0
I get both of the outcome buttoms whatever value (number) is choosen.
Marco
Hmm,
Certainly workign in 1.6.1.
Try adding the following to the formRendered event to disable both outcomes until such time as you enter something.
var buttons = angular.element(document.getElementsByClassName("activiti-btn"));
for(var i = 0; i < buttons.length; i++){
var button = buttons[i];
button.disabled = true;
}
Also, the class name may have changed between 1.6 and 1.6.1 so make sure the buttons are actually being found (add a debugger statement to ensure all 4 buttons are matched).
Greg
Hi Greg.
It seems to be a Browser issue. If I use button.textContent instead of button.innerText it works. I use Firefox 38.4.0.
Here the code I use:
Event: formRendered
var buttons = angular.element(document.getElementsByClassName("activiti-btn"));
for(var i = 0; i < buttons.length; i++){
var button = buttons[i];
if(button.textContent == "OUTCOME 1" || button.textContent == "OUTCOME 2"){
button.disabled = true;
}
}
Event: formFieldValueChanged
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
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.