Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Content Snippets in Javascript

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

  • Sahithi Profile Picture
    Sahithi 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
    oliver.rodrigues 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
    Sahithi 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
    oliver.rodrigues 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans