Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

229
Vistas
Google Apps Scripts: Confundido acerca de cómo actualizar tarjetas

¿Cómo se actualizan los datos en PropertiesService y se muestran en otra Tarjeta?

Los datos siempre parecen obsoletos, o la tarjeta/IU está obsoleta.

Por ejemplo...

  1. Configura un proyecto para Google Calendar. Ejecute la función buildInitState para inicializarlo
 // appsscript.json // set the trigger to build the home .... .... "addOns": { "calendar": { "homepageTrigger": { "enabled": true, "runFunction": "buildInitState" } }, "common": { .... ....
  1. Función de inicialización para construir la tarjeta de inicio
 const userStore = PropertiesService.getUserProperties(); // setup userStore and add default values for date userStore.setProperties({ date: (new Date()).getTime(), }); const showSettingsPageAction = CardService.newAction().setFunctionName('showSettingsPage'); const handleDateChangeAction = CardService.newAction().setFunctionName('handleDateChange'); function handleDateChange(e) { //change the date to what user selects const newDate = (new Date(e.formInput.date_field.msSinceEpoch)).getTime(); userStore.setProperty('date', newDate); } // Homepage card function buildInitState(e) { const mainCard = CardService.newCardBuilder(); // add a date picker const DatePicker = CardService.newDatePicker() .setTitle('set date') .setFieldName('date_field') .setValueInMsSinceEpoch((new Date()).getTime()) .setOnChangeAction( CardService.newAction().setFunctionName('handleDateChangeAction') ); // add a button to nav to another card const ButtonFindSlots = CardService.newTextButton() .setText('NAV TO SETTINGS CARD') .setOnClickAction(showSettingsPageAction); mainCard .addSection(DatePicker) .addSection(ButtonFindSlots) mainCard.build(); }
  1. showSettingsPage crea una nueva tarjeta.
 function showSettingsPage() { const card = CardService.newCardBuilder(); const cardSection = CardService.newCardSection(); let content = userStore.getProperty('date'); let p = CardService.newTextParagraph().setText(content); card.addSection(cardSection); return card.build(); }

Incluso cuando el usuario cambia la fecha en la tarjeta de inicio y navega a la página de configuración, la fecha siempre muestra el valor de fecha predeterminado.

No estoy seguro si los datos no se actualizan o la tarjeta no se actualiza. Intenté leer los documentos sobre las respuestas de acción, pero no entiendo que se supone que funciona.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda