Busines forms data link error

  • What Grafana version and what operating system are you using?

    • Grafana v13.0.1+security-01 (9bbe672d1)
  • What are you trying to achieve?

    • To register data in a SQL Server database from business forms.
  • How are you trying to achieve it?

    • I click on a data link to select a code, and it assigns it to a variable. Then I use this variable in the form, fill in the fields, and save.
  • What happened?

    • When I click on the data link, the variable updates correctly with the selected value.
    • The variable filters values ​​in a query, and the query values ​​are used as the initial values ​​for the business form field.
    • The problem is that the data it retrieves is not the correct value returned by the query, and for this reason, the field displays a different value.
  • What did you expect to happen?

    • The query works; it filters the value and displays it correctly. The field populated by that query should show the same value, but it shows a different one.
  • Can you copy/paste the configuration(s) that you are having problems with?

Welcome @oscarqrt
Remove the early return statement
The return; in Custom Code was preventing everything below it from executing.

Map Initial Fields correctly

Form Field Query Field
Codigo A:CodTarea
Tarea A:TareaDesc
Horas A:TiempoReportado

Make sure your query alias matches the prefix used (e.g. A or A_update)

Fix the Update Request

From The Builder mode Switch to Code mode and use:
sql

UPDATE your_table
SET 
    TareaDesc = '${payload.TareaDesc}',
    TiempoReportado = ${payload.TiempoReportado}
WHERE CodTarea = ${payload.CodTarea}

Variable Filter

Make sure your Business Forms query uses the variable correctly:

sql

SELECT CodTarea, TareaDesc, TiempoReportado
FROM Tareas
WHERE CodTarea = ${selectedCode}


Form showing correct values after clicking data link

Thank you so much for reproducing the problem; your suggestion works perfectly.

I was listing all the dashboards with this issue to apply the recommended solution, but I was surprised by a Business Forms update.

[6.3.5] - 01/06/2026
Fixed
The issue where form values ​​lagged behind the selected variable when updating the dashboard, even with data synchronization enabled, has been resolved.

This saved a lot of time. Thank you so much!