I am trying to create a SharePoint hosted app(for Sp 2013 & 0365) in VS 2013 for adding a ribbon action to site pages, to be shown while editing pages in it.
I am able to populate the button on the edit menu of a page by using the below code:
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.EditingTools.CPInsert.Media.Controls._children">
<Button Id="Ribbon.EditingTools.CPInsert.Media.RibbonCustomAction1Button"
Alt="RibbonCustomAction"
Sequence="100"
Command="Invoke_RibbonCustomAction1ButtonRequest"
LabelText="Request RibbonCustomAction1"
TemplateAlias="o1"
Image32by32="_layouts/15/images/placeholder32x32.png"
Image16by16="_layouts/15/images/placeholder16x16.png" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="Invoke_RibbonCustomAction1ButtonRequest"
CommandAction="~appWebUrl/Pages/Default.aspx?{StandardTokens}&SPListItemId={SelectedItemId}&SPListId={SelectedListId}"/>
</CommandUIHandlers>
</CommandUIExtension >
But the issue is that I am not able to add CommandAction as below:
CommandAction="javascript:alert('Test');"
and is getting the below error on deployment:
Error occurred in deployment step 'Install app for SharePoint': There were errors when validating the App Package.
And hence the app is not working. Could you please let me know how to call js here?