- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2017 02:47 PM
Hi All,
I have two Sn-record-pickers as follows.
<sn-record-picker field="company" table="'core_company'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>
<sn-record-picker field="location" table="'cmn_location'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>
I was wondering if it is at all possible to have the location filtered by the company, i.e default-query="company.nameSTARTSWITH{{data.company}}". I am stuck as to how I could approach this. Any help would be appreciated.
Thanks.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2017 11:21 PM
Hi
You also need to add a listener to capture when the record pickers are updated
$scope.$on("field.change", function(evt, parms) {
if (parms.field.name == 'company') {
c.data.company_dv = parms.displayValue;
c.data.company = parms.newValue;
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2017 10:35 PM
Hi
Yes that is easy - you do this way:
In your client script you create a object which you bind record picker to
c.company_picker = {
displayValue: c.data.company_dv,
value: c.data.company,
name: 'company'
};
then you bind the comanpy record picker to this object
<sn-record-picker field="c.company_picker" table="'core_company'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>
In your location picker you then reference the value selected in company
<sn-record-picker field="location" table="cmn_location'" default-query="'company.nameSTARTSWITH' + c.data.company_dv" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2017 06:12 AM
Hi thanks for the reply
I tried that method but it appears that the locations record picker does not update dynamically. I'm thinking that the defauly querys syntax might be a bit off. If not ill fiddle around with it again.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 03:45 AM
Thanks, @Lars
But unable to do it. Can you please give me demo or a update set so that it can make me understand.
It will really help me.
Thanks,
Saptashwa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2017 11:21 PM
Hi
You also need to add a listener to capture when the record pickers are updated
$scope.$on("field.change", function(evt, parms) {
if (parms.field.name == 'company') {
c.data.company_dv = parms.displayValue;
c.data.company = parms.newValue;
}
});