Waiting to execute javascript once page is fully loaded in Sugar 7

I need to hide a button in record view depending on the status

The problem I have is that the page needs to be fully loaded before I run the javascript to hide it

How can I do this?

I tried $( document ).ready(function() { but that doesnt work

Any ideas will be gratefull received

Sugar 7 is beginning to seriously depress me :(




Parents
  • Thanks

    I tried :

    $(document).on('load', function() {alert(1)})         
    $(window).load(function() {alert(2)})

    neither are triggered :(

    I think I may need to use $.when( to check if page is loaded but can't work out how at the moment

    This is incredibly frustrating 

    Is it only me that is finding doing the simplest things in sugar 7 is really difficult?

    I asked someone from Sugar and was pointed to the Adding Field Validation document but that is worse than useless for what I'm trying todo



  • Mike,

    The url Esteban posted is actually really useful, if you need to do validation on a field. The secret seems to be the naming convention of fields. You can find more examples on the 7.2 version: http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_7.2/20_UI_Mode... 

    I also just built a small gist example for you, based on the Cases module, that triggers when the priority of a Case set to High.
    Write the content of the gist https://gist.github.com/esimonetti/192f02635651e8b96d91 into "custom/modules/Cases/clients/base/views/record/record.js" and execute a repair/rebuild from the administration area. Then refresh your browser on a case's view and you should see a message getting logged on your browser's console.

    Cheers,
    Enrico Simonetti
    InsightfulCRM Australia

    --

    Enrico Simonetti

    Sugar veteran (from 2007)

    www.naonis.tech


    Feel free to reach out for consulting regarding:

    • API Integration and Automation Services
    • Sugar Architecture
    • Sugar Performance Optimisation
    • Sugar Consulting, Best Practices and Technical Training
    • AWS and Sugar Technical Help
    • CTO-as-a-service
    • Solutions-as-a-service
    • and more!

    All active SugarCRM certifications

    Actively working remotely with customers based in APAC and in the United States

Reply Children
No Data