Skip to Content
0
Jul 22, 2016 at 04:55 AM

How to read the response from Create service in SAPUI5

1399 Views

Hi Experts,

I am working on the Custom Application Development, In My Application Scenario i need to create the New Incident based on the user comments. It is getting created successfully. After getting created in my another tile(in same app i am using two tile for create and display), i need to show the list of created incidents with incident ID.

In this scenario after created incident i want to show an alert message with Incident ID. From the back-end they have created create Enityset with response. How do i get it in my UI5 code? Should i need to write any response code inside the success function of oModel.create?

///////code starts

oModel .create( "/Incident_createSet", oCreateSet, null,

function() {

// MessageBox.confirm( // "Approve purchase order 12345?" // );

dialog = new Dialog({ title: 'Success', type: 'Message', state: 'Success', content: new Text({ text: "Your ticket has been created successfully" }), beginButton: new Button({ text: 'OK', press: function() { dialog .close();

} }), afterClose: function() {

dialog .destroy(); } });

dialog.open();

},

function() {

dialog = new Dialog({ title: 'Error', type: 'Message', state: 'Error', content: new Text({ text: 'Failed to create.Service Error .' }), beginButton: new Button({ text: 'OK', press: function() { dialog .close(); } }), afterClose: function() {

dialog .destroy(); }

///////code ends

Thank you,

Regards,

JK