how to extend default endpoints

i want to create a url that can go directly to the create view for a subpanel. more specifically i want a url like this

http://sugarcrm/#Contacts/1234-5435-6556-6557/calls/create

to load the record view for the contact and then on render run some js to open the create form for the calls subpanel.

custom end points arent working because they use /rest/v10. i think i need to extend or create the default #<module> endpoints?

how is that done?

  • Ok so I was going about this the wrong way. You need to use ROUTES, not endpoints.

    Here's what I did to get it working.

    Create file include/javascript/custom_routes.js

    (function(app){ app.events.on("router:start", function(){
        //Example route #Contacts/1234/Calls/create
        app.router.route(":module/:id/:subpanel/create", "create_related_record", function(module,id,subpanel) {
            app.router.record(module, id, null, 'record');

            var parentRecord = app.data.createBean(module, {
                id: id
            });
            parentRecord.fetch({
                success: function(data) {
                    app.drawer.open({
                        layout: 'create',
                        context: {
                            create: true,
                            module: subpanel,
                        }
                    });
                }
            });
        });
    })
    })(SUGAR.App);

     

    Use jsgroupings to add the file to the to sugar_grp8.min.js

    http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.6/Extension_Framework/JSGroupings/ 

    Repair and rebuild. Done.