Functions in a Business Rule

Geeky
Kilo Guru

Can I write a function in business rule and pass a value to it and return something? Or Is it required to use a script include for this? I know script include can be used for routine codes but just wonder if we can achieve it in business rule as well.

In my business rule, I am having different location on a different conditions. Location value could be different for different conditions but logic for scripting a location would be same. Here what I am trying in my BR but its not working.

If ( case 1){

setLocation(var1);}

if (case 2){

setLocation(var2);}

function setLocation(loc)

{

some scripting with loc;

return value;

}

 Any suggestions?

 

5 REPLIES 5

Yes, in your example you could do the following

If ( case 1){

 current.u_my_field = setLocation(var1);}

if (case 2){

current.u_my_field = setLocation(var2);}

function setLocation(loc)

{

some scripting with loc;

return value;

}