How do I make lookup field values change based on the source value being changed?
When I change the source value the lookups and their values within other applications do not change.
How do I make lookup field values change based on the source value being changed?
When I change the source value the lookups and their values within other applications do not change.
The values in the look-ups only change when you update them by either pressing the “Lookup” button again on the GUI, or by updating them via API.
To successfuly solve your issue, you will have to use the Get Records and Update Records API.
You will first have to set the look-up, so it retrieves a unique key from the source. This doesn’t have to be saved into the look-up field itself, and can be mapped into the other fields of the app instead. For example, the record number of the source app should be a unique key that you could use.
After that’s set up, run the app.record.edit.submit.success event on the look-up source app, which is an event that runs when the record successfuly saves. The event should give back details of the app, including the key field.
Next, use the Get Records API to find records that are related to the look-up source. Use the key field that you just received into the query of the Get Records API (so, you’ll be getting all records that hold the same key field value, from the app that has the look-up). The retrieved records are the records you will need to update. Note their Record Number.
Proceed to use the Update Records API to update the look-up fields of all records with the same Record Number you retrieved earlier.
Note that though, if you are working on apps where you would have to look through and update thousands of records, this process will take more time, and may feel a bit clunky since it will run every time you save.
Check to see if your issue can be resolved with a Related Records field first before diving into customizion.
API sources:
Record edit event: https://developer.kintone.io/hc/en-us/articles/213149017/
Get Records API: https://developer.kintone.io/hc/en-us/articles/213149287/
Update Records API: https://developer.kintone.io/hc/en-us/articles/213149027/