Direct Answers - "View Details" for custom entity

Greetings,

I have a field on my custom recipe entity configured for direct answers. I can’t get the “View Details” CTA to appear.

I see that the standard direct answers card pulls from relatedItem.data.website.

viewDetailsText: 'View Details', // Text below the direct answer
      viewDetailsLink: relatedItem.data.website, // Link for the “view details” text
      viewDetailsEventOptions: this.addDefaultEventOptions({
        ctaLabel: 'VIEW_DETAILS'

However, my custom entity doesn’t have a field called website. I does have a field called landingPageUrl

I followed the steps outlined in this unit, forked a direct answers card and tried it with
viewDetailsLink: relatedItem.data.landingPageUrl
and
viewDetailsLink: relatedItem.data.profile.landingPageUrl
but neither seem to work.

Could you let me know what I might be doing wrong?

Thanks,
Max

Hi Max,

Great question, you’re super close here. You’ll want to add “fieldValues” to your syntax since the landingPageUrl field is nested under “fieldValues”. If you only include “data” and not “fieldValues” it does not find the Landing Page field you’re looking for. For your reference, you can see that in the liveAPI results under relatedItem.

Your syntax would be as follows to pull landingPageUrl:
viewDetailsLink: relatedItem.data.fieldValues.landingPageUrl

Lastly, don’t forget to populate the landing page URL field in Knowledge Graph with the URLs you’d like to see!

Best,
Alyssa

Thanks! Works like a charm :slight_smile: