I am getting the value for the first three columns, but not the value for the last column. How do I convert a List to a String so I can get the value for the Organization column?

This is my code:

```
String appname = "abc";
String path = "//home/exportfile//";
String filename = path+"ApplicationExport-"+appname+".txt";
String ret = "false";

        QueryOptions ops = new QueryOptions();
    Filter [] filters = new Filter[1];
    filters[0] = Filter.eq("application.name", appname);
    ops.add(filters);

    List props = new ArrayList();
    props.add("identity.name");

    //Do search
    Iterator it = context.search(Link.class, ops, props);

    //Build file and export header row
    BufferedWriter out = new BufferedWriter(new FileWriter(filename));
    out.write("IdentityName,UserName,WorkforceID,Organization");
    out.newLine();          

    //Iterate Search Results
    if (it!=null)
    {                               
            while ( it.hasNext() ) {

                    //Get link and create object
                    Object [] record = it.next();
                    String identityName = (String) record[0];
                    Identity user = (Identity) context.getObject(Identity.class, identityName);

                    //Get Identity attributes for export
                    String workforceid = (String) user.getAttribute("workforceID");                 

                    //Get application attributes for export
                    String userid="";

                    List links = user.getLinks();
                    if (links!=null)
                    {
                            Iterator lit = links.iterator();
                            while (lit.hasNext())
                            {
                                    Link l = lit.next();
                                    String lname = l.getApplicationName();
                                    if (lname.equalsIgnoreCase(appname))
                                    {
                                              userid = (String) l.getAttribute("User Name");
                                              List organizations = l.getAttribute("Organization");

                                              StringBuilder sb = new StringBuilder();
                                              String listItemsSeparator = ","; // this you can change to anything you want, it separates items from list

                                                                                                            for (Object organization : organizations)
                                                                                                                    {
                                                                                                                            sb.append(organization.toString());
                                                                                                                            sb.append(listItemsSeparator);
                                                                                                                    }

                                                                                                                    org = sb.toString().trim();

                                    }
                            }
                    }                   

                    //Output file
                    out.write(identityName+","+userid+","+workforceid+","+org);                             
                    out.newLine();                                                                          
                    out.flush();
            }

                     ret="true";
    }

    //Close file and return
    out.close();
    return ret;

```

This code writes Void for the value of the Organization column. How can I fix this?