Dismiss Notice
We would like to remind you that we’re updating our login process for all 3CX forums whereby you will be able to login with the same credentials you use for the Partner or Customer Portal. Click here to read more.

Get CSV info, script example?

Discussion in 'Call Flow Designer' started by VictorSP, Mar 22, 2018.

Thread Status:
Not open for further replies.
  1. VictorSP

    Joined:
    Sep 6, 2016
    Messages:
    71
    Likes Received:
    13
    Hello,

    Could anyone provide an example of script to get info from CSV, please? We want to check into the CSV the PIN and get the destination asociated. CSV example:

    PIN, Destination
    111,8899
    222,8888
    333,8877
    ...

    Thanks!
    Victor
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,611
    Likes Received:
    126
    Hello @VictorSP,

    Please take a look at the following article:
    https://www.3cx.com/docs/cfd-creating-phone-support-portal-3/

    The script there validates ID and PIN. You need to validate the PIN and return the Destination, so you can easily change the script as follows:
    Code:
    public string GetDestinationForPin(string fileContent, string pin)
    {
      foreach (string line in fileContent.Split('\n'))
      {
        string[] lineParts = line.Trim().Split(',');
        if (lineParts.Length == 2)
        {
          string customerPIN = lineParts[0];
    
          if (pin == customerPIN)
            return lineParts[1];
        }
      }
      return "";
    }
    Kind regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    VictorSP likes this.
  3. VictorSP

    Joined:
    Sep 6, 2016
    Messages:
    71
    Likes Received:
    13
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.