Selecting from selected related records

Posted by matman on 01-Sep-2014 08:44

I have have been trying to figure something out for a while now and I can't help but to feel that there's no standard way in reaching my goal. After creating a relationship between my team and teammember object (1:M) and adding teammembers to a team, I'm trying to appoint a teammember to teamleader. My first way of doing so was by creating a 1:1 relationship between team and teammember so I can choose a teammember from the list. However, I can now also choose players that aren't even part of the team. Do I need to use a custom selectquery() to reach this goal? Kind regards, Matthijs

Posted by Godfrey Sorita on 01-Sep-2014 09:44

Hi matman,

You can use rbf_setLookupFilter AJAX API to filter the records in your selector.

On the edit page of team object, paste the code below on a script component:

<script>
$(function() {
  var fieldName = 'R108189403',         //relationship integration name of team and team leader
    filterName = 'R108189389',          //relationship integration name of team and team member
    filterValue = parseInt('{!id}');
  rbf_setLookupFilter(fieldName, filterName, filterValue);
});
</script>

Please check Chapter 7 of Rollbase User's Guide for more information on Rollbase AJAX APIs.

Regards,

Godfrey

All Replies

Posted by Godfrey Sorita on 01-Sep-2014 09:44

Hi matman,

You can use rbf_setLookupFilter AJAX API to filter the records in your selector.

On the edit page of team object, paste the code below on a script component:

<script>
$(function() {
  var fieldName = 'R108189403',         //relationship integration name of team and team leader
    filterName = 'R108189389',          //relationship integration name of team and team member
    filterValue = parseInt('{!id}');
  rbf_setLookupFilter(fieldName, filterName, filterValue);
});
</script>

Please check Chapter 7 of Rollbase User's Guide for more information on Rollbase AJAX APIs.

Regards,

Godfrey

Posted by matman on 02-Sep-2014 05:40

Isn't there a way to reach this by creating a new view and applying a filter? I haven't found any solution in the documentation pages though. I was thinking about using something like [Teammember] [Is one of], but I'm not able to use the object ID.

Posted by Godfrey Sorita on 02-Sep-2014 09:37

I don't recommend using views and filters to resolve this issue because you will have to create multiple views(depending on the number of teams), and use rbf_setViewSelector() to set the view ID of a lookup.

Posted by matman on 03-Sep-2014 02:26

Thanks a lot, I managed to get it to work using your code!

This thread is closed