User table Structure giving an error while querying

I wrote a structure to get the user information from user table, and given that List of Record of User_details it is giving an error when i am querying it. 

Expected a Record of User instead of User_details 

This is what the error i am facing while i am querying. Could any one help me on this.


And can i use same name as table in structure too. Like i am calling salesforce queries there the table name is order should i use the same name in structure also?

Hi laxmiprasanna!

That means you have a mismatch between the data type of the structure and the table. For your case, since your structure is User, your list should be record of User instead of User_Details. Change the data type of the list to List of Record User.

I would not recommend using exactly the same name in both a table and structure (or two different widgets) if allowed. You or the next developer might get confused when debugging or refactoring the logic. Add something, say a prefix or suffix, to the name to easily distinguish one from the other.

Kind regards,
Joseph Enriquez

Hi 

It appears you have created a structure User_details and are trying to query the User table and assign the results to your structure. 

The error clearly states that there is a mismatch in the data types used. 


Hope it helps !!!

Amal Raj wrote:

Hi 

It appears you have created a structure User_details and are trying to query the User table and assign the results to your structure. 

The error clearly states that there is a mismatch in the data types used. 


Hope it helps !!!

Yes actually i am querying to the salesforce user table and from there i am mapping to my user_details structure.

So when i am assigning to my structure it is giving this error. 


I would use the listclear and listappend instead of the assign to fill your structure.