Forum Discussion

MatthewStafford's avatar
MatthewStafford
Qrew Member
16 hours ago

User Focus Table Bug - New Record ID not being passed from source table to user focus table

I have a User Focus table that has worked without any issues for nearly a year. Today, a user let me know that records stopped appearing on their end partway through the day (the API_RunImport call needs to work for them to see the records on their end once created). The first 12 records they created worked fine, then suddenly, new records stopped behaving as expected.

After some investigation, I found that the problem is due to the Record ID (RID) from the source table not being written to the User Focus table. This breaks the subsequent API_RunImport, since there is no RID to tell the import which record to merge with. The workflow was still working fine earlier today, then stopped without any changes being made.

Context:

I am the only builder for this app and no one else has access to change fields or formulas. 

No recent changes have been made to the fields involved. I have run several tests, but the RID ([Record ID#]) is consistently not being passed through anymore.

All other fields are still being written correctly to the User Focus table.

Workflow Summary:

User creates a new record in the Immature Plant Batches table.

A Formula-URL button is clicked, which triggers the logic below and reloads the form. The form is set to auto-save when redirected.

Here is the relevant portion of the formula:

var text ProductionAddUser = URLRoot() & "db/" & [_DBID_USER_FOCUS] & "?act=API_AddRecord"
 & "&_fid_6=" & ToText(User())
 & "&_fid_118=" & URLEncode([Record ID#])
 & "&_fid_119=" & URLEncode([Plant - Strain])
 & "&_fid_143=" & URLEncode([IMPB - Next Immature Plant Batch Suffix - Production]);

var text ProductionEditUser = URLRoot() & "db/" & [_DBID_USER_FOCUS] & "?act=API_EditRecord"
& "&key=" & ToText(User())
& "&_fid_118=" & URLEncode([Record ID#])
& "&_fid_119=" & URLEncode([Plant - Strain])
& "&_fid_143=" & URLEncode([IMPB - Next Immature Plant Batch Suffix - Production]);

var text ProductionEditOrCreateUser = If([Current User - User Exists?], $ProductionEditUser, $ProductionAddUser);

var text RunProductionImport = URLRoot() & "db/" & [_DBID_IMMATURE_PLANT_BATCHES] & "?act=API_RunImport&ID=14";

var text NewProductionBatch = URLRoot() & "db/" & Dbid() & "?a=API_GenAddRecordForm&dfid=15"
& "&_fid_57=" & URLEncode([Related Scheduled Task])
& "&_fid_77=" & URLEncode([Related Planned Harvest])
& "&_fid_17=" & URLEncode(Today())
& "&_fid_8=" & URLEncode([Related Planned Harvest - Location])
& "&ifv=1&hs=1" & "&z=" & Rurl();

var text ProductionBatch = $ProductionEditOrCreateUser
& "&rdr=" & URLEncode($RunProductionImport)
& URLEncode("&rdr=" & URLEncode($NewProductionBatch));

$ProductionBatch

Again, everything except for the RID from the source table not getting passed and written to the user focus table anymore. Without that RID, the import fails to find a matching record to merge.

Has anyone experienced something similar recently? Or does anyone have ideas why [Record ID#] might suddenly stop resolving mid-day when it was working previously?

Thanks in advance for any insight. I am really stumped here.

3 Replies

  • The first thing to check is that you have to make sure that the button is which the user is clicking is only being shown in view mode, or possibly view and edit mode. But certainly not add mode. If they push the button in add mode, then it's gonna write a blank record ID to the user focus table.

    • MatthewStafford's avatar
      MatthewStafford
      Qrew Member

      Hi Mark,

      Thanks for the quick reply. Unfortunately, this is on a Add Record form as the workflow requires users to create the recorded the time the formula is run, so edit/view mode is not an option for this workflow.

      I understand that is not ideal, as that the RID is not generated until the record is saved/created, however, this has not stopped this button/the formula I posted from functioning without issue from July 2024 until mid-day today (over 2,000 records have been processed this way in that time). Up until mid-day today the record would auto save when the button was pressed and the RID would be passed to the user focus table. It just all of a sudden stopped working. 

    • MatthewStafford's avatar
      MatthewStafford
      Qrew Member

      Hi Mark,

      Thanks for the quick reply. Unfortunately, this is on a Add Record form as the workflow requires users to create the record at the time the formula is run, so edit/view mode is not an option for this workflow.

      I understand that is not ideal, as that the RID is not generated until the record is saved/created, however, this has not stopped this button/the formula I posted from functioning without issue from July 2024 until mid-day today (over 2,000 records have been processed this way in that time). Up until mid-day today the record would auto save when the button was pressed and the RID would be passed to the user focus table. It just all of a sudden stopped working.