cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2496
Views
5
Helpful
4
Replies

UCCX Scirpt: if statement (true of false)

ysanadiga01
Level 1
Level 1

Hi there,

Is it possible to change an if-statement from "true" to "false" or vice versa by calling an extension?

Thanks.

1 Accepted Solution

Accepted Solutions

Anthony Holloway
Cisco Employee
Cisco Employee

Yes.  You will need to practice this first before you try to implement it in your script.  Or, rather, I'm asking that you do.  Just learn the basics first.

First up, you will need to acknowledge that you will need to store this data somewhere persistent.  I.e., External database, external web server, or possibly even the Document repository.  I'll lead with the repository as it's easy and doesn't require the Premium license that the external database does.

Now that we've determine where we are going to store the data, you need to know how to store the data.  You do this in a script with a minimum of two steps:

  1. Authenticate User
  2. Upload Document

And one variable

  1. User my_user = USER[uccxadmin]

Your user account may be called something different.  Authenticate the user first, then upload the document second.  Practice this in a new blank script using the F10 key (Step Over) via the Active Debugging feature.  No saving, uploading, application, trigger or phone call required.

Hint: Use the following as your Document to upload TEXT[true], use the following as your Language L[] and use the following for your name "my_file.txt"

Now that you've figured out how to store the data, let's figure out how to read the data.  In a completely new script, you'll need only two steps:

  1. Set
  2. If

*Three if you count the Annotate step.

And one variable

  1. boolean my_value = true

Drop the Set step in a set it like so:

Set my_value = DOC[my_file.txt]

Next, drop in the If step and set it like so:

If (my_value)

    True

        /* It's TRUE */

    False

        /* It's FALSE */

Now, kick off that Active Debug again (F10) and check your work.  If you got it working, then the last thing you need to do, is figure out how to present the caller with a menu, 1 for TRUE and 2 for FALSE.  That's it.

Happy coding.

I hope that helped.

View solution in original post

4 Replies 4

Gergely Szabo
VIP Alumni
VIP Alumni

Hi,

can you please tell us more. In what context?

G.

Hi Gergely,

 

I got a script with if-statement true of false. The statement is always "False", but it's "True" it will go to another part of script and execute it. At this moment we go to Application and the press the "Checkbox" to achieve this. 

I was looking for a way to achieve this by calling an extension and it will change to "True" or "False".

 

Please let me know if you have any further question.

 

Thanks

Anthony Holloway
Cisco Employee
Cisco Employee

Yes.  You will need to practice this first before you try to implement it in your script.  Or, rather, I'm asking that you do.  Just learn the basics first.

First up, you will need to acknowledge that you will need to store this data somewhere persistent.  I.e., External database, external web server, or possibly even the Document repository.  I'll lead with the repository as it's easy and doesn't require the Premium license that the external database does.

Now that we've determine where we are going to store the data, you need to know how to store the data.  You do this in a script with a minimum of two steps:

  1. Authenticate User
  2. Upload Document

And one variable

  1. User my_user = USER[uccxadmin]

Your user account may be called something different.  Authenticate the user first, then upload the document second.  Practice this in a new blank script using the F10 key (Step Over) via the Active Debugging feature.  No saving, uploading, application, trigger or phone call required.

Hint: Use the following as your Document to upload TEXT[true], use the following as your Language L[] and use the following for your name "my_file.txt"

Now that you've figured out how to store the data, let's figure out how to read the data.  In a completely new script, you'll need only two steps:

  1. Set
  2. If

*Three if you count the Annotate step.

And one variable

  1. boolean my_value = true

Drop the Set step in a set it like so:

Set my_value = DOC[my_file.txt]

Next, drop in the If step and set it like so:

If (my_value)

    True

        /* It's TRUE */

    False

        /* It's FALSE */

Now, kick off that Active Debug again (F10) and check your work.  If you got it working, then the last thing you need to do, is figure out how to present the caller with a menu, 1 for TRUE and 2 for FALSE.  That's it.

Happy coding.

I hope that helped.

ysanadiga01
Level 1
Level 1

Hi Anthony,

 

Thanks. I will try to work on your explantion.