How to build a customization for a end-user to create a new record based on a Lookup field?

I have the challenge about lookup , how could i create new record in lookup field when the record is not existed in referenced field???

Hello @Mpumuro ,

Thank you for posting your question on our Kintone Developer Forum.

To better help you out, please provide more information regarding your current situation, question, and desired outcome.

If you want to learn more about the Kintone’s lookup field, check out these articles:

Hello there
I do want to customize lookup field to end user can create new record without setting from referanced record

Hi @Mpumuro,

I am not sure if this fits your needs, but I have found a similar sample on a Japanese page.

The environment is “TypeScript.”

The following code describes the process of unmasking a field in the change event handler of a Check box field.

When the record edit screen is displayed, the mask is returned by determining the check status of the check box, but it might be better to return it in the event before the record is saved.
The information on changed fields can be retrieved via event.changes.field.

The sample app has a Check box field, a Lookup field, and a Text field(address) as the “Field Mappings” of the Lookup field.

'use strict';
interface KintneEvent {
  record: kintone.types.SavedFields;
  changes: any;
}
kintone.events.on(['app.record.edit.change.checkbox'], (event: KintneEvent) => {
  const checkbox = event.changes.field;
  if(checkbox.value.length !== 0) {
    event.record.address.disabled = false;
  } else {
    event.record.address.disabled = true;
  }
  return event;
});
kintone.events.on(['app.record.edit.show'], (event: KintneEvent) => {
  const checkbox = event.record.checkbox;
  if(checkbox.value.length !== 0) {
    event.record.address.disabled = false;
  }
  return event;
});

Here are some reference articles for this process;

Record Edit Event:

Fields That Can Be Specified for “Field Mappings”:
https://get.kintone.help/k/en/id/040546.html

I hope this helps you in some way.

2 Likes

Thanks let me check if it will help me

Hello there,
Does kintone keyword supported in Typescript?

Kintone does not directly support customizations written in TypeScript.

Instead, you would need to use a module bundler such as Webpack or VITE to convert your TypeScript into a browser-supported JavaScript build. Then you can upload that into Kintone, just like regular JavaScript customization.

If it is your first time with TypeScript and module bundles, a simple alternative would be using an online TypeScript to Vanilla JS (plain JS) converter such as this one.

Or you can check out our latest workshop, where we used VITE and TypeScript to build a simple Kintone Customization.

Kintone x Medium Workshop

1 Like