web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Content Snippets in Javascript

(0) ShareShare
ReportReport
Posted on by

I have a requirement to show the Terms & Conditions on portal profile page.

So, I have been storing the T&C text in the contact field and showing that content in a modal.

Now, the requirement is to show the T&C based on the preferred language.

I thought of adding the T&C text in content snippets, but I don't have the faintest idea of how to display the content snippets in the javascript.

Can any of you suggest a way to achieve this? Is there any other way instead of:
1. storing the t&c text in a different entity with the language lookup and fetching that information using odata and displaying it in the modal

2. if I were to use content snippets, how would i use them in the script?

*This post is locked for comments

I have the same question (0)
  • Sahithi Profile Picture
    on at
    RE: Content Snippets in Javascript

    I actually used global variable. So, the same code is working.

    Thank you.

  • Verified answer
    oliver.rodrigues Profile Picture
    4,052 on at
    RE: Content Snippets in Javascript

    I am actually not using JS files within the Web Files.. for this we need to enable CRM to allow JS as notes attachments, which in my projects I prefer not to

    but even though.. I understand you are having a generic JS in the Web Files is that the case? I would imagine the same code should work fine there

  • Sahithi Profile Picture
    on at
    RE: Content Snippets in Javascript

    Hi Oliver,

    I'm only able to access content snippets from javascript if I write the script on the web page 'Copy(HTML)' or 'Custom Javascript'.

    I'm not able to get the content snippets through the javascript code used in the webfiles.

    Is there a way to get the content snippet value in the webfiles as well?

  • Verified answer
    oliver.rodrigues Profile Picture
    4,052 on at
    RE: Content Snippets in Javascript

    to get a content snippet through JS use the following syntax:

    var title = '{{ snippets["YOUR SNIPPET NAME"] }}';

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans