web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Unified Service Desk - Show Custom USD Control

(0) ShareShare
ReportReport
Posted on by 2

Hi,

I have written a Custom USD Control that doesn't do a whole lot, really it's a proof of concept.

I have a menu with a drop down with some items in it.

What I want to be able to do is to call an Action on these menu items to open up my Custom USD Controls and have them shown in the MainPanel.

I don't want the control to be marked as global because users can show and hide them at will.

I've looked around and haven't found any particular information on how to do this (although I know I am missing something simple).

Any suggestions would be great.

Thank you.

Greg

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Neil Parkhurst Profile Picture
    10,727 User Group Leader on at

    You may have done this already but have you reviewed the mircosoft walkthroughs on creating various types of custom controls?

    msdn.microsoft.com/.../dn864996.aspx

    When you say a hosted control is global you reLly just mean it isn't session based. It does sound like your control should be global.

    Hope this helps get you started

  • Suggested answer
    Community Member Profile Picture
    on at

    1. Start Visual Studio, and create a new project.

    2. In the New Project dialog box:

    a. From the list of installed templates, expand Visual C#, and select CRM SDK Templates > Unified Service Desk > USD Custom Hosted Control.

    b. Ensure that .NET Framework 4.5.2 is selected.

    c. Specify the name and location of the project, and click OK to create a new project.

    3.In Solution Explorer, double-click the USDControl.xaml file to bring up the XAML designer.

    4.In the designer, add the following controls from the Toolbox:

    a. Label: In the Properties pane, set the name of the control to “myLabel.”

    b. Button: In the Properties pane, set the name of the control to “myButton,” and the content to “Start Debugger.”

    5.This is how the controls look in the XAML designer<a href="http://goo.gl/maoapk&quot;>.</a>

    6.Double-click the button to add code behind the XAML. This will take you to the click event definition of myButton in the USDControl.xaml.cs file. Add the following command.

    7.Define a custom action for the hosted control. In the USDControl.xaml.cs file, browse to the override definition of DoAction.

    8.Add the following code within the override definition of DoAction to define a custom action called MyCustomAction, which accepts a parameter called username.

    9.Save your project, and build it (Build > Build Solution) to verify that it builds successfully.

  • Greggomatic Profile Picture
    2 on at

    Hi Neil,

    Yes I have done this, I guess what I am trying to figure out is for a Custom Control, do I need to create a Custom Action in order for it to show when the user wants it to show.  I can easily create the custom control and it there available to users to access, when the close that tab it is now gone and they cannot access it.

    In the MSDN example, the control is always there, always on (global).  Is it simply a matter of hiding it (that tab that hosts my control) and later calling a show command to show it?

    I know I am missing something simple but hope this explains it better.

    Thank you for your help.

  • Suggested answer
    Neil Parkhurst Profile Picture
    10,727 User Group Leader on at

    Hi

    Hard to answer as I know very little about the desired outcome you require.

    Have you tried simply calling the "default" action to show the control? You could then "hide" the tab by closing it. (aka call the close action.)

    If you have the hosted control as "not" global. When you load it it will be added to the current session. And will only show when that session is selected.

    I'm unclear if you really need to create a hosted control that shows in a session or if you need a global control that isn't always loaded.

    The way you describe wanting options the user can click sounds like a toolbar. Could you use a USD toolbar?

    Neil.

  • Greggomatic Profile Picture
    2 on at

    Hi Neil,

    I'll try to be a bit clearer.

    I have a USD Custom Control (a WPF application, nothing is in it, it is simply blank right now) - currently set to Global (so it can be used outside of sessions and accessed by the agent whenever they want).  When the control is marked as Global it cannot be closed (no x in the corner of the tab).

    When the USD loads, it shows up as a tab.

    However, my users do not want to see this tab all the time, sometimes they need it, sometimes they don't.  So I would like to be able to "hide it" and "show it" later.  To do this, I have created a toolbar button where I want the user to click the button and it shows this tab (my hosted control).

    Now, writing this out, it seems like I might need to mark the control as not Global so that I can trigger the show/hide functionality.  However, when I create this action (to be triggered from my toolbar button), it doesn't working.

    I am calling the "default" action which from what I have read, I thought would have shown it?

    Not sure if this picture gives the proper visual on it.

    Thanks

    3554.tab.png

  • Suggested answer
    Neil Parkhurst Profile Picture
    10,727 User Group Leader on at

    You are right calling the default action should (I also believe) show the tab. Maybe try having a showtab action on your toolbar in addition to the default action. (For the show tab, your hosted control will be CRM Glbal Manager, action, Show Tab and data will contain the name of your SAP hosted control.) I'm not sure if the show tab should run before or after the default action. I'd try before first!

    To "hide" the tab, I think you are saying you want the users to press "x" on the tab. Again I expect that to be present by default. If not showing create a SetUserCanClose action. The hosted control will be SAP, action will be SetUserCanClose. Then set data to "UseCanClose=false".

    Add the SetUserCanclose action to BrowserDocumentComplete event of the SAP hosted control. The "x" shoudl then show, I do think there currently might be a bug in latest USD build for firing of BrowserDocumentComplete in this manner! If the action doesn't fire from BrowserDocumentComplete, also add the same action to the PageComplete event. That should get round that problem.

    Hope this helps.

  • Verified answer
    Scott Hoff Profile Picture
    35 on at

    It sounds like Neil has the best solution. One other suggestion is to make the control Global and use MoveToPanel to move it from MainPanel to HiddenPanel as necessary, however I would prefer to open and close it in most cases.  You absolutely do want this control to be global, however.

  • Suggested answer
    ansrikanth Profile Picture
    3,115 on at

    Hi

    I think there are some fundamental misunderstanding with some of usd functionality..

    I have a USD Custom Control (a WPF application, nothing is in it, it is simply blank right now) - currently set to Global (so it can be used outside of sessions and accessed by the agent whenever they want).  When the control is marked as Global it cannot be closed (no x in the corner of the tab).

    This is not entirely true. Even if it is a global control it can still be closed (in reality it is hiding the control). All you need to do is call the allowclose action after the control load as suggested by Neil.

    Now, writing this out, it seems like I might need to mark the control as not Global so that I can trigger the show/hide functionality.  However, when I create this action (to be triggered from my toolbar button), it doesn't working.

    I don't think you have to make it as Session based, If I understand your requirement correctly, you should have this as Global control only. I believe you might have changed your control from global to session based. Remember, a session based control can not be opened with out having a session even though you explicitly call the "default" action.

    So the steps you have to follow finally is..

    a) Create your hosted control as global app

    b) dont load it during the initial usd load.

    c) use a toolbar button and attach a default action to load the app

    d) after default action, call another action allowuserstoclose, so that user can see the close button.. if  he want to close it at later stage he can still close it and click the button again to load it..

    One another point to keep in mind is like, your global applications will not have multiple instances. Even if the user closes the control, next time when you click the toolbar button, it would again show the same control .. it wont be a new instance.

  • Tobias Koller Profile Picture
    on at

    hi,

    I also need to open a HostedControl(WPF) from another HostedControl(WPF) in a new Session using C#.
    I've tried several thinks like (which didn't work for me)
    - configure an event and use FireEvent("myevent")
    - configure FrameNavigationRoutes from HC1 to HC2
    - ...

    Can anyone help me with some code-snippets?

    Thanks a lot.
    Tobias

  • Community Member Profile Picture
    on at

    I know its an old post, but  did you find this code snippet, i am in the same position as you have mentioned.

    Any help would be appreciated.

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans