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 365 | Integration, Dataverse...
Suggested Answer

In Force UCI mode enable\disable rule custom java-script action is not working.

(0) ShareShare
ReportReport
Posted on by 130

Hello All,

I am trying to hide custom ribbon button of home grid based on selected view. It is working fine in Classic mode but not working in Force UCI mode.

JavaScript is working fine, no errors and executed successfully. 

Is this any bug or what any solution/suggestions?

Thanks in advance.

I have the same question (0)
  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    Could you share your code here cause some code are not suppoted in UCI like:

    Xrm.page.getAttribute()..should replaced with formcontext.getAttribute.

    In UCI, we should use "executionContext" to get the formcontext, you could also open F12 developer tool to debug your code.

    Best Regards,

    Leo

  • LuHao Profile Picture
    40,892 on at

    Hi Anshuman,

    Which app are you using?

  • Anshuman Trivedi Profile Picture
    130 on at

    Dynamics CRM --- Custom

  • Anshuman Trivedi Profile Picture
    130 on at

    function viewSendForApprovalButton(selectedControl) {

       debugger;

       //var viewName = selectedControl.get_viewTitle();

       var savedqueryid;

       Xrm.WebApi.retrieveMultipleRecords("savedquery", "?$select=name,savedqueryid&$filter=name eq 'Active%20Dispute-DO%20Approval%20Pending'").then(

           function success(results) {

               //for (var i = 0; i < results.entities.length; i++) {

                   //var name = results.entities[i]["name"];

               savedqueryid = results.entities[0]["savedqueryid"];

               if (selectedControl.getUrl().split('&')[4].split('%7B')[1].split('%7D')[0].toLowerCase() == savedqueryid.toLowerCase()){

                   //alert(viewName);

                   return true;

               }

               else {

                   //alert(viewName);

                   return false;

               }

               return false;

           },

           function (error) {

               Xrm.Utility.alertDialog(error.message);

           }

       );

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    Please check if the result is false.

    Consider there may be some difference with viewid format between UCI and classic UI, please make sure you have get the correct view id.

    Did you try to debug the code step  by step?

    Best Regards,

    Leo

  • Anshuman Trivedi Profile Picture
    130 on at

    Guys, Any Update?

  • meelamri Profile Picture
    13,216 User Group Leader on at

    Hello, 

    Please screeshot your ribbonworkbench configuration.

  • Anshuman Trivedi Profile Picture
    130 on at

    image_5F00_2019_5F00_12_5F00_17T12_5F00_01_5F00_10_5F00_279Z.png

  • meelamri Profile Picture
    13,216 User Group Leader on at

    How do you hide your custom button ? 

  • Anshuman Trivedi Profile Picture
    130 on at

    I have already posted the Java Script Code which will return true or false on the basis of selected view.

    Please find the same in above replies

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 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 45 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 36

#3
Satyam Prakash Profile Picture

Satyam Prakash 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans