AnsweredAssumed Answered

Trouble creating/editing more than 1 record in a table, FileMaker to FileMaker, using the Data API

Question asked by Marcus Nilsson on Jan 31, 2019
Latest reply on Feb 1, 2019 by TSGal

Description

Using one call per create/edit record (Insert from URL), the provided field data is consistently pushed into the very first record in the target table.

 

  1. Create a record in the target table = SUCCESS
  2. Create another record in the same target table = FAIL
    1. A new empty record is created but the field data updates the very first record in the target table
    2. The RecordID of the new empty record is returned.

 

  1. Update a record in the target table = FAIL
    1. The very first record in the target table is updated

 

In both cases, no errors are returned. Code is “0” and Message is “OK”.

 

The calls are created according to the documentation at FileMaker 17 Data API Guide, only specifying a record-id when editing a record.

 

Grateful for all sorts of tips.

 

Workaround

Use a script.prerequest to explicitly go to the layout and search out the target record (Edit a record) or show no records (Create a record).

 

Tech

Source

FileMaker Server 17.0.2.203

Windows Server 2016 Datacenter

4-Core

16 GB

82,9 GB free of 99,9 GB

765 KB / 72 GB FileMaker Data API

 

Target

FileMaker Server 17.0.2.203

Windows Server 2016 Datacenter

4-Core

16 GB

84,5 GB free of 99.9 GB

17 KB / 72 GB FileMaker Data API

 

Correct answer

Specifying the full field name (including the TO name) when working with records in the specified layout's table will consistently push the field data into the very first record in that table, for both "Create a record" (POST) and "Edit a record" (PATCH). The former case will also create an empty record in that table.

 

{ "fieldData" : { "PRODUCT::ProductName" : "StillPushingFieldDataIntoTheVeryFirstRecord" } }

 

Simply omit the TO name when entering your key to achieve the desired result.

 

{ "fieldData" : { "ProductName" : "PushingFieldDataIntoTheCorrectRecord" } }

 

Thanks to wimdecorte for providing the correct answer.

Outcomes