'On Error' action in Community

edited June 25, 2020 in Questions
I have a javascript snippet and an associated "on-error" action that work just fine when I preview my page inside of Salesforce.  The "on-error" action should display a pop-up.  But, when I test the page inside of the Community, the pop-up does not show up.  My button just gets grayed out and nothing happens on the page.  I thought this could be a browser pop-up issue, but other pop-ups inside the Community ARE working.


  • Pat VachonPat Vachon 💎💎💎
    edited June 25, 2020
    Any errors in console?
  • edited June 25, 2020
    No errors, but I see different things in the console in internal SF vs. the Community.  




    The Javascript is looking at the difference between today's date (2018-04-12) and a date field (2018-04-02, in this case) to make sure they are greater than 18 years and throws an error if not.  

    Here's what my Javscript looks like (I'm checking to see if a new Patient is less than 18 years old; if so, an alternate contact is required).  

    $ = skuid.$;

    var     Patient = skuid.$M('PatientAccount'),
            thePatient = Patient.getFirstRow();

    var     bday = Patient.getFieldValue(thePatient, 'PersonBirthdate' );
    var     AltContact = Patient.getFieldValue(thePatient, 'Alternate_Contact_Name__c');
    var     override = Patient.getFieldValue(thePatient, 'NoAlternateContact');
    var     today = skuid.time.getSFDate(new Date());
    var     millisecondsperday = 24 * 60 * 60 * 1000;
    var     diff = (skuid.time.parseSFDate(today)-skuid.time.parseSFDate(bday))/ millisecondsperday / 365.2424;

    returnVal = true;

    //Create your conditional statements
    if ( AltContact === null && ( diff  < 18 )  && override !== true )  {
        returnVal = false;

    return returnVal;
  • Pat VachonPat Vachon 💎💎💎
    edited April 13, 2018
    Does the Profile used in the community have access to all the fields in the models?
  • edited April 13, 2018
    Yes.  It's just two fields - Alternate_Contact_Name__c and PersonBirthdate.  I checked access for both.  (Thanks for thinking about this, Pat!)
  • edited April 20, 2018
    "returnVal = true;" should be "var returnVal = true;"
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!