cityofaustin / knackpy

A Python client for interacting with Knack applications
https://cityofaustin.github.io/knackpy/docs/user-guide/
Other
39 stars 18 forks source link

Update connected field value #104

Closed elrezad closed 2 years ago

elrezad commented 2 years ago

Hi all, First of all, thanks for this wonderful package. I'm using Knackpy to create records on a knack's db. Everything works (slowly, but it works), except one thing: I'm not able to assign a value to a connected field, remaining always blank.

I have two db, "db.Projects" and "db.Docs" (ID: "object_6"). dbProjects has a field "Project Code" that connects with db.Docs.

Let's say one of the "Project code" values is "ATM001", with internal ID "6221efc2f1a20c001e957bc7" .

On db.Docs, the connected field shows as (obtained from a manually entered record):

"field_36":"<span class=\"6221efc2f1a20c001e957bc7\">ATM001</span>", "field_36_raw":[{"id":"6221efc2f1a20c001e957bc7","identifier":"ATM001"}]

So far I've tried (none of them working)

  1. data["field_36"]="ATM001"
  2. data["field_36"]="6221efc2f1a20c001e957bc7"
  3. data["field_36"]="<span class=\"6221efc2f1a20c001e957bc7\">ATM001"
  4. data["field_36_raw"]=[{"id":"6221efc2f1a20c001e957bc7","identifier":"ATM001"}] (and then creating a new record with: app.record(method="create", data=data,obj="object_6")

Any idea of which is the correct way of doing this, or any turnaround?

Thanks!

=== UPDATE === I'm now able to update the connected field value on a second step. So first I create the record (method="create") and then I update the values (method="update"). It will take twice the time, but... it works.

elrezad commented 2 years ago

Sorry, it was a bug on my program, it didn't use the field name instead of the internal field name ("field_36").

Regards,