Importing to Lookup Field When Duplicate Values Allowed

Setting up an app where I’ll need to import records. 

One of the fields is a “Full Name” field. In the app, it’s a lookup field based on the Full Name field from another app.

In the other app, the Full Name field is a calculated field made up of the First name field and the Last name field.

When I try to import, I get a message “The lookup field is not displayed if the key field for this lookup is allowed to have duplicate values.”

So, I can’t import the names from the CSV file I’m importing.

Any way around this? Looks like there’s no way to prohibit duplicate values in the Full Name field in the second app, which makes sense.

I personally haven’t found a way around this either - I think because of the function of the Lookup Field. A workaround that I created was to use the unique identifier in the lookup app - and pull in the full name into a text field. This allowed us to import the values we needed and the unique identifier will populate in the lookup field instead. 

Not sure if this will work for your particular use-case, but hopefully it’s a useful example. 

Hello James,

The answer from Heather is definitely one way.

Or, you could combine the name using Javascript instead of using the calculated field and then input it in a text field.
That way, you could put a check on the “Prohibit duplicate values” since it’s a text field.

The following is an example of combining the name and inputting it in a field.

(function () {
'use strict';

kintone.events.on(['app.record.create.change.FieldCodeforFirstName','app.record.create.change.FieldCodeforLastName','app.record.edit.change.FieldCodeforFirstName', 'app.record.edit.change.FieldCodeforLastName'], function (event) {

var record=event.record;

let strA=record['FieldCodeforFirstName']['value'] ||"";
let strB=record['FieldCodeforLastName']['value'] ||"";
var str=strA+strB;

record['FieldCodeforFullName']['value'] =str;

return event;
});

})();

I hope this helps.

Cool, thank for all the suggestions, folks! Happy to work in Kintone! Will try to update with whatever it is I implement that works :slight_smile:

Ended up just making my own calculated field with JS. Gets the answer solved for now. Thanks!