Usage of Display business rule with Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 04:18 AM
Hi,
Can Display business rule be used alone or it has to be used always with g_scratchpad variable in it and corresponding onLoad client script to call the scratchpad variable?
can you help here?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2023 04:02 AM
@Sharique Azim The use of BR is to fetch the data from database while client scripts cannot communicate with database directly. So when or if you need something from database on page load and want to prepopulate in the fields then you can get use of Display BR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 04:28 AM
Hi Rama,
If you want to send some information from server to client then you can use g_scratchpad in Display Business rule. You can also perform server side actions when the form gets loaded.
For example: onLoad of the page based on some condition you can show message like gs.addInfoMessage() in display rule.
The purpose of having display business rule is to avoid ajax call on the load of form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 04:29 AM
Hi Rama,
Short answer yes.
refer all the links provided by others.
Regards,
Shariq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 04:49 AM
Thanks all for the reply.
To summarize my understanding:
a) onLoad client script uses the values of the fields on the current form (visible or hidden) present on the UI and performs the logic (like show messages etc..)
b) display business rule (without scratchpad) uses the values of other form (not current) and performs the logic to present the form on the UI.
c) display business rule (with scratchpad). to call the scratchpad variable value in client.
For point no (c), can you show some practical scenario that the value from database required to be used/shown on the current form. Since, we have reference fields like cmdb_ci, task, related record. these data can be fetched through the client script using getReference method.
Is there any other case that will be requiring data of reading data from other forms from server/database?
Using getReference have limitations that only the fields referenced for the current form can only be used through this?
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 04:59 AM
Hi Rama,
A small clarification to your understanding
"
a) onLoad client script uses the values of the fields on the current form (visible or hidden) present on the UI and performs the logic ON Client side just after loading(on browser only) (like show messages etc..)"- This cannot make any data manipulation on the record saved on the server.
"
b) display business rule (without scratchpad) uses the values of other form (not current) current form and performs stores the value or the logic to as variable to be used later by a client (browser) present of the current form on the UI.
"
For point no (c), can you show some practical scenario that the value from database required to be used/shown on the current form.
"
-Say we need to find user group memberships, we cannot do it from client script(unless gliderecord), then we can use a BR to find the user memberships by var g_scratchpad.variable =gs.getUser().isMemberOf('Group')); and then calling it in onload script by var value= g_scratchpad.variable; etc..
"Using getReference have limitations that only the fields referenced for the current form can only be used through this?" - if there is no relation between two table, how would you ever get values of the other table?
Regards,
Shariq