cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5875
Views
0
Helpful
10
Replies

Adding/Updating digits on Xml file - UCCX Scripting

Hi

I'm looking for a sample script, where i can Add or update the digits on Xml file.

for example xml file contains

phone number:

<Number>07654632415</Number>

Scripts will play a message "Enter phone number for call divert on Emergency"

Then the digits dialed after the message should be updated on this xml file.

And the second message should play "you entered .........."

Is this possible

Thanks Shameer

2 Accepted Solutions

Accepted Solutions

Anthony Holloway
Cisco Employee
Cisco Employee

You do not need an XML file for something this simple.  You could, but it's more work than needed.

Simply create a plain text file that has the emergency number in it (or start it off blank for that matter).

In your script, you would read the file simply by assigning the Document to a String.

E.g.,

Set file_contents = DOC[emergency_number.txt]

Then, to update it, you would simply use the Upload Document step, using the same filename so you can overwrite it, and for the value you would just use the String variable with (Document) in front of it.

E.g.,

(Document) new_emergency_number

If you haven't worked with Documents much, or uploading them, then you may not know you need to authenticate a user first, which is as simple as creating a User variable and then using the Authenticate User step.  Of course it can be more complicated with caller input authentication and what not, but that's your choice.

Might as well link to this, as it pertains to authentication via scripting:

https://supportforums.cisco.com/message/3856013

Good luck and happy scripting.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

View solution in original post

Your Set get_number = new_emergency_number is backwards.

It should be Set new_emergency_number = get_number

Flip that around and give it a shot.  Let me know how it works after that.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

View solution in original post

10 Replies 10

Anthony Holloway
Cisco Employee
Cisco Employee

You do not need an XML file for something this simple.  You could, but it's more work than needed.

Simply create a plain text file that has the emergency number in it (or start it off blank for that matter).

In your script, you would read the file simply by assigning the Document to a String.

E.g.,

Set file_contents = DOC[emergency_number.txt]

Then, to update it, you would simply use the Upload Document step, using the same filename so you can overwrite it, and for the value you would just use the String variable with (Document) in front of it.

E.g.,

(Document) new_emergency_number

If you haven't worked with Documents much, or uploading them, then you may not know you need to authenticate a user first, which is as simple as creating a User variable and then using the Authenticate User step.  Of course it can be more complicated with caller input authentication and what not, but that's your choice.

Might as well link to this, as it pertains to authentication via scripting:

https://supportforums.cisco.com/message/3856013

Good luck and happy scripting.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Hi Anthony

Thanks for the response and pointing me in the right direction.

i worked with writing and uploding scripts before with xml files thanks to your other posts.

I'll try this out let you know if i face any issues.

Thanks

shameer

Hi Anthony

The repository user authentication works fine

and

Also I can read the numbers on txt file and able to transfer the calls to that number.

But couldnt find a way to replace/update it.

please see attached screen for the step,

Can you please give me proper steps to accomplish this

Thanks

shameer

It looks like you are missing two things within your Upload Document step.

1) You are using the repository account xml document as the contents of the new file to upload, and you should be using the (Document) new_emergency_number trick instead.

2) You are using the file_contents variable for the name of the file, and you should be using either a String variable or a String literal of the filename.  E.g., "emergency_number.txt"

Here's an example I put together for you:

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Hi Anthony.

yes my mistake, i used the wrong file on upload stage.

i attached my modified script, but as soon as i entered the digits its just ring

can you please let me knoe how can i collect the digits and store it on the same file properly.

do i need to have two txt files on Document repository.

Thanks

shameer

Because of script version dependency issues, could you please just post screenshots of the relevant parts?  I'm still in this with you though, so don't worry, we'll get it figured out.

Also, whenever I am trying to build a solution like this, I will create small individual scripts to vet specific solutions, and the script does not require an active contact (a phone call) to work.

Example:

If I were going to test reading the text file from the repository, I would screate a new script, and just have the two variables (String and Document) with the one step (Set my_string = my_document), and then use Active Debugging (Press F10) to test that out.  This way I don't have to save and upload, and refresh the application, followed by setting up a reactive debug, and then calling into the script.  It's too much overhead for testing simple solutions.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Hi Anthony

Please see attached Script Image Screenshot

Thanks for the Testing tip as well.

Regards

shameer

Your Set get_number = new_emergency_number is backwards.

It should be Set new_emergency_number = get_number

Flip that around and give it a shot.  Let me know how it works after that.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Hi Anthony

Full marks 10/10

After the change it worked.

Thank you so much for helping me to accomplish this script

Thank you once again for your great support

Thanks

shameer

I'm glad you got your script working.  Until next time...

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.