2

There is the function: Xrm.Internal.isUci(), but that is labelled as Internal, so its most likely not supposed to be used. But, I need a method to determine if my code is being invoked from the UCI or from the legacy web-client (because, there are behavior differences in how the code behaves).

Is there a supported mechanism to determine this?

Raj Rao
  • 8,872
  • 12
  • 69
  • 83

2 Answers2

2

This is what we are using today, which is supported & working for us:

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

Community thread on same topic

Raj Rao
  • 8,872
  • 12
  • 69
  • 83
  • I saw this code and my only concern is that the difference between t1 and t2 is the fact that t1 contains appid='xxxxxx'. If the UCI were made the default (or can it be made the default UI?, would this still work?) – Raj Rao Jan 03 '19 at 22:35
  • @RajRao we are also waiting for that day to change our code :) will update this thread definitely – Arun Vinoth-Precog Tech - MVP Jan 03 '19 at 23:00
  • 1
    Might be a good idea to upvote this idea/suggestion: https://experience.dynamics.com/ideas/idea/?ideaid=1003a9bf-d790-e811-8c6e-0003ff68b068 – Raj Rao Jan 03 '19 at 23:33
0

Another supported option that might work:

var globalContext = Xrm.Utility.getGlobalContext();
globalContext.getCurrentAppProperties().then(successCallback, errorCallback);
Aron
  • 3,877
  • 3
  • 14
  • 21