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)

Reference field in HTML Web Resource to create URL

(0) ShareShare
ReportReport
Posted on by

Just starting out and not a programmer.

I have a linkedin reference on my contact form and a URL in the field "gvd_linkedin"

My web resource includes the following script from the linkedin site.

<html>

<head><script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<meta charset="utf-8"></head>

<body><script type="IN/MemberProfile" data-format="inline" data-id=https://www.linkedin.com/in/myprofile></script></script></body>

</html>

Whilst this works fine for showing my profile I want to replace the url with the field "gvd_linkedin" from the contact form.

Cheers.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Reference field in HTML Web Resource to create URL

    Thanks Mahadeo, Unfortunately this did not work for me.

    I ended up getting salesmetrix.com code to work in CRM 2015 as follows.

    Where new_linkedin is my field name which contains the full public url from linkedin for each contact and is on the form, and api_key is my own as retrieved from www.bingmapsportal.com

    <html><head>

     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>

     <script src="platform.linkedin.com/in.js&quot; type="text/javascript">

      // api_key: xxxxxxxxxxxxxxxxxx

       </script>

     <meta charset="utf-8">

    </head>

    <body>

     <script type="text/jscript">

      try {

       // Retrieve the profile url form dynamics field

       var linkedprofilelink = window.parent.Xrm.Page.getAttribute("new_linkedin").getValue();

        if (linkedprofilelink != null) {

         // Load the profile

        newmemberprofile(linkedprofilelink);

       }

      }

      catch (e) {

        alert(e.message);

      }

      function newmemberprofile(id) {

       // Create the script tag

       var $s = $('<script/>');

       // Assign the attributes

       $s.attr({

        'type': 'IN/MemberProfile',

        'data-id': id,

        'data-related': 'false',

        'data-format': 'inline',

        'data-width': '350px'

       });

       // Inject the tag

       $('body').append($s);

      }

     </script>

    </body></html>

  • Mahadeo Matre Profile Picture
    17,021 on at
    RE: Reference field in HTML Web Resource to create URL

    hi Elderor,

    I modified your code.. try this.

    <html>

    <head>

       <script src="platform.linkedin.com/in.js&quot; type="text/javascript"></script>

       <script type="text/javascript">

           function createUrl() {

               var linkedinContact = Xrm.Page.data.entity.attributes.get('gvd_linkedin').getValue();

               var memberscrpt = document.getElementById('memberScript');

               memberscrpt.setAttribute("data-id", linkedinContact);

           }

    </script>

       <meta charset="utf-8">

    </head>

    <body onload="createUrl()">

       <script id="memberScript" type="IN/MemberProfile" data-id="www.linkedin.com/.../&quot;></script>

    </body>

    </html>

    Hope this will solve your problem.

  • Community Member Profile Picture
    on at
    RE: Reference field in HTML Web Resource to create URL

    Thanks for the pointers. Nearly there I believe.

    data-id=???? What I have does not work. I need to reference the var linkedinContact

    <html><head>
    <script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
    <script type="text/javascript">
    function createUrl() {
    var linkedinContact = Xrm.Page.data.entity.attributes.get(“gvd_linkedin”).getValue();
    }
    </script>
    <meta charset="utf-8">
    </head>

    <body onload="createUrl()">
    <script type="IN/MemberProfile" data-id=linkedinContact></script>

    </body></html>

  • Aileen Gusni Profile Picture
    44,524 on at
    RE: Reference field in HTML Web Resource to create URL

    Elderor,

    Guido provided the script that you can use, it is dynamically based on the field value.

    Additional references:

    crmjavascripts.blogspot.com/.../how-to-get-crm-entity-attribute-value.html

    stackoverflow.com/.../cannot-access-xrm-page-data-from-within-html-web-resource-in-crm-2011

    community.dynamics.com/.../get-customer-address-in-sales-entities-using-html-web-resource.aspx

    Thank you.

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