How to use "rbf_setLookupFilter", instead of main-link-lookup. I have a page with two lookupfields "customer" and "contact". I want to filter "contacts" with the value of "customer". Something like this: " var cust=rbf_getFieldValue("customer"); rbf_setLookupFilter('contact', 'customer', cust); " But when should this script be processd: OnChange(Customer) or OnChange(Contact) or ? or ?. And how can I delete this filter? Can I use rbf_setLookupFilter in GridControls?
Yes, you can do something like this (tested in my environment):
var x = rbf_getFieldValue("R893531");
rbf_setLookupFilter("R893508", "R893517", x);
Execute this script on change of lookup value. To clear filter - use empty values.
Please note that all relationships names are different, so make sure you're using correct ones. This probably will not work in Grid.
However it may be much easier if you edit your Contact lookup field and set "Main lookup" and "Link lookup". This feature was designed for the cases like yours.
Is it possible to filter using date-fields?
* If yes, can you give me an example (date-format etc)
is it possible to have many filters attached?
Is it only possible to set one filtervalue?
or
Can we also set filtervalue as for example "from-to"?
Can you please answer this question:
* Is it possible to filter on field on multiple values?
If I try to set multiple filters on one field it seems like the second filter, clears the first filter.
It have been great to have the possibility to set a filter with a sql-query!!
rbf_setLookupFilter(fieldname, filterName, filterValue)
This function sets filter to selection of related records for lookup field. Method can be used for dynamic filtering of available lookup choices. Parameters:
• fieldName: integration name of lookup field
• filterName: name of field on related object used for filtering
• filterValue: only records with field's value equal to filterValue will be displayed
Example:
rbf_setLookupFilter('R12345', 'club_menber', 'true');
This call will ensure that selector window (opening on R12345 lookup field) only displays records with value of club_menber field equals to 'true'.
Important: This function cannot be used on dependent lookups. This function only apply for "Selector" style lookup fields.