• V20: 3CX Re-engineered. Get V20 for increased security, better call management, a new admin console and Windows softphone. Learn More.

Get CSV info, script example?

Status
Not open for further replies.

VictorSP

Platinum Partner
Advanced Certified
Joined
Sep 6, 2016
Messages
115
Reaction score
27
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
 
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.
 
  • Like
Reactions: VictorSP
Status
Not open for further replies.
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.