How to send blank array of records ( as per structure ) as server action input
Question

Need to send inputs to server action following a structure already defined . Want to send all the inputs even if they are blank . This is working for objects after selecting "Send Default values" to "Yes" . But for arrays it is going as empty instead of holding the structure defined . Expecting the arrays or lists to hold one record with default values while passing them to server . 


Hi Arnab,

You need to serialize your whole structure and assign serialize  default value as Yes rather than only  to do only Send Default Values to yes. This way you don't need to do in object level.  You can achieve the solution by following below steps.


  1. Create a server action with input type as text.
  2. Create the final structure on client side  that has arrays or list inside and in client action do below things.


3- Pass the final serialize JSON to Server actions as text and on server side get the final JSON object by doing deserialize.


Dileep

Hi Dileep,

I've tried this solution of serializing the API input . But still the nested arrays are going blank . The object the working perfectly .


Thanks,

Arnab

Hi ARNAB LAHIRI,

Can you share the oml, so that community members can help you!


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