Set Up Lookup Filter from Javascript

Dear Developers,

As title said, when I on a create page with a Lookup Field, I want to set that lookup Filter manually with javascript instead of setting it up from kintone app settings.

So when user want to lookup, the lookup already display the filtered record as desired, the filter itself should be able to change, dynamically based on a condition that I wrote on javascript.

Is there any way to do that? If so, please let me know.

Thank you in advance!

Hello Afief!


So what I understand, basically you want the Lookup Field to do its job automatically based on the value that you write on a javascript upon creating a record or editing a record.


Then the script can be something like this:

(function() {

"use strict";['',''], function(event) {

var record = event.record;

record['Lookupfield']['value'] = 'XXX'; // Lookup Field Value

record['Lookupfield']['lookup'] = true; // When this is true, it automatically looks up upon the value is entered

return event;




I hope this helps.

Hello, you solution Yuzo Arai, works if the lookup field key match is unique. But if its a lookup for a field that it has not unique values it wont work. Is it possible to make the lookup by the record number internally, but display the name on the lookup? So it always make the lookup?

Thank you

If the record number is available internally as a key, it might work.

However, you cannot edit the value of the look up field with a different value
after you get the value of the lookup field with the record number.

Like your situation, if the lookup field does not have unique values,
you can set the name to a different field by looking up
with the record number and copying to another field.
If you do not want to show the lookup field that includes the record number,
you can hide the lookup field.