Search code examples
google-apps-scriptgoogle-app-maker

How do customize a popup like Snackbar or Notification dialog with a message?


I am trying to include a feature in my app that examines the values of a column in a user-uploaded Google sheet and verifies whether they are correct or not. If there are any incorrect values, a popup like Snackbar or Notification dialog will appear listing the incorrect values. If there are no incorrect values, no popup will appear. How do you display a popup with different values depending on the situation? Is there a way to display unique popups directly from the ServerScript without having to create separate pages? Thank you very much!


Solution

  • You can do it either by direct interaction with Snackbar's children widgets or by binding them to Custom Properties:

    // option 1
    app.popups.Snackbar.descendants.SnackbarText.text = message;
    
    // option 2
    app.popups.Snackbar.properties.Text = message;
    
    app.popups.Snackbar.visible = true;
    

    You can see first option implementation sample here - https://developers.google.com/appmaker/samples/jdbc/