Sidecar: Create new bean with id

Idea created by Pedro Bazan on Oct 29, 2015
    Active
    Score45
    • Francesca Shiekh
    • Pedro Bazan
    • André Lopes
    • Oscar Castro
    • Caim Astraea
    • Adrian Dinu
    • Noah Hall
    • sergejk
    • Jeff Bickart
    Hi guys, 

    I developed this little script to create a new bean with pre-fill ID  from Sidecar forcing to use the POST http verb.

    ({    events:{      'click .button': '_createMeeting',    },    _createMeeting: function(){      var meeting = app.data.createBean('Meetings');      meeting.set({          // Create its UUID          id: app.utils.generateUUID(),          name: 'Test',               date_start: '2015-09-15'+'T09:00:00',          duration_minutes: 30,          duration_hours: 0,          parent_type: 'Accounts',          parent_id: '387643b8-626b-2a7c-86ff-55a5f9c3b44e',          parent_name: 'Acount test'      });      // Force to save with POST      meeting.id=null;      meeting.save();     }  })
    What do you think?

    I hope it will be useful for you.