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)

JavaScript validation is not working on Android chrome browser

(0) ShareShare
ReportReport
Posted on by

I have written a custom validation using JavaScript for my custom field on Opportunity form.

It is working perfectly in PC/Laptop using IE/Chrome/Firefox, however it's not working on Chrome browser in my mobile phone.

Any suggestion is appreciated.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi Guido,

    function OnChangeStage() {

       var stage = Xrm.Page.getAttribute("company_stage").getText();

       if ((stage.toString()).indexOf("100") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(100);

           DafRequiredForStageMoreThan20();

           AdminAccessRequired();

       }

       else if ((stage.toString()).indexOf("20") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(20);

       }

       else if ((stage.toString()).indexOf("30") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(30);

           DafRequiredForStageMoreThan20();

       }

       else if ((stage.toString()).indexOf("40") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(40);

           DafRequiredForStageMoreThan20();

       }

       else if ((stage.toString()).indexOf("60") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(60);

           DafRequiredForStageMoreThan20();

       }

       else if ((stage.toString()).indexOf("75") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(75);

           DafRequiredForStageMoreThan20();

       }

       else if ((stage.toString()).indexOf("90") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(90);

           DafRequiredForStageMoreThan20();

       }

       else if ((stage.toString()).indexOf("10") > -1) {

           Xrm.Page.getAttribute("closeprobability").setValue(10);

       }

       else {

           Xrm.Page.getAttribute("closeprobability").setValue(0);

       }

    }

    function DafRequiredForStageMoreThan20() {

       var dafcount = Xrm.Page.getAttribute("company_dafcount").getValue();

       var businessunit = Xrm.Page.getAttribute("company_opportunitybusinessunit").getText();

       if (dafcount == 0 && ((businessunit.toString()).indexOf("UK") > -1)) {

           alert("Please add a deal approval form before changing the opportunity stage to more than 30%.")

           var options = Xrm.Page.getAttribute("company_stage").getOptions();

           for (i = 0; i < options.length; i++) {

               if (options[i].text.indexOf("20") > -1) {

                   Xrm.Page.getAttribute("company_stage").setValue(options[i].value);

                   Xrm.Page.getAttribute("closeprobability").setValue(20);

               }

           }

           return false;

       }

    }

    function AdminAccessRequired() {

       var isAdmin = Xrm.Page.getAttribute("company_isadmin").getValue();

       var unit = Xrm.Page.getAttribute("company_opportunitybusinessunit").getText();

       if ((isAdmin != "true") && ((unit.toString()).indexOf("UK") > -1)) {

           alert("You don't have the rights to set an opportunity to 100%. Please contact System Administrator.")

           var options = Xrm.Page.getAttribute("company_stage").getOptions();

           for (i = 0; i < options.length; i++) {

               if (options[i].text.indexOf("90") > -1) {

                   Xrm.Page.getAttribute("company_stage").setValue(options[i].value);

                   Xrm.Page.getAttribute("closeprobability").setValue(90);

               }

           }

       }

    }

    This is the query i have written. Please suggest.

  • Bas van de Sande Profile Picture
    4,383 on at

    Hi Girijesh,

    Javascript support on mobile clients is limited anyway. I was wondering what form do you see on the mobile android chrome browser?  the mobile express form or the standard form?

    Looking forward to hear from you

    Bas

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