• prithvi kumar
  • NEWBIE
  • 39 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 11
    Replies
Hey,

Anyone notifce the lightning carousel posted here:

https://developer.salesforce.com/blogs/developer-relations/2015/06/creating-carousel-lightning-component.html

Does not work anymore? Is it just me or does the swipe action not funcation at all? Anyone have any idea why the swiping functionality stopped working? I'm looking to implement a carousel for a project with the lightning design system.

Thanks,
Hi All,

I have visualforce component implementing Carousel . Images are not sliding. Here is the component page code:

<aura:component implements="force:appHostable" >
<ltng:require styles="/resource/bootStrapCss"/>    
<ltng:require scripts="/resource/jQuery,/resource/bootStrapJS" afterScriptsLoaded="{!c.doinit}" />
    
  <div class="container">
  <h2>Activate Carousel with JavaScript</h2>
  <div id="myCarousel" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
      <li data-target="#myCarousel" data-slide-to="0" class="item1 active"></li>
      <li data-target="#myCarousel" data-slide-to="1" class="item2"></li>
      <li data-target="#myCarousel" data-slide-to="2" class="item3"></li>
      <li data-target="#myCarousel" data-slide-to="3" class="item4"></li>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">

      <div class="item active">
          <img src="http://mu.ac.in/portal/wp-content/uploads/2012/01/univeristy-of-mumbai.jpg" alt="Chania"  height="345"></img>
        <div class="carousel-caption">
          <h3>Chania</h3>
          <p>The atmosphere in Chania has a touch of Florence and Venice.</p>
        </div>
      </div>
    <div class="item">
        <img src="http://studentcompetitions-general.s3.amazonaws.com/cyp-2014/img/lundsuniversitet_-_b.jpg" alt="Chania"  height="345"></img>
        <div class="carousel-caption">
          <h3>Chania</h3>
          <p>The atmosphere in Chania has a touch of Florence and Venice.</p>
        </div>
      </div>
    
      <div class="item">
        <img src="http://kinesiology.rice.edu/uploadedImages/sc_rice.jpg" alt="Flower" width="460" height="345"></img>
        <div class="carousel-caption">
          <h3>Flowers</h3>
          <p>Beatiful flowers in Kolymbari, Crete.</p>
        </div>
      </div>

      <div class="item">
        <img src="http://orientaluniversity.in/wp-content/uploads/2016/02/banner-1.jpg" alt="Flower" width="460" height="345"></img>
        <div class="carousel-caption">
          <h3>Flowers</h3>
          <p>Beatiful flowers in Kolymbari, Crete.</p>
        </div>
      </div>
  
    </div>

    <!-- Left and right controls -->
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
      <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
      <span class="sr-only">Previous</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
      <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
      <span class="sr-only">Next</span>
    </a>
  </div>
</div>
 
</aura:component>

Here is the controller code:
({
    doinit : function(component, event, helper) {
        $(document).ready(function(){
    // Activate Carousel
    $("#myCarousel").carousel();
    
    // Enable Carousel Indicators
    $(".item1").click(function(){
        $("#myCarousel").carousel(0);
    });
    $(".item2").click(function(){
        $("#myCarousel").carousel(1);
    });
    $(".item3").click(function(){
        $("#myCarousel").carousel(2);
    });
    $(".item4").click(function(){
        $("#myCarousel").carousel(3);
    });
    
    // Enable Carousel Controls
    $(".left").click(function(){
        $("#myCarousel").carousel("prev");
    });
    $(".right").click(function(){
       // alert('next start');
        $("#myCarousel").carousel("next");
        // alert('next end');
    });
});
    }
})

Please suggest any solution.
Hi All,

I am new to Salesforce Lightning.Can anyone give me an example of Carousel implementation through Salesforce lightning ? 
Hello Everyone,

While doing callout getting the error :: 
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out .

Actually i am sending request to 3rd party system based on the response iam upserting records in salesforce.
When i was doing with 1 record, it is working fine. But when i tried with bulkified manner getting the above error.

So while research i got an idea that i need to seperate the transactions for both the Callout's and DML's.
Is there any function or method that callout has been done, with that i can seperate both the transactions for DML's in salesforce and Callouts

How can i avoid this particular error??  Please suggest me !!!
I've created a class to make a callout, the JSON seems to be formatted right, but when trying to deserialize it I get the above error. What am I doing wrong?

Here is the debug log showing how the request is fomatted:
17:54:08.083 (83420512)|USER_DEBUG|[67]|DEBUG|jsonOrders: {
  "entities" : [ {
    "attributes" : {
      "type" : "DatacloudCompany"
    },
    "Name" : "GE Healthcare Institute",
    "Country" : "United States",
    "Phone" : "(262) 951-2047"
  } ],
  "matchoptions" : {
    "fields" : "City, CompanyId, Country, Description, DunsNumber, Name, Website, YearStarted, Zip",
    "matchEngine" : "DunsRightMatchEngine",
    "maxMatchResults" : "6",
    "minMatchConfidence" : "5",
    "rule" : "DunsRightMatchRule",
    "sObjectType" : "DatacloudCompany"
  }
}
This seems to be right based on the dev guide https://developer.salesforce.com/docs/atlas.en-us.datadotcom_api_dev_guide.meta/datadotcom_api_dev_guide/request_understanding_a_request.htm#request_understanding_a_request

However when it gets to this line in my code I get the error:
Entities ddcdata =
              (Entities)JSON.deserialize(res.getBody(),
                Entities.class);
                    System.debug('ddcdata: ' + ddcdata);

Here is the full class:
public class Lead_fromJSON{


	public class Attributes {
		public String Type {get;set;}
	}

	public class Entities {
		public Attributes Attributes;
		public String Name {get;set;}
		public String Country {get;set;}
		public String Phone {get;set;}
	}

	public class Matchoptions {
		public String fields;
		public String matchEngine {get;set;}
		public String maxMatchResults {get;set;}
		public String minMatchConfidence {get;set;}
		public String rule {get;set;}
		public String sObjectType {get;set;}
	}

	public List<Entities> Entities;
	public Matchoptions matchoptions;

     @future (callout=true) // indicates that this is an asynchronous call
    public static void postOrder(List<String> leadIds) {

     List<Lead> ld = [SELECT Id, Company, Country, phone FROM Lead where Company IN :leadIds];
        System.debug('leadinfo: ' + ld);
         for (Lead l : ld)    {
    	        // Create a JSON generator object
        JSONGenerator gen = JSON.createGenerator(true);
        // open the JSON generator

            gen.writeStartObject();
            gen.writeFieldName('entities');
            gen.writeStartArray();
            gen.writeStartObject();            
            gen.writeFieldName('attributes'); 
            gen.writeStartObject();
            gen.writeStringField('type', 'DatacloudCompany');
            gen.writeEndObject();    
            gen.writeStringField('Name', l.Company);
            gen.writeStringField('Country', l.Country);
            gen.writeStringField('Phone', l.phone);
            gen.writeEndObject(); 
            gen.writeEndArray();
            gen.writeFieldName('matchoptions');            
            gen.writeStartObject();
            gen.writeStringField('fields', 'City, CompanyId, Country, Description, DunsNumber, Name, Website, YearStarted, Zip');
            gen.writeStringField('matchEngine', 'DunsRightMatchEngine');
            gen.writeStringField('maxMatchResults', '6');
            gen.writeStringField('minMatchConfidence', '5');
            gen.writeStringField('rule', 'DunsRightMatchRule'); 
            gen.writeStringField('sObjectType', 'DatacloudCompany');           
            gen.writeEndObject(); 
            gen.writeEndObject();

                                 
        // close the JSON generator

        // create a string from the JSON generator
        String jsonOrders = gen.getAsString();
        // debugging call, which you can check in debug logs
        System.debug('jsonOrders: ' + jsonOrders);



        // create an HTTPrequest object    
        HttpRequest req = new HttpRequest();
        // set up the HTTP request with a method, endpoint, header, and body
        req.setMethod('POST');
        req.setEndpoint('https://cs15.salesforce.com/services/data/v32.0/match/DunsRightMatchEngine/DatacloudCompany/DunsRightMatchRule');
        req.setHeader('Content-Type', 'application/json');
        req.setBody(jsonOrders);    
        // create a new HTTP object
        Http http = new Http();
        // create a new HTTP response for receiving the remote response
        // then use it to send the configured HTTPrequest
        HTTPResponse res = http.send(req);




{
            // Retrieve all of the Lead records
            // originally passed into the method call to prep for update.           
            List<Lead> leads =
              [SELECT Id FROM Lead WHERE Id IN :ld];
            // Create a list of entities by deserializing the
            // JSON data returned by the fulfillment service.
            Entities ddcdata =
              (Entities)JSON.deserialize(res.getBody(),
                Entities.class);
                    System.debug('ddcdata: ' + ddcdata);
            // Create a map of Lead IDs from the retrieved
            // invoices list.
            Map<String, Lead> leadMap =
              new Map<String, Lead>(leads);

            {
              Lead lead = leadMap.get(ddcdata.Name);
              if (ddcdata.Name != null)
              lead.Company = String.valueOf(ddcdata.Name);
              lead.phone = String.valueOf(ddcdata.phone);
            }
            // Update all leads in the database with a bulk update
            update leads;
        }
        
         }      
    }
}


 

I need to create a KnowledgeArticle object for my test class. but there no DML operations allowed on KnowledgeArticle. 

Any idea how I could bypass this?

 

Thank you  

 

  • November 14, 2012
  • Like
  • 0

I have a public knowledge base setup in my DEV org, that works fine, however, in a customer sandbox the following error is reported:

 

09:46:17.247 (247510000)|EXCEPTION_THROWN|[184]|System.QueryException: Invalid data category group name provided: Locations. There is no category group matching the provided data category group developer name.

 

The category 'Locations' is defintely created and the KB works fine inside the native SF UI.

 

However, the enhanced profile view does not seem to have a capability to allocate a data category to the 'guest user license', the related list does not appear even when the 'enable enhanced profile user interface' checkbox is deselected in the UI section.

 

The general data category setup is set to 'All' under Customise > Data Categories > Data Category Setup

 

Francois - please could you assist?

 

Thanks.

  • February 29, 2012
  • Like
  • 0