Skip to Content

Fiori elements: how to add confirmation popup

I have created a List Report application from Fiori elements smart template with local annotations. Then I added a custom button for the table with UI.DataFieldForAction annotation.

Requirement is to get user confirmation before executing the action on the table item.

Any suggestions how do I add a confirmation popup on the new button "Notify customer"?

Annotation for the button:

<Annotations Target="NorthwindModel.Customer"> 
<Annotation Term="UI.LineItem"> 
<Collection>
.. 
<Record Type="UI.DataFieldForAction">
<Annotation Term="UI.InvocationGrouping" EnumMember="UI.OperationGroupingType/ChangeSet"/>
<PropertyValue Property="Label" String="Notify customer"/>
<PropertyValue Property="Action" String="NorthwindModel/CustomerNotify"/>
</Record>
</Collection>
</Annotation> 
.. 
</Annotations>

Full code of the WEB IDE project is here https://github.com/oanete/ztest

Regards,

Anete

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Dec 14, 2016 at 06:22 AM

    I think you can accomplish your goal by extending your app.

    https://sapui5.hana.ondemand.com/#docs/guide/bee197e9ca9c485188d4ed5db9274374.html

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 09, 2016 at 10:14 AM

    Hi Anete

    Btw the standard delete action includes a confirmation pop-up by default.

    If you want to add a pop-up for your own actions, the answer you are looking for can be found here:

    https://sapui5.hana.ondemand.com/#docs/guide/8ba009d7b8434dc1a4948c9211e30c40.html

    You need to add an annotation for your target and set the IsActionCritical annotation to true .. like the fragment below. Don't forget to let us know if that solved your problem.

    Rgds,

    Jocelyn

    <Annotations Target="NorthwindModel/CustomerNotify">
            <Annotation Term="com.sap.vocabularies.Common.v1.IsActionCritical" Bool="true"/>
    </Annotations>
    
    Add comment
    10|10000 characters needed characters exceeded

  • Dec 13, 2016 at 02:46 PM

    Hi Anete,

    If NOTIFY CUSTOMER is a button then u can write code for a dialog after pressing the button function.

    Thanks,

    Deepak Raj.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 08, 2016 at 02:22 AM

    Hi Anete,

    This is very simple please refer below link for sample application with the complete code.

    https://sapui5.netweaver.ondemand.com/sdk/explored.html#/sample/sap.m.sample.DialogConfirm/preview

    UI5 Code:

    <Button text="Approve" width="250px" press="onApproveDialog" />

    JavaScript Code:

    onApproveDialog: function () {			
    var dialog = new Dialog({ title: 'Confirm',				
                              type: 'Message',				
                              content: new Text({ text: 'Are you sure you want to submit your shopping cart?' }),				beginButton: new Button({ text: 'Submit', press: function () { MessageToast.show('Submit pressed!');			 dialog.close(); } }), endButton: new Button({ text: 'Cancel', press: function () {						dialog.close(); } }), afterClose: function() { dialog.destroy(); } });
    dialog.open(); }, 

    Thank you.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 03, 2017 at 12:35 PM

    Hi,

    I have the same requirement .. I have defined my action in a BOPF and then used the CDS view annotation to render it in the UI, I'd like to have a popup to confirm the action.

    Can this be done with CDS annotations or does it have to be done in the WEBIDE?

    Add comment
    10|10000 characters needed characters exceeded