Functions in a Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2018 07:11 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2018 08:44 AM
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;
}