function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SibilSibil 

how to use primitive datatye object

How to assign value to primitive data type - Object.
Object data={abc=123,zyz=456};
 
Abdul KhatriAbdul Khatri
Hi Sibil,

Please clarify what exactly you are looking for with some details.
SibilSibil
I have an lwc which returns data as {abc=123,xyz=123}
Controller function testFunction(Object xyz){}
I want to call the testFunction in anonymous window, so how can i assign the object the value '{abc=123,xyz=123}' and check it?
When i do declare Object data={abc=123,xyz=123} in anonymous window it shows error. But when i call using lwc it works fine.
How can i call the testFuncion from anonymous window?
Abdul KhatriAbdul Khatri
Hi Sibil

OK Let's try to understand. What you mean your lwc returns data as {abc=123, xyz=123},
  • What is the return data type from the controller. 
  • What is abc and xyz in that context, are they field and 123 is the value to those fields.

You cannot define Object data={abc=123,xyz=123} 

Can you check if there is any inner class define in your contrller like this
 
public class example {
    public string abc;
    public string xyz;
}
Would you like to share the code?