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)

Open Tab in USD

(0) ShareShare
ReportReport
Posted on by 2,287

HI All,

I have a Custom Hosted Control, i have a requirement to open URL from C# Custom Hosted Control, Could any one help me here?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Ram Prakash,

    This article lists the supported methods for opening a URL in Unified Service Desk (USD).

  • Ram Prakash Duraisamy Profile Picture
    2,287 on at

    Dear Adrian,

    I would need to use C# Custom Hosted control to achieve this, do you have any code regarding this ?

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Ram Prakash,

    Try this C# function.

    public static void GoToUrl(string url)
    {
         System.Diagnostics.Process.Start(url);
    }
  • Ram Prakash Duraisamy Profile Picture
    2,287 on at

    Thanks Adrian for your reply, the Code which you have sent is opening in different page in IE, i need to open it up with in USD, can you please share me the same..

  • Suggested answer
    Kaustubh Hegde Profile Picture
    330 on at

    Follow the below steps

    1. Create an action with the following details

        * Hosted Control : <<Hosted Control to open>>

        * Action: Navigate

        * Data = url=[[url]]

    2. Call this action from your C# code

    Context globalContext = localSessionManager.GlobalSession.AppHost.GetContext();
    globalContext["url"] = <<URL to pass>>;
    localSessionManager.GlobalSession.AppHost.SetContext(globalContext);
    FireRequestAction(new RequestActionEventArgs("*", "GlobalContextChange", globalContext));

    Please let me know if you need any further details

  • Suggested answer
    ansrikanth Profile Picture
    3,115 on at

    The correct way of doing it is - Expose an Event to your Custom Hosted control (some thing like OpenURL), in your C# use FireEvent() method to fire this event. In your Configurations, add this event and add an Action call to it to open the Actual URL (in it's respective hosted control). This is [tag:theway] of doing things in USD :)

  • Suggested answer
    Kaustubh Hegde Profile Picture
    330 on at

    Yes, exactly. This would be the best practice to implement this. If you want to follow the route Srikanth has mentioned,  below is the detailed procedure to do the same

    1. Create an Event in USD

    • Hosted Control = <<Name of the Custom Hosted Control>>

    • Create an Action >> Hosted Control => <<Destination Hosted Control>>, Action => Navigate, data=> url=[[navigateurl]+], Associate this action to the event.

    2. Call this event from Custom Hosted Control

    Below is the code to call the Event created from C# custom hosted control

    • var eventParameters = new Dictionary<string, string> { { " navigateurl", <<url from code>>} };

           FireEvent("<<Name of event created above>>", eventParameters);

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