Custom Create view is not correctly coped to cache

I have a bit of an odd issue here, and I'm not sure if it's me, or something wrong in the code.

I'm using 7.6 and having successfully extended the RecordView, I'm attempting to do the same in create.

All seems to go well for a while. I create custom/modules/Accounts/clients/base/views/create-actions/create-actions.js with some code to extend it (i.e. extendsFrom:'CreateActionsView') , and repair and rebuild.

Upon clearing the cache folder, the rebuild shows a new area, but causes a syntax error due to the unexpected } below:

"customCreate": {"controller": 
  // CustomCreate View (base) 
 },

What is going on here? My CustomRecord View shows all of the code I wrote in it just above this area. I had to manipulate the cache file to even get back in to repair.

Has anyone else experienced this?

Parents
  • Can you post the entire custom/modules/Accounts/clients/base/views/create-actions/create-actions.js

    There may be something in the way you wrote the extension that causes the syntax error.

    Mine looks something like this:

    ({

     

        extendsFrom: 'CreateActionsView',

        initialize: function (options) {

           this._super('initialize', [options]);

           this.hideLegacyValues();

        },

       hideLegacyValues: function(){

           <my code here>

       },

       _dispose: function() {

          this._super('_dispose');

       },

     

    })

     

    Also, on a side note you should know that changes are coming: CreateActionsView changes in Sugar 7.7.0 « Sugar Developer Blog – SugarCRM

     

    HTH

    FrancescaS

  • Hi Francesca,

    Thanks very much, I should have tried to start small and work up from there. Having put a console message in the method you wrote, I no longer get any errors when re-building.

    However, I now just get a blank white drawer when doing the quick create at the top right.

    Here's the code in custom/modules/Accounts/clients/base/views/create-actions/create-actions.js

    ({
    
    
        extendsFrom: 'AccountsCreateActionsView',
        initialize: function (options) {
            this._super('initialize', [options]);
            this.doSomething();
        },
    
    
        doSomething: function(){
            console.log("This is now in use");
        },
        _dispose: function() {
            this._super('_dispose');
        },
    
    
    })
    
  • Hi Richard,

    Your code looks proper.can you check the same in cache folder.

    File path will be

    crm/cache/javascript/base

    Here you will find two files.Open both files,search with " extendsFrom: 'AccountsCreateActionsView'" to make sure,your cache files are updated. and check for permission also. and check any error you are getting in your browser console.

    Thanks!.

Reply
  • Hi Richard,

    Your code looks proper.can you check the same in cache folder.

    File path will be

    crm/cache/javascript/base

    Here you will find two files.Open both files,search with " extendsFrom: 'AccountsCreateActionsView'" to make sure,your cache files are updated. and check for permission also. and check any error you are getting in your browser console.

    Thanks!.

Children
  • Hi Ajay,

    Interestingly, when I did a few repair and rebuilds and checked the cache file, I now have the same problem as above. Unexpected token } with the same code.

    I can confirm that my code for the create-actions.js file is exactly the same as above, and in the same location.

  • I suspect there is an error in other js file.Can you check in browser console.It will give you line number for where } is missing.Then check code in that line and near that.It will help you to figure it out issue.Once changes made in cache files,update the same in where that code comes from I mean from which module it is comes from.Then only it wont through next time } is unexpected.

  • Hi Ajay,

    The error is not within my file which is identical to the one above. The issue is that within the cached js file, there is an area (also displayed above in the original post) that is not being written correctly when the cache file is re-written. Should I be raising a bug report for this?

  • Are you extending a custom view?

    I don't believe the view you are extending exists in SugarCRM stock.

    try extending

              CreateActionsView

    instead of

              AccountsCreateActionsView

     

    HTH,

    FrancescaS

  • Thanks Francesca! That's done it!

    Don't know why it didn't seem to work previously. Perhaps an older version was still cached.

    I now see the following in the cache file, get the console message, and no white screen:

    "customCreate-actions": {"controller": ({

      // CustomCreate-actions View (base)

        extendsFrom: 'CreateActionsView',

        initialize: function (options) {

            this._super('initialize', [options]);

            this.doSomething();

        },

        doSomething: function(){

            console.log("This is now in use");

        },

        _dispose: function() {

            this._super('_dispose');

        },

    }) },