Advanced Relationship
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2023 03:11 AM
Hi All,
Can someone explain or give some examples on apply to and query from script section in advanced relationship?
Below is my requirement.
1. I have configuration item reference field in the plan[sn_bcp_plan] form. and it will list only Business services and Business Application records.
2. I need a related list in form to show related fields of Business Services and Business Application.
3. Can we achieve this using one relationship? instead of creating to 2 different relationships based on the Query from table. If yes, could you please suggest me the solution.
Thanks
Yashaswini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 03:03 AM
I checked other relationships with flag "Advanced" set to true and I also checked the tool tips given.
When "Advanced" flag is enabled, the "Apply to" script is meant to return 'true' if it shall be applicable to the current record. One example I found was:
answer = ('cmdb_ci_storage_server' == table_name);
So there is a predefined variable 'table_name' you may use to verify if the relationship is applicable or not.
The script given in "Query from" must set the variable 'answer' to the name of the table you would like to build the relationship with.
answer=cmdb_ci;