Types of Add-ins

Tags: 

This article will demonstrate every type of add-in currently available. Sample code for each type of add-in is available from bitbucket.org - cx-developer-tutorials

There are two main classifications of add-ins: session level and record level. A session level add-in is created when the site is loaded and sticks around for as long as your are logged in. Record level add-ins are created for a specific set of data and then are destroyed when the tab/window/etc is closed.

Session Level Add-ins

These add-ins can be used to show persistent data, store information, act as a common gateway for an external connection (Connect CWS for example) or many other uses.

  • Application Menu: this extends the RightNow application menu, useful for launching content pane add-ins, external applications or popup windows.
    • NOTE: IAppMenuButtonHeader2.ButtonName, IAppMenuButtonItem2.ButtonName and IAppMenuButtonItem2.HeaderName are fully qualified class names, not the text that is displayed on those items.
  • Content Pane: this allows for a tab to be created in the main UI, useful for showing data unrelated to a CX record
    • NOTE: There is no way to create a content pane without using another type of add-in (app menu, global ribbon, etc) in the example code I create it using an Application Menu Button
  • Extension Bar: allows for controls to be docked to the top, bottom, left or right of the workspace



    • NOTE: a minimum size on the child control is required to ensure that the bar displays properly
    • NOTE: the child control must overload GetPreferredSize() to completely use the available space
    • NOTE: need to plan for the size to change when it enters/leaves a dock
    • NOTE: the title can be set through the IGDWContext context
    • NOTE: the property GroupName appears to do nothing
    • NOTE: two extension bar add-ins will create a tabset with the add-ins within it
  • Global Ribbon: displays a button in the ribbon bar regardless of context - generally used to create a content pane add-in or to open a pop-up window
    • NOTE: button keytips don't appear until the tab has a keytip set
    • NOTE: IGlobalRibbonButtonGroupName and IGlobalRibbonGroup.TabName are fully qualified names of the class, not the text that is displayed to the user
  • Navigation Item: displays a button on the navigation pane - generally used to create a content pane add-in or to open a pop-up window
    • NOTE: unlike most add-ins the Image property can't return null. If it does the designer will throw an exception
  • Navigation Section: creates an additional expandable section in the navigation bar - can be used to search external systems, open content panes, show arbitrary data and etc
    • NOTE: by default the add-in is visible on every tab in the navigation bar
    • NOTE: administrators can't design where the add-in will be placed, it is only configurable by users
    • NOTE: collapsing and expanding items on the sidebar expands your control but never contracts it, both a min and max height is required to ensure that your control doesn't render a scrollbar needlessly
  • Status Bar: displays a control in the status bar region of the console - useful for updating the user on background operations
    • NOTE: minimum size on the child control is required to ensure it is displayed properly

Record Level Add-ins

In general these add-ins can be used to display information related to the records they're associated with.

  • Report Dashboard: allows for arbitrary controls to be added to a report dashboard, however the add-in does not have any information about the records associated with the dashboard, so tends to be rarely used
    • NOTE: the amount of space used by the add-in can very greatly depending if the user has maximized it on the dashboard, make sure your add-in looks good at the designed size, but also at full screen
  • Report Command: allows for additional actions to be added to rows in a report - useful for extending what a report can do. Information is available about each cell in the row.
    • NOTE: Enabled() has a list as a parameter, but only passes in one row at a time
    • NOTE: CBO records are specified as [namespace]$[object]
  • Workspace Ribbon: allows for additional buttons to be placed on the ribbon for a specific workspace. Information is available about the workspace.
    • NOTE: added to the ribbon using the workspace designer
  • Workspace Control: allows for additional controls to be placed anywhere on a workspace. Information is available about the workspace.
    • NOTE: once it's been placed on the workspace it needs to have it's Position set to Fill Cell, other options can be used, but this tends to be the most helpful

Comments

HI,

Thanks for the great forum, it's been very helpful. I am new to the add-in world or .net in general, I generally stay on the CP side of things, but I followed your contentpane tutorial and was able to launch it from the application menu and display a full screen browser. I'm attempting to move that trigger from the application menu button to the console open event, but have been unsuccessful so far.

Is the key in replacing the launcher with the event handler for the console open?

EventConsoleOpen : IEventConsoleOpen

or am I barking up the wrong tree?

Thanks!
~Scott

I'm going to preface all of this with "I don't like this solution" but here we go.

So there is an IEventConsoleOpened add-in that you can create that has a single Initialize method that is called when the console is opened, however if you try to access the AutomationContext at that point the console throws a Null Reference Exception with the stack trace pointing at RNT code as the culprit:

   at RightNow.UI.Forms.ConsoleBase.FindAndBringToFront(String controlIdentifier)
   at RightNow.Applications.Components.CommandManagement.AutomationContext.ExecuteEditorRecordCommand(RecordCommandInfo info)
   at RightNow.Applications.Components.CommandManagement.AutomationContext.EditWorkspaceRecord(String recType, Int64 recId, RecordIDType recordType)
   at RightNow.Applications.Components.CommandManagement.AutomationContext.EditWorkspaceRecord(WorkspaceRecordType recType, Int64 recId)
   at RightNow.AddIns.HostSideAdapters.AutomationContextHostSideAdapter.EditWorkspaceRecord(Int32 recType, Int64 recId)
   at RightNow.AddIns.AddInSideAdapters.AutomationContextAddInSideAdapter.EditWorkspaceRecord(WorkspaceRecordType recType, Int64 recId)
   at HomeRibbon.OnOpen.Initialize(IGlobalContext context) in OnOpen.cs:line 28

The workaround that I've come up with is ugly, but functional:


[AddIn("On Open")]
public class OnOpen : IEventConsoleOpen
{
public bool Initialize(IGlobalContext context)
{
Task.Factory.StartNew(() =>
{
Thread.Sleep(3000);
}).ContinueWith((o) =>
{
context.AutomationContext.EditWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Contact, 1);
}, TaskScheduler.FromCurrentSynchronizationContext());

return true;
}
}

Basically what's happening here is that on init we start up a new thread and tell it to go to sleep for 3 seconds, during that time the init function returns true (otherwise the console hangs until the thread is complete). Then once the 3 seconds are over we load a contact workspace (replace this with your code to launch a content pane) but we have to make sure that that function runs on the UI thread otherwise a different error occurs. It's a mess. But it works.

I'm of the opinion that this is a product defect, it would make sense to me that when the console was loaded that the automation context would be ready. Maybe in future versions this will work without having to put a delay on a separate thread.

If you come up with a better solution please post it.

--jack

An alternative option would be to create an INavigationItem add-in. Set up it's activate method to open your content pane. Then add the add-in to the nav set and set it as the default. When the console opens the default item will be opened automatically. It's less hacky, but comes with far more configuration work and there are plenty of ways around it for a knowledgeable user.

Thanks Jack,

I like both of your ideas. For my use case, I think your first proposed workaround will be great and the known "gotcha" of the console being ready is definitely something I was about to faceplant on, thanks for saving me hours of frustration. The TaskScheduler is working quite well for my purposes. Cheers!

Any thoughts on sending the context.accountID to the browser in the control? I have tried several ways but haven't it knocked it out yet. Perhaps because it's launching with the task scheduler? Is this a fruitless path?


public ContentControl(IGlobalContext context)
{
InitializeComponent();
this.webBrowser1.Url = new System.Uri("http://support.custhelp.com/" + context.AccountId.ToString());
}

Thanks for any insight,
~Scott

sorry for the long delay, i have been out of town. check out this MSDN article on interacting with the browser object: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser....(v=vs.110).aspx it illustrates two-way communication

Hi there, I am new to CX RightNow. I like to know the for the Global Ribbon Add-Ins, how can I group some buttons in a group? And how can I group some groups in a tab?

I created 3 buttons, they all have same group names and tab names specified in their classes, but they appear under three tabs(they all have same names), and they do not work, please help?

Thanks a lot!

this should be moved to it's own discussion, but how are you setting your TabName property on the group? Remember these need to be the fully qualified name of your class, not the text that's being displayed to the user. so usually something like:


public string GroupName
{
get { return typeof(Group).FullName; }
}

I've developed a media bar, similar to the built in Chat Media bar. The extension bar contains a single user control, containing a row of icons with a height of 20px. My bar displays correctly on the original, non-enhanced interface, with a height of 20. However, when we switched to the enhanced interface, my icons still take up 20px, however, the entire media bar takes up roughly 100. leaving roughly 80px of blank space below my icons. How can I get rid of this space, reduce the media bar to 20px + whatever the title height is.

Zircon - This is a contributing Drupal Theme
Design by WeebPal.