Unified Service desk - Sessions with CRM Page RRS feed

  • Question

  • Hi,

    I have a requirement , Where i need to create a custom search page , on search of it, I need to open a web page, open a contact and Case record.

    This is what i have done.

    1. Created a Custom Hosted Control. Added a grid like this.


    on double click of row, I am opening a session like this.

     CrmCustomerService customerService = new CrmCustomerService();
                    var customerFromCrm = customerService.GetCustomerById(contactId, "contact");
                    CustomerEntity sessionCustomer = null;
                    sessionCustomer = new CustomerEntity(contactId.ToString(), customerFromCrm, "<CustomerID>1<CustomerID/>", false, this.ApplicationName);
                    sessionCustomer.IsNewCustomer = true;
                    // Start a new session
                    OpenSession(sessionCustomer, Guid.Empty);

    And i am opening a web page by creating CCA Hosted control.

      if (!this.desktopAccess.AppExistsInUI("webApp"))
                        FireRequestAction(new RequestActionEventArgs("webApp", "webAppLogin", ""));

    I can see it opens a web page. 

    And i need to open contact and case. 

    Trial 1:

    For Contact i have created a CRM PAGE hosted control which is not Global. Then trying to naviaget by passing url like below.

    if (!this.desktopAccess.AppExistsInUI("Case"))
                    FireRequestAction(new RequestActionEventArgs("Case", "Navigate", "http://server/orgname/main.aspx?etn=incident&id=&extraqs=customerid%3d%7bEC8A318B-FF81-E411-9574-080027AC570E%7d%26customeridtype%3dcontact%26customeridname%3dPhani&pagetype=entityrecord"));

    But it throws an error saying, Application cannot be intialized while creating dynamic application.

    Trial 2:

     Contact i have created a CCA hosted control with type as web application.

    And created a web adapter and navigating it from web adapter like below.

     public override bool DoAction(HostedWebApplication.WebAction action, ref string data)
                string showIncidentActionName = "OpenContact";
                if (action.Name == showIncidentActionName)
                    // The querystring is the same as during the attempt to use the context. 
                    // We just replace the %LastIncidentId part with the incidentId
                    ////string contactUrl = action.Url;
                    ////contactUrl = contactUrl.Replace("contactidtobereplaced", LocalContext["contactidtobereplaced"].ToString());
                    string fullUrl = string.Format("{0}?{1}", action.Url, action.QueryString.Replace("%contactidtobereplaced", LocalContext["contactidtobereplaced"].ToString()));
                    return false; // To stop navigation in HostedWebApplication                
                return true;

    Now i dont see any error, But i donot see contact being opened in USD.

    Trial 3:

    Followed this artcile http://msdn.microsoft.com/en-us/library/dn864953.aspx and made the necessary changes. Still i donot see my contact is being being opened.

    And i am getting an issue with switching sessions.

    Here is the error SESSION_ERR_SWITCH: Error switching sessions.

    I am banging my head on this from last few days. Could anybody guide me on this .

    Thanks in advance.

    Sreeni Pavalla

    Tuesday, December 23, 2014 7:47 AM

All replies

  • Ideally, you should use Contact as a Session based web application so that you don't need to initiate the creation of it every time.

    Use SessionCreated event of Global manager to trigger an action call of Navigate and use replacement parameters to navigate the contact record.

    Btw, as you are using your custom control to start the session, it is your responsibility to populate the context sensitive variables also. I think it is there on GlobalManager it self with a name "CopyToContext" (or some thing like that.. dint remember correctly)

    After Opening the session use this method to load the context variables and then use replacement parameters in your Contact page's Navigate action call to open the contact record. This is more of a USD way of doing things and I like that very much :)

    Hope this helps...  Happy coding..


    ** Please mark it as answer if it solves the problem.

    ** Take the latest SDK available for CRM 2015 which contains the USD SDK also but this time very detailed and clean...

    Imposible it self is having Posible.. Dont leave it until you get it..

    Thursday, December 25, 2014 4:57 PM
  • Srikanth,

    Thank you for your reply. I have a question here, What do you mean by Session based web application. 

    I do not see any USD component like that. Do you mind explaining me with few steps. 

    Coming to context i am updating context like below and i can see the values in context.

    //Update the new context with the changed information. updatedContext["UIDNo"] = customerFromCrm.UID; updatedContext["name"] = customerFromCrm.FullName;

    updatedContext["contactidtobereplaced"] = customerFromCrm.CustomerId.ToString(); updatedContext["contactnametobereplaced"] = customerFromCrm.FullName; // Notify Unified Service Desk of this new context information. FireChangeContext(new ContextEventArgs(updatedContext)); // Notify this UII hosted control about the change. NotifyContextChange(updatedContext);

    As you said i Have added a action on Global Manager to open contact as soon as it creates a session. But still i dont see the contact is being opened.

    And specified contact url 

    Still i dont see contact being opened. Is it being opened and hidden somewhere?

    Please let me know your thoughts on this.

    Thanks in advance

    Sreeni Pavalla

    Friday, December 26, 2014 7:16 AM
  • Srikanth,

    I am badly stuck in this. Do you mind giving your personal id for faster communication?

    Thank you,

    Sreeni Pavalla

    Friday, December 26, 2014 7:35 AM
  • hey Sreeni sorry to bother you again, can you just put your requirement / scenario in a short description you can just put a plain requirement you don't have to map it to USD .. then I can try to tell you a probable solution I am assuming you are trying to do this all on a custom web page right.
    Monday, January 5, 2015 10:00 AM
  • Hi Sreeni

    Sorry, Was on vacation from 2 weeks and couldnt able to check the messages !! You can reach out me @ ansrikanth@gmail.com, I can reply based on my free time.

    Coming to your problem, You are trying to do some thing in CCA way in USD. In USD, you have to use Replacement parameters. Check the USD Walk throughs once, they have clearly mentioned how to use Replacement parameters and how to open Contact with it.

    Thank you


    Imposible it self is having Posible.. Dont leave it until you get it..

    Monday, January 5, 2015 8:37 PM
  • Hi Srikanth,

    Am also facing same issue.



    Sunday, November 26, 2017 11:20 AM