cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
991
Views
5
Helpful
3
Replies

Multiline Commands through Macros - CE9.3

tylehall1
Level 1
Level 1

I am trying to push a multiline command through macros in order to update the UI with the press of a button. The command I am attempting to send is (I have significantly shortened the xml in my debugging):

   xapi.command('UserInterface Extensions Set', { 
      ConfigId: 'AdvancedSettings',
      'body': '<Extensions><Version>1.5</Version><Panel><PanelId>AdvancedSettings</PanelId><Type>Statusbar</Type><Icon>Sliders</Icon><Order>1</Order><Color>#A866FF</Color><Name>Advanced</Name></Panel></Extensions>'
   });

Every time I push this in 9.3, I receive an error in the console:

'Unhandled promise rejection' { code: 0,
  message: 'Failed to parse xml',
  data: { status: 'Error', Reason: 'Failed to parse xml' } }

When I tested this with CE9.2.3, the UI will partially update, but not consistently. 

 

Is there some trick to sending xml/multiline commands using macros?

1 Accepted Solution

Accepted Solutions

Magnus Ohm
Cisco Employee
Cisco Employee

I copied your code example into my macro editor on a SX80 running CE9.3 release software. I ran the code and a button was created with the color. I can also change the color (by modifying the color code and re-run the code). Not sure why you are seeing this.

 

Do you have any more details?

 

/Magnus

View solution in original post

3 Replies 3

tylehall1
Level 1
Level 1
Alternatively, I have no problem inserting this command into a Startup Script. Is there a way to call a startup script within a Macro?

Magnus Ohm
Cisco Employee
Cisco Employee

I copied your code example into my macro editor on a SX80 running CE9.3 release software. I ran the code and a button was created with the color. I can also change the color (by modifying the color code and re-run the code). Not sure why you are seeing this.

 

Do you have any more details?

 

/Magnus

Ok it just worked for me. It turns out the issue had to do with creating the page then setting the button values immediately was causing the issues. I added a setTimeout to pause it, and it was enough to make the error go away.