You are viewing limited content. For full access, please sign in.

Question

Question

CSV File from Form to Email

asked one day ago

I need to create a CSV file from a form and email it to our Network Administrator.

I created a workflow copying Forms fields to create a CSV file with workflow

But my Selection Collection is Empty.  Any Assistance would be great. 

0 0

Replies

replied one day ago

Hi Kimberly, did you select any table or collection fields from the retrieve bp variables activity? Only these 2 types can be used by For Each Row activity. 

2 0
replied one day ago Show version history

Thanks for the reply. I am in Workflow 11 (if that helps) and that is not an option (see picture below). 

I have attempted a different way,  as I am not sure why I need the For Each Row (I was just following the directions from the first person).

 I now have all green in workflow, It states all is success, I put a token tracker and the tokens are taking values, and it creates the CSV file BUT it is blank. I AM SO CLOSE. What am I missing? 

 

 

Here is my script. 

                // Specify the full path for the CSV file.
                string serverName = "I put server name here";  // Replace with your Laserfiche Server name
                string repositoryName = "I put it here"; // Replace with your repository name
                string filePath = "\\\\" + serverName + "\\" + repositoryName + "\\Information Services\\test\\ARFData.csv";

                try
                {
                    // Build the CSV string.
                    System.Text.StringBuilder csvContent = new System.Text.StringBuilder();

                    // Add header row (only if the file does not exist)
                        if (!System.IO.File.Exists(filePath))
                        {
                            csvContent.AppendLine("ReportLine01,ReportLine02");
                        }

                        // Retrieve token values
                        string reportLine01 = GetTokenValue("ReportLine01").ToString();
                        string reportLine02 = GetTokenValue("ReportLine02").ToString();

                        // Properly format CSV row (handling commas and quotes)
                        csvContent.AppendLine("\"" + reportLine01 + "\",\"" + reportLine02 + "\"");

                        // Append to the CSV file instead of overwriting it
                        System.IO.File.AppendAllText(filePath, csvContent.ToString());
                    }
                catch (Exception ex)
                {
                    // Log any errors.
                    System.Diagnostics.Trace.WriteLine("Error creating CSV file: " + ex.Message);
                }

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.