From 6a4bec932a93b939f5e71320a06efe2ebd1d36a7 Mon Sep 17 00:00:00 2001 From: Pierrick Voulet <6769971+PierrickVoulet@users.noreply.github.com> Date: Fri, 23 Feb 2024 11:27:56 -0500 Subject: [PATCH] feat: Use link preview builder from Card Service --- apps-script/3p-resources/3p-resources.gs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps-script/3p-resources/3p-resources.gs b/apps-script/3p-resources/3p-resources.gs index ea2d159..b6e5c87 100644 --- a/apps-script/3p-resources/3p-resources.gs +++ b/apps-script/3p-resources/3p-resources.gs @@ -35,13 +35,15 @@ function caseLinkPreview(event) { .setTitle(`Case ${caseDetails["name"][0]}`); const caseDescription = CardService.newTextParagraph() .setText(caseDetails["description"][0]); - - // Returns the card. - // Uses the text from the card's header for the title of the smart chip. - return CardService.newCardBuilder() + const card = CardService.newCardBuilder() .setHeader(caseHeader) .addSection(CardService.newCardSection().addWidget(caseDescription)) .build(); + + // Returns the link preview smart chip with its dedicated title. + return CardService.newLinkPreview() + .setTitle(`Case ${caseDetails["name"][0]} - caseDetails["description"][0]`) + .setPreviewCard(card); } } @@ -268,4 +270,4 @@ function createLinkRenderAction(title, url) { } // [END add_ons_3p_resources_link_render_action] -// [END add_ons_3p_resources] \ No newline at end of file +// [END add_ons_3p_resources]