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)

How do you tell the difference between the Unified interface and the legacy web client in a JS script

(0) ShareShare
ReportReport
Posted on by

I have a script that runs in both the legacy UI and the Unified interface. In that script, I need to call some XRM function that behaves differently in the 2 UIs.

The problem is that I cannot figure out a way to tell which UI I am in via code.

How do you tell the difference between the Unified interface and the legacy web client in a JS script?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Ben Thompson Profile Picture
    6,350 on at

    The only way I'm aware of that works is to use the internal (so unsupported) Javascript function xrm.internal.isuci() .

  • gdas Profile Picture
    50,091 Moderator on at

    Hello,

    Below references will be help you to understand the changes -

    crmrocks.com/.../unified-interface-with-scott-durow

    community.dynamics.com/.../unified-client-form-properties-cheat-sheet

  • sbelzile Profile Picture
    on at

    Thanks Goutam, but I'm looking for something at code level.

  • Suggested answer
    Ben Thompson Profile Picture
    6,350 on at

    See my comment above for the code you need

    As an aside what function is working differently on Unified Interface to the web refresh? Everything should be working the same way...

    Equally could you mark the answer as verified so others can find it if they need it.

  • gdas Profile Picture
    50,091 Moderator on at

    Not sure may be this is what you are looking for -

    docs.microsoft.com/.../important-changes-coming

  • sbelzile Profile Picture
    on at

    > See my comment above for the code you need

    If that was only for myself or for my company, I would see no problem using this, but the code I'm writing will be shipped to our clients. I am not uncomfortable shipping something not supported.

    > As an aside what function is working differently on Unified Interface to the web refresh? Everything should be working the same way...

    A few minor things:

    1. The problem I currently have is with `Xrm.Navigation.openForm`. I am trying to replicate the behavior of the "email component" in the knowledge articles result list (in Case forms). In the UCI, I can pre-set the recipients of the email by passing an array of lookup values (`to` attribute), which does not work in the legacy client (the OOTB control does have different behavior at that level in the 2 UIs).

    2. If I call: `Xrm.Navigation.OpenWebResource('mywebresource.html#f:@objecttype=something")`, the hash parameter is properly transferred to my webresource in the UCI, but not in the legacy web client.

    3. I had problems with the encoding of the `data` parameter as well, but this one I was able to go around.

  • Suggested answer
    Ben Thompson Profile Picture
    6,350 on at

    To be honest I'm about to ship it in a product wrapped around a secondary test for Xrm.Page.context.getVersion and will happily have the argument with the product team about why I'm using it - I would prefer not to use the code but I end up with look and feel differences that I'm uncomfortable with unless I do it.

  • Verified answer
    sbelzile Profile Picture
    on at

    Good. I logged an idea here: experience.dynamics.com/.../idea to get a supported version.

    On my side, I removed the line that required a check, since it was not that important.

  • Nithya Gopinath Profile Picture
    17,078 on at

    Hi Sebastian,

    See: docs.microsoft.com/.../understand-clientapi-object-model

    Hope this helps.

  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at

    We are using the below snippet to identify is it UCI or not.

    function isUCI(){
    
           var globalContext = Xrm.Utility.getGlobalContext();
    
           var t1 = globalContext.getCurrentAppUrl();
    
           var t2 = globalContext.getClientUrl();
    
           if (t1 !== t2)
    
               return true;
    
       return false;
    
    }


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