The CreatorCon Call for Content is officially open! Get started here.

Using a Variable as a condition on a business rule

NonaJohnson
Kilo Expert

I have been trying to create a business rule using a variable from a catalog form as one of the conditions.   We have a field "employee number" on one of our catalog forms that I need to have mandatory on a task. But . . .   we only want the field to be mandatory for this specific form and only if the field is empty and when they are closing the task.  

Have been able to get it to recognize that the business rule is for a specific form and only if the condition of state changes to closed complete - testing this on other forms where the field is also located works fine.   I can update a task, close the task with no problem, but it does not recognize the condition of "variable" that I found in the related list where you can select what form the "employee number" is on and then set the field to "is empty" (see image below).   Has anyone had any luck using variables from catalog forms on business rules or am I going to have to write an advanced script for this?   Thanks

find_real_file.png

7 REPLIES 7

Hi



Thanks everyone for the suggestions — I would like stay with using a business rule and keep this as simple as possible. Have tried again, but while it will only give me the error message when the employee_number field is empty, it still runs the action I have to set the state to open and active to true - it should only do this if the field is actually empty and not let them close the task until the field is filled in.



The error logs have only had a warning — not sure why its referencing a ui action as I don't have one related to this. Any other suggestions are welcome.



org.mozilla.javascript.EcmaError: Cannot convert null to an object.


Caused by error in UI Action: 'View Original Event' at line 1



==> 1: redirectToOriginalEvent();


2: function redirectToOriginalEvent() {


3: var originalID = current.getValue("parm1").substring(11);


4: var table = current.getTableName();





Thanks


Nona Johnson


larstange
Mega Sage

Hi


Remember to replace "employee_number" with the actual name of your variable


That's what I thought at first too, but actually that is the variable name employee_number. I am still on the sc_task (catalog task) table as well (correct). It does give me your error message when the field is empty or filled in. It does set the abort action of setting the state back to open and active to true (just as I have it set in the actions tab). It is recognizing the When to run conditions for this specific form only, but still does not care if the field is empty/filled



Any other ideas — I did try the table of sc_req_item instead of request_item in the below script, but it didn't make a difference


item.get(current.request_item);



thanks


Nona