281
Views
5
Comments
Solved
Cannot read properties of null (reading 'dataType')
Question
Application Type
Mobile
Service Studio Version
11.53.12 (Build 61157)

I want to update a single attribute in local storage from a text field in the UI

However I keep getting the same "Cannot read properties of null" with whatever approach I take


I have a very simple flow of

  1. User enters value in text field
  2. Clicks a button that activates the Submit action
  3. Action gets the entity from local storage and then updates (I've tried both Update and CreateOrUpdate, neither worked)
  4. Navigate to next page (crashes at step 3 though)



The local item is being found



My local variable is being set



I've tried various approaches, such as setting to a local variable of entity and passing it to Update

In my most recent one, I started manually defining values but still no luck



Any suggestions on how I can narrow down what's causing the issue or why it would come up?

2022-08-12 09-46-04
Andrew Bowen
Solution

Thank you for your suggestions @Dorine Boudry , the Id attribute made me wonder if I had done it wrong


So I deleted and recreated the entity using the "Add Entity From Database" feature, and now it works


Would have been nicer to have a clear error message but it is what it is

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Andrew,

Look in the console of dev tools or in Service Center if you can find more detail about the error.

How did the record get there in the first place ?  That apparently did not fail.

Just for investigative reason : If you change your logic to a delete followed by a create, what happens? Where does it fail than ?

Share the problem oml to help us investigate?

Dorine

2022-08-12 09-46-04
Andrew Bowen

Unfortunately it's a work program, so I shouldn't share more than I have to. 

If I can't resolve this, then I'l l create a sample app to replicate it


The steps leading up to this

  1. Created a new entity in the database
  2. Save same entity local storage entity (I can't use OfflineDataSync because it's Anonymous) 
  3. Set client variable of the Id to share between pages
  4. Navigate to a new page
  5. User enters text into a text field
  6. User clicks 'Submit'
  7. Submit button is screenshot of loading entity using Id from local storage + calling local storage Update


Console did not have any additional information unfortunately



Deleting has a similar issue


2022-08-12 09-46-04
Andrew Bowen
2021-09-06 15-09-53
Dorine Boudry
 
MVP

In step 2 I suppose you do a create ?  Can you share flow and exact assign statement  ?

It feels like it goes wrong in the corner of the id attribute.

can you debug and see if this is correct after that assign you do there in that assign right before your update.

What is data type of that client variable you are using and validate it is always correctly populated ?

Dorine

2022-08-12 09-46-04
Andrew Bowen
Solution

Thank you for your suggestions @Dorine Boudry , the Id attribute made me wonder if I had done it wrong


So I deleted and recreated the entity using the "Add Entity From Database" feature, and now it works


Would have been nicer to have a clear error message but it is what it is

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.