please share business rules scenarios

sasikiran9900
Kilo Explorer

please share definition of business rules and scenarios of after,before, async and display for interview  level.

18 REPLIES 18

Ragini Kukade
Kilo Guru

Hi,

Example of before business rule:

Start date cannot be greater than end date

Compare start and end date using BR, before inserting record

(function executeRule(current, previous /*null when async*/) {
//if(current.u_project_end_date != ''){
var start_date=current.u_project_start_date.getGlideObject().getNumericValue();
var end_date = current.u_project_end_date.getGlideObject().getNumericValue();
if(start_date > end_date)
{
gs.addInfoMessage("Start date cannot be greater than end date");
current.setAbortAction(true);
}
//}
})(current, previous);

 

Example of After business rule:

if the requirement is like that in   attendee table if record is inserted for any event then the count of attendee in marketing event table should be increases then we have to use after business rule on attendee   table.

 

 

 

 

Example of Async business rule 

 

  • When a parent is closed, close all children
    • This operation could take a while, it is best to return control to the user immediately and work in the background

 

 

Example of Display business rule :

 

Let's say you are posting a question on community and community is your service now instance

 

 

 

First, I need to check that you not posting
any offensive materials. I can have a before rule to check that. According to
the rules setup by me, either allow or disallow the posting of the question
(Transaction).

 

 

 

Second, after you have passed the rules of
posting and posted the question successfully. Someone opens up your question
and likes your question. I need to award you points once the like is
successful. I can have a after business rule to set this up.

 

 

 

Third, you will need to get email trigger
when someone comments on your question. It does not need to be immediate. I can
have a async rule to trigger the email.

 

 

 

Finally, I need to update the number of views
of your question. I can have a display business rule to update the counter
related to your question ..

 

 

Mark it as correct/helpful,if you find it helpful

Regards,

Ragini

Ragini Kukade
Kilo Guru

 

Hi,

Can you mark answer correct and close the thread so others can easily find the solution by looking at your thread.

Thanks.

Ragini Kukade
Kilo Guru

Hi,

If above information was helpful to you,

Mark it correct and close the thread 

so others can easily find the solution from your thread

Thanks.

Service_RNow
Mega Sage

Hi,

Please follow the link it's helpful for you :

How business rules work

 

Thanks