WebBlock encapsulates its own logic.What does this mean.

WebBlock encapsulates its own logic.What does this mean.

Hi Remya,

WebBlock is a reusable UI component which can be instantiated inside multiple screen and webBlocks (single or multiple times). WebBlock can't be self instantiated i.e. Service studio will throw a design time error called 'Web Block loop detected on...'

Whatever logic you define within the webBlock is only limited to it's scope i.e. it will act as a block of code (unit) which will be responsible to execute a specific business flow. If you want to pass any value from the current webBlock to the parent screen/webBlock you will have to use the event/notify mechanism. 

Conclusion: You can say that, a Webblock act as a unit, to execute a specific business objective/flow  i.e within itself it wraps-up/encapsulates a set of its own logic/action flow, which can be executed all standalone to fulfill certain objective.


For e.g. 

OOPs concpet - Class Encapsulates data members and functions within itself as a single unit which does have a specific purpose/business to accomplish.


Hope this helps you!


Regards,

Benjith Sam

Solution

This means that web block have everything inside to have its own logical execution.

As you already might know, web block can have input parameters, screen action, preparation, local variables, events and placeholders.

With this you can write your web block logic inside the web block which can be reused as many places as you want.

Say for example, if you have web block for rating stars.You can write your own logic to decide what to do when user clicks 3 stars or 4 stars.

Solution