• Will M Smith
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
I've managed to import the Google Tag Manager code into the <head> using the lightning community settings tab. This loads perfectly fine and I can see the 'preview' window for google tag manager.

   
<!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
    <!-- End Google Tag Manager -->



However, when I try to access the 'dataLayer' or 'window.dataLayer' object in a lightning component controller, it appears as undefined. I understand this is due to the SecureWindow that has been implemented.

For example:

   
addCourseToCart : function(component, event, helper) {
      dataLayer.push({
        'event': 'addToCart',
        'ecommerce': {
          'currencyCode': 'EUR',
          'add': {                                // 'add' actionFieldObject measures.
            'products': [{                        //  adding a product to a shopping cart.
              'name': 'Triblend Android T-Shirt',
              'id': '12345',
              'price': '15.25',
              'brand': 'Google',
              'category': 'Apparel',
              'variant': 'Gray',
              'quantity': 1
             }]
          }
        }
      });
    },



Is there still no way at all I can access the dataLayer using lightning communities and components? If not, this unfortunately makes it a nightmare for my customer to track in-depth interactions on their community... I'm surprised Salesforce have overlooked this...
We're trying to pull down picklist values from the Contact object to show on an ASP.Net page using the Partner API. However, we receive the following error when the describeSObject call is made.
 
"Instance validation error: 'urn:address' is not a valid value for soapType."

It appears that the API can not handle objects with compound fields such as address.
Here is a snippet of the code which we are using.
 
public sforce.DescribeSObjectResult[] getTableOfPickListValues(string fieldName, string[] objectName)
{
    List<string> aList = new List<string>();

    try
    {
        binding.QueryOptionsValue = new sforce.QueryOptions();
        binding.QueryOptionsValue.batchSize = 500;
        binding.QueryOptionsValue.batchSizeSpecified = true;
        return binding.describeSObjects(objectName);
    }
    catch (Exception error)
    {

    }
}

We've tried old and new versions of the API/WSDL and this issue appears to persist throughout.

Is this a known issue with the Salesforce partner API or are we doing something wrong? I can't seem to find anyone having reported this before...

For what it's worth, we've done this several times for custom objects so we know our code works.
 
I'm currently building a lightning component for a community builder portal. The whole series of components is reasonably complex but nothing extreme (it's a wizard).

To make things easier I'm using a wrapper class with several objects and sub objects in. Again, it's more than just a simple wrapper class but nothing too complex.

When I bind a field using ui:inputText or ui:inputCheckbox, for example, it appears to be binding (in some cases, not all) to a non-existent field one level up the wrapper class object structure.

Looking at the screenshot below you can see 'Patient_Information_Checked__c'. This field sits on the appointment object. However, as you can see the value is being bound one level up (line 3 on the image) so when I try to save it doesn't submit the correct value...

User-added image

Here is a shortened version of my component code:
 
<aura:iteration items="{!v.treatments}" var="treatmentWrapper">
    <div>
        <aura:if isTrue="{!treatmentWrapper.isSelected == true}">
            <ui:inputCheckbox aura:id="checkbox-patientCheckReferrer" value="{!treatmentWrapper.appointment.Patient_Information_Checked__c}" class="checkbox"/>
        </aura:if>
    </div>
</aura:iteration>

Am I approaching this incorrectly? Or is there a known issue with using the ui:input series of fields and binding? I also tried using the lightning:input and I experience the same issue.

My workaround at the moment is duplicate the field as a String or Boolean in the outer most layer of my wrapper then copy in the value to the correct field on save... This isn't ideal for many obvious reasons.
I've managed to import the Google Tag Manager code into the <head> using the lightning community settings tab. This loads perfectly fine and I can see the 'preview' window for google tag manager.

   
<!-- Google Tag Manager -->
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
    <!-- End Google Tag Manager -->



However, when I try to access the 'dataLayer' or 'window.dataLayer' object in a lightning component controller, it appears as undefined. I understand this is due to the SecureWindow that has been implemented.

For example:

   
addCourseToCart : function(component, event, helper) {
      dataLayer.push({
        'event': 'addToCart',
        'ecommerce': {
          'currencyCode': 'EUR',
          'add': {                                // 'add' actionFieldObject measures.
            'products': [{                        //  adding a product to a shopping cart.
              'name': 'Triblend Android T-Shirt',
              'id': '12345',
              'price': '15.25',
              'brand': 'Google',
              'category': 'Apparel',
              'variant': 'Gray',
              'quantity': 1
             }]
          }
        }
      });
    },



Is there still no way at all I can access the dataLayer using lightning communities and components? If not, this unfortunately makes it a nightmare for my customer to track in-depth interactions on their community... I'm surprised Salesforce have overlooked this...
We're trying to pull down picklist values from the Contact object to show on an ASP.Net page using the Partner API. However, we receive the following error when the describeSObject call is made.
 
"Instance validation error: 'urn:address' is not a valid value for soapType."

It appears that the API can not handle objects with compound fields such as address.
Here is a snippet of the code which we are using.
 
public sforce.DescribeSObjectResult[] getTableOfPickListValues(string fieldName, string[] objectName)
{
    List<string> aList = new List<string>();

    try
    {
        binding.QueryOptionsValue = new sforce.QueryOptions();
        binding.QueryOptionsValue.batchSize = 500;
        binding.QueryOptionsValue.batchSizeSpecified = true;
        return binding.describeSObjects(objectName);
    }
    catch (Exception error)
    {

    }
}

We've tried old and new versions of the API/WSDL and this issue appears to persist throughout.

Is this a known issue with the Salesforce partner API or are we doing something wrong? I can't seem to find anyone having reported this before...

For what it's worth, we've done this several times for custom objects so we know our code works.