Get value from more than Fields to one filed in the same doc

I need to collect values from some fields and put them in one field type Text in the same document i used

cur_frm.add_fetch(link_field, source_fieldname, target_fieldname);

but it’s only get value of one field

We need to see some more code to provide better feedback. My guess is you’re looking for something along the lines of frm.set_value() example here.

Dear @tmatteson
Thanks for your response

i have some custom fields in the event doc called (client - course name - Facilitator ) I need to collect all the values of those fields and put them in the description field it’s a standard field and has Text type

Hello @Alaa_Badri, I think you want to do a database lookup with frappe.client.get_value and set it with frm.set_value(). Try writing this as a custom script and then post your progress here.

Start with this:

frappe.ui.form.on("Event", {
    refresh: function(frm) {
       x = frappe.client.get_value( ... enter your lookup argumentss here ... ) // you may need one of these for each of client, course and facilitator
       frappe.set_value("description", x);

Dear @tmatteson
Do you mean mysql select statement for look up

This is in the documentation.

There’s a SQL one too, but honestly, you’re better off using the native helper functions and not involving three languages to solve your problem when you can do it in one.

Dear @tmatteson
Thanks for your help

i try this

frappe.ui.form.on(“Event”, {
refresh: function(frm) {
facilitator = frappe.client.get_value(Event, facilitator)
frappe.set_value(“description”, “facilitator”);

but i got this console error

Cannot read property ‘get_value’ of undefined

also i use this script but also not working

frappe.ui.form.on(“Event”, “client”, function(frm, cdt, cdn){{
“method”: “frappe.client.get_value”,
args: {
doctype: “Event”,
fieldname: “client”,
filters: {
name:[“=”, frm.doc.client]
callback: function (data) {
cur_frm.set_value(“description”, data.client);


@Alaa_Badri First things first, you’re making a lot of new javascript programmer mistakes (that I have also made myself, so don’t feel bad) but I think that you should take a course to reinforce some of the places you’re going wrong.

This is a different problem:

This is because your get_value arguments aren’t finding anything. When I get this error, 95% of the time it’s my fault because I’ve entered bad arguments, the other 5% is because I’m looking for a document that doesn’t exist. Both of those problems return “undefined” which is the framework basically saying “I can’t find what you’re looking for.”

Keep trying, you’re close.

Dear @tmatteson
First i’m sorry for my mistakes but i’m new in javascript programing
and i try this

frappe.ui.form.on(“Event”, {
refresh: function(frm) {
facilitator = client.get_value(“Event”, “name”, “facilitator”)
frappe.set_value(“description”, facilitator);

i got this error

client is not defined

Second what about the second script

can we use it in our case

I don’t know what’s in your name variable, but again, you don’t want to search for the string “name”, which is why I guessed you’re looking for the client’s name: frm.doc.client.

Dear @tmatteson

The same error