# Script on server giving odd results

**URL:** <https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088>\
**Category:** Questions\
**Tags:** server\
**Created:** [April 11, 2024, 3:40pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088 "2024-04-11T15:40:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JasonMark](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@JasonMark](https://the.fmsoup.org/u/JasonMark)\
**Post date:** [April 11, 2024, 3:40pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/1 "2024-04-11T15:40:45Z")

</div>

UPDATE: I downloaded one of the databases and ran restore and it said:

> 2024-04-11 11:42:10.733 -0400 SPS.fmp12 8495 WARNING: problems were detected while recovering the database. The recovered file should NOT be used going forward; copy only the most recent work from it into a backup copy of the original file.

Does this mean I have to go back through backups to find a non-corrupt database for both of my clients and then do some crazy imports? LOTS of changes have been made to both of them (scripts, database fields, data, a new table in one case) over the past couple of weeks.

Is this the most likely place to start for the issues outlined below? Or could there be something else? I'm uploading the recovery log to this. It's pretty sparse on what's actually wrong.

[Recover.log.zip](https://the.fmsoup.org/uploads/short-url/zrJcCIJ239uQuhGO5wiLgoksEvV.zip) (40.3 KB)

Looks like both the database have ONE error in them as well as a warning not to use the recovered database:

> |2024-04-11 11:42:10.733 -0400|SPS.fmp12|8495|WARNING: problems were detected while recovering the database. The recovered file should NOT be used going forward; copy only the most recent work from it into a backup copy of the original file.|  
> |2024-04-11 11:53:05.165 -0400|OA Success Center Tracker.fmp12|8495|WARNING: problems were detected while recovering the database. The recovered file should NOT be used going forward; copy only the most recent work from it into a backup copy of the original file.|  
> |2024-04-11 11:52:59.371 -0400|OA Success Center Tracker.fmp12|8487| Reset table view|  
> |2024-04-11 11:42:04.791 -0400|SPS.fmp12|8477| Calculation modified|  
> |2024-04-11 11:42:04.791 -0400|SPS.fmp12|8476| This item changed|  
> |2024-04-11 11:52:59.385 -0400|OA Success Center Tracker.fmp12|8476| This item changed|

* * *

**Original Notes**  
I've spent many hours trying to debug a whole bunch of scripts that recently started failing on two of my clients sites on the same host. This started happening shortly after (but not immediately after) updating to Filemaker server FM 20.3.2.205. There are lots of oddball issues, but I'm focusing on a very simple one first. When I run this script locally or server, and get vastly different results:

```auto
Go to Layout [“Student_Detail” (Student) ; Animation: None]
Set Variable [$SASID ; Value: Get(ScriptParameter)] 
Set Error Capture [On]
Perform Find [Restore] // Student::SASID = $SASID

```

I call this through a stub script and pass in SASID (unique ID) via script parameter. When I run it locally using this command, it finds 1 result and works fine.

`Perform Script [Specified: From list ; “UpdateSingleStudentFromSASID” ; Parameter: Get(ScriptParameter)]`

When I run it on the server using this script it fails with a 509 error (_Field requires a valid value_) and doesn't perform the find.

`Perform Script on Server [Specified: From list ;“UpdateSingleStudentFromSASID” ; Parameter: Get(ScriptParameter) ; Wait for completion: On]`

**Things I've tried:**

- Restarting server (this was my first step, but I might try it again)
- Exiting script with debugging info:

```auto
Exit Script [Text Result: Get(LastError) & " " & $SASID & " FoundCount: " & Get(FoundCount) & " Record Number: " & Get(RecordNumber) & " Last Error: " & Get(LastError) & " ScriptParameter: " & Get(ScriptParameter)]

```

- Removing the find criteria
- Walking through steps

```auto
Enter Find Mode [Pause: Off] 
Set Field [Student::SASID ; Get(ScriptParameter)] 
Perform Find []

```

- Setting a different field
- Bypassing using the variable $SASID instead of setting the field to Get(ScriptParameter)
- Using Perform Find [Restore] and setting the Student::SASID to $SASID instead of using "Set Field" command
- Using $SASID directly in "Perform find" instead of Set Field
- Adding a 1 second delay after "go to layout"
- Checking permissions (the server returns my username and "[Full Access]"

Any advice/thoughts appreciated. I'm going to download the database and run the repair on it, but it's happening to two different databases on the same server.

---

<div class="post-metadata">

**Author:** ![FileKraft](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/filekraft/32/1183_2.png) [@FileKraft](https://the.fmsoup.org/u/FileKraft)\
**Post date:** [April 11, 2024, 3:46pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/2 "2024-04-11T15:46:50Z")

</div>

try it passing the same script parameter as in the 'normal' version as "Student::SASID"

---

<div class="post-metadata">

**Author:** ![JasonMark](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@JasonMark](https://the.fmsoup.org/u/JasonMark)\
**Post date:** [April 11, 2024, 3:50pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/3 "2024-04-11T15:50:16Z")

</div>

I'm not following? I pass the same parameter when running locally or on server.

---

<div class="post-metadata">

**Author:** ![FileKraft](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/filekraft/32/1183_2.png) [@FileKraft](https://the.fmsoup.org/u/FileKraft)\
**Post date:** [April 11, 2024, 3:53pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/4 "2024-04-11T15:53:08Z")

</div>

> [@JasonMark](#):
>
> Perform Script on Server [Specified: From list ;“UpdateSingleStudentFromSASID” ; Parameter: Get(ScriptParameter) ; Wait for completion: On]

this should be using the same script parameter as your call executed on client

---

<div class="post-metadata">

**Author:** ![JasonMark](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@JasonMark](https://the.fmsoup.org/u/JasonMark)\
**Post date:** [April 11, 2024, 4:01pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/5 "2024-04-11T16:01:31Z")

</div>

Oh right, good call.. I went back and forth on that. They do match now and same error happens. I'll update above.

---

<div class="post-metadata">

**Author:** ![FileKraft](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/filekraft/32/1183_2.png) [@FileKraft](https://the.fmsoup.org/u/FileKraft)\
**Post date:** [April 11, 2024, 4:08pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/6 "2024-04-11T16:08:19Z")

</div>

restart the server - purge all temp files and good luck!

---

<div class="post-metadata">

**Author:** ![JasonMark](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@JasonMark](https://the.fmsoup.org/u/JasonMark)\
**Post date:** [April 11, 2024, 5:27pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/7 "2024-04-11T17:27:32Z")

</div>

KK thanks.

---

<div class="post-metadata">

**Author:** ![JasonMark](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@JasonMark](https://the.fmsoup.org/u/JasonMark)\
**Post date:** [April 18, 2024, 7:43pm UTC](https://the.fmsoup.org/t/script-on-server-giving-odd-results/4088/8 "2024-04-18T19:43:13Z")

</div>

So the problem seems to be a record which has a required field that's required, but blank. This has been the case for a while, but it just started happening. Locally I get a warning and can ignore it, but the server doesn't ignore it even if it's set to allow users to bypass it.
