What could I be doing wrong?

What could I be doing wrong?

  

The following error appears, I cannot determine the source of the problem. Help appreciated.

Here is the reported error:

Id:
dc188395-761f-4472-a944-d607c37813ee
Time of Log:
2016-12-04 21:20:27
eSpace:
ToDo
Tenant:
Users
User:
 (119)
Session Id:
No session
Server:
PRS68871LT98369
Module:

Message:


[N7ACWL025].DBO.[OSUSR_WJL_PROJECT] with key 507 was not updated


Environment InformationeSpaceVer: 274 (Id=574, PubId=577, CompiledWith=10.0.105.0)
RequestUrl: https://hansvankeulen.outsystemscloud.com/ToDo/screenservices/ToDo/MainFlow/Projects/ssUpdateProject (Method: POST)
AppDomain: /LM/W3SVC/28/ROOT/ToDo-397-131253599105178054
FilePath: C:\OutSystems\Sandboxes\N7ACWL025\Platform Server\running\ToDo\
ClientIp: 94.231.245.219
Locale: en-US
DateFormat: yyyy-MM-dd
PID: 91324 ('w3wp', Started='10/31/2016 8:37:08 AM', Priv=885Mb, Virt=18402Mb)
TID: 254
Thread Name:
.NET: 4.0.30319.42000
Stack:
[N7ACWL025].DBO.[OSUSR_WJL_PROJECT] with key 507 was not updated
   at ssToDo.ExtendedActions.UpdateProject(HeContext heContext, BitArray usedFields, RCProjectRecord inParamSource)
   at ssToDo.ScreenServices.ToDo_MainFlow_Projects_Controller.<ssUpdateProject>b__1(HeContext heContext, String screenName, JObject screenModel, JObject inputParameters)

Are you doing an UpdateRecord or a CreateOrUpdateRecord? If you're trying to update and it doesn't exist, erros will occur.


Solution

Often when you see that, it means that something like this happened:

1. You created a record and got the ID.

2. An exception occurred, which rolled back the transaction that created the record.

3. You ignored the exception, then tried to do something (in this case, an UPDATE, but usually it is a GET) on the record with the ID that you got in step 1, but the record doesn't exist because the exception rolled it back.

J.Ja

Solution

Both were true in partly. Actually I found Local Storage Id's and the server database ID's not being in sync.

CreateOrUpdate (creating new entry) using the same 'local source' to both resulted in CreateOrUpdate... returning a different ID then CreateOrUpdateLocal.... This was first time I noticed this. I guess after some creations and deletions this was bound to happen at some point.

I now use the result from CreateOrUpdate... to modify the source (or mapping) before calling CreateOrUpdateLocal....


Thanks for the suggestions - at least they started me looking in the right place.