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

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Navigating Main pane based off data from the Side Pane

(0) ShareShare
ReportReport
Posted on by 2,171

So within Dynamics 365 I decided to use the new Xrm.App.sidePanes method to create a side pane that embeds a HTML web resource. Specifically I've embedded the Amazon connect stream softphone. It all works perfectly. When running the side pane, it appears with the Amazon connect softphone. I've test called and it dials through well and I can see all the events that I need including the phone number of the incoming call.

I've added ClientGlobalContext.js.aspx javascript library to the HTML so that I can access the globalContext. Basically what I'm trying to do is have it so that when someone dials through to the Amazon connect sidepane embedded in Dynamics it:

  1. picks up the phone number from the Connect event.

  2. I run a web API call to Dynamics to find contact with that number and return the contactid

  3. Use that contactid to navigate the main pane (not the amazon connect embedded side pane) to that contact.

So far 1 and 2 seems to be working. I can run the web API call using the globalContext to return the base URL but I'm unable to find a method to navigate the main pane to the contact record. Any help would be greatly appreciated.

Under the amazon connect event listener for contact.onConnecting(). I added custom code in the handleContactAccepted function to retrieve the contactid via the web api and then use it to navigate to the contact record in the main pane. I am able to retrieve the contact ID using the phone number but can't navigate to the contact using the main pane in Dynamics 365.

Below is the module script I use to subscribe to the contact events generated by the stream. 

/** * Extends the contact events.*/export default function (contact) {    console.debug(/CDEBUG >> ContactEvents - New Contact contactId: / + contact.contactId);    console.debug(/CDEBUG >> ContactEvents - New Contact InitialContactId(): / + contact.getInitialContactId());    // Route to the respective handler    contact.onConnecting(handleContactConnecting);    async function handleContactConnecting(contact) {        console.debug('CDEBUG >> ContactEvents.handleContactConnecting() - Contact connecting to agent');        // Add your custom code here        function getContactIdByNumber(searchNumber) {          return new Promise((resolve, reject) => {            var req = new XMLHttpRequest();            req.open(              /GET/,              Xrm.Utility.getGlobalContext().getClientUrl() +                `/api/data/v9.2/contacts?$select=contactid,telephone1&$filter=contains(telephone1,'${searchNumber}')`,              true            );            req.setRequestHeader(/OData-MaxVersion/, /4.0/);            req.setRequestHeader(/OData-Version/, /4.0/);            req.setRequestHeader(              /Content-Type/,              /application/json; charset=utf-8/            );            req.setRequestHeader(/Accept/, /application/json/);            req.setRequestHeader(/Prefer/, /odata.include-annotations=*/);            req.onreadystatechange = function () {              if (this.readyState === 4) {                req.onreadystatechange = null;                if (this.status === 200) {                  var results = JSON.parse(this.response);                  console.log(results);                  if (results.value.length > 0) {                    resolve(results.value[0].contactid);                  } else {                    resolve(null);                  }                } else {                  console.log(this.responseText);                  reject(this.responseText);                }              }            };            req.send();          });        }        console.log(contact);        var connections = contact.getConnections();        var c1 = connections[1];        var c1Number = c1.getAddress();        var recievingPhoneNumber = c1Number.phoneNumber;        console.log(c1Number);        console.log(recievingPhoneNumber);        var formattedReceivingNumber = recievingPhoneNumber.replace(/+/,//);        console.log(formattedReceivingNumber);        var contactId = await getContactIdByNumber(formattedReceivingNumber);        console.log(contactId);        var pageInput = {            pageType: /entityrecord/,            entityName: /contact/,            entityId: contactId //replace with actual ID        };        var navigationOptions = {            target: 1        };        Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(            function success() {                    // Run code on success            },            function error() {                    // Handle errors            }        );            }}
 
I have the same question (0)
  • Suggested answer
    Tamilarasu Arunachalam Profile Picture
    587 on at
    Navigating Main pane based off data from the Side Pane
    Hi MikeC,
            As per my understanding to your question, I am suggesting you to close the side pane(using Xrm.App.sidePanes.state = 0;) and then try to navigate to the page you are looking for.
     
    If you found this answer useful, like and verify
     
    Thanks,
    Tamilarasu Arunachalam
  • MikeC282 Profile Picture
    2,171 on at
    Navigating Main pane based off data from the Side Pane
    Hi @Tamilarasu Arunachalam I closing the sidepane won't work cause the embedded sidepane is the Amazon connect softphone. If it closes then the team member can't pick up the phone.
     
    What it is suppose to do is that the Model Driven App would act like a Amazon connect softphone. Incoming calls has their numbers picked up and if that number exists in Dynamics then the main pane navigates to that contact record so that the user can instantly see who's called through.
     
    I'm considering trying it the other way around. Maybe have a page in the model app that has the HTML and then open up the side pane to display the contact?
     
    Again any help would be greatly appreciated.
     
    Is there no way for actions in the sidepane to interact with the main pane?

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 117 Super User 2025 Season 2

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 110

#3
#ManoVerse Profile Picture

#ManoVerse 56

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans