- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2019 02:56 AM
Hi there,
As a MSP, on my companies table I have a related list showing the Business service that company(customer) is consuming. I also have a List collector field (u_services). I want it so when i update the list collector field, it will auto populate the related list.
I believe this needs to be done via scripted business rule. I have m2m relationship between companies and business services currently. I'm not great at scripting so wondered if someone has done this before and has a ready made script to perform this (minus the obvious difference in my field name)?
(I know you can use a related list to add or move records. I am using the list collector so i can report on customers consuming a particular service. for example, i wish to report on incidents closed last week for customers who have our Major incident management service. The incident forms themselves are using the technical business service to describe the issue.)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 03:32 AM
Hi
i figured it out in the end i used script
(function refineQuery(current, parent) {
current.addQuery('sys_id','IN',parent.u_services);
})(current, parent);
and this worked. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2019 09:51 AM
I do not have a plug'n'go script for you.
but under system definition -> Relationships, you can create your own relations which are used to create the related list.
It is fairly straightforward. Select the source table, Select the target table ( items to be queried), setup the query on based on the list collector.
have not been able to test this, but something like the below should get you closer if not all the way 🙂
(
/**
* @param {GlideRecord} current gliderecord used to query target table
* @param {GlideRecord} parent gliderecord for the record that is opened.
*/
function refineQuery(current, parent)
{
current.addQuery('<nameOfField>', 'IN', parent.getValue('<fieldWithListCollector>'/**comma separated string value*/));
})(current, parent);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 01:26 AM
Thanks Asbjørn
so with my list collector field being u_services then the <nameofField> should be u_services? the field with list collector is the same field, though. So would that mean it would be u_services for both entries in that query?
(
/**
* @param {GlideRecord} current gliderecord used to query target table
* @param {GlideRecord} parent gliderecord for the record that is opened.
*/
function refineQuery(current, parent)
{
current.addQuery('<nameOfField>', 'IN', parent.getValue('<fieldWithListCollector>'/**comma separated string value*/));
})(current, parent);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2019 03:32 AM
Hi
i figured it out in the end i used script
(function refineQuery(current, parent) {
current.addQuery('sys_id','IN',parent.u_services);
})(current, parent);
and this worked. Thanks