How to send array data from Script Include to Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 09:15 AM
Hi Guys,
I have to send array data from Script Include to Client script as I have to sort this array data to get only those fields that are visible on form not all the fields but issue is that when I send it then it convert to object I tried every possible way to convert it again to array but it remains as object.
Script Include -
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 09:29 AM - edited 11-21-2024 09:29 AM
HI @abhaysingh98 ,
Can you try with using JSON.parse() function in the client script to convert into an Array ?
If the above information helps you, Kindly mark it as Helpful or Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 12:12 AM
Hi @Najmuddin Mohd ,
I tried using JSON.parse() function in the client script to convert into an Array to convert it but still it is not working I want to get all the elements of that array and then filter those elements or fields which are visible on the form not all fields .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 02:09 AM
Hi @abhaysingh98 ,
After you parse, did you try something like this.
If 'answer' was an Object which has a Key value pair with key 'Group Name' and value as the Group.
g_form.setValue('assignment_group',answer['Group Name']);
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2024 02:30 AM
If this is just a simple array, then don't JSON.stringify it in the Script Include return:
return rec_arr.join(',');
If it's not a simple array, what does it look like if you log rec_arr.join(',') before the return? I get what the fields array would look like, but not the custom table one.
