• Sankeerth Reddy
  • NEWBIE
  • 145 Points
  • Member since 2017

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 19
    Replies

Hi friends,

I'm an admin just branching into apex development - so many of the examples I'm seeing around the forums have colored code, which makes it easier / faster to read. How do you actiate this? At the moment, all of my Salesforce code color is black (or maybe faintly colored but very dark), but I've seen many colored examples around like this one: https://www.dropbox.com/s/5krau2vfq9b2dru/Screenshot%202017-12-11%2013.16.17.jpg?dl=0

I can't find info anywhere online on how to change the coloring of the code while editing! If you could point me in the right direction I'd be really grateful!
Thanks,

Palmira

HI all, hope someone can help me here

SO I have been taking the apex academy on pluralsight to learn how to code in salesforce and its been a great starting point but have recentrly been stuck in my tracks now that mavensdmate is now not usable.  I am hoping that someone here is able to help recommend and show me step by step how to install and get running a new instance so I can get back to learning.  I have tried on my own but I have no idea what I am doing.  I have no idea which ones are good or work etc but any right now would be amazing.

Any help much appreciated.
Hi,

Can I write a 'after insert' trigger on EmailMessage object to edit the TextBody of incoming Mail?
Is it possible in Salesforce?

Hi friends,

I'm an admin just branching into apex development - so many of the examples I'm seeing around the forums have colored code, which makes it easier / faster to read. How do you actiate this? At the moment, all of my Salesforce code color is black (or maybe faintly colored but very dark), but I've seen many colored examples around like this one: https://www.dropbox.com/s/5krau2vfq9b2dru/Screenshot%202017-12-11%2013.16.17.jpg?dl=0

I can't find info anywhere online on how to change the coloring of the code while editing! If you could point me in the right direction I'd be really grateful!
Thanks,

Palmira

Hi All,

I am looking for a cron expression that runs my apex class every first week of Monday and Thursday in all months

I have tried to set up

expression = 0 0 1 ? * 2#1 which shows Fires at every first week on Monday,

but i am looking for something which runs my apex class on every first week of Monday and Thursday.....

I am looking forward to hear from you all.

This is quite urgent, please let me know as soon as possible.
I am not able to see Challenge section under Admin Beginner > Lightning Experience Customization > Create and Customize List Views.
Please take a look.
Thank you in advance !

User-added image
For handson challenge "Install an AppExchange dashboard package and make updates to one of the dashboards." i m getting error "Challenge Not yet complete... here's what's wrong: The 'New LEAD Trend by Source' dashboard component does not have the wedges set to 'Lead Source'. " Don't know where i am gng wrong
Hi,

Can I write a 'after insert' trigger on EmailMessage object to edit the TextBody of incoming Mail?
Is it possible in Salesforce?
I am creating a Predefined Filed but I am getting Error: Incorrect number of parameters for function 'YEAR()'. Expected 1, received 0

How can I correct the below formula? 

 
AND(Primary_Sales_Rep__c.Name, YEAR(), "Pipeline Review")

 
HI all, hope someone can help me here

SO I have been taking the apex academy on pluralsight to learn how to code in salesforce and its been a great starting point but have recentrly been stuck in my tracks now that mavensdmate is now not usable.  I am hoping that someone here is able to help recommend and show me step by step how to install and get running a new instance so I can get back to learning.  I have tried on my own but I have no idea what I am doing.  I have no idea which ones are good or work etc but any right now would be amazing.

Any help much appreciated.
Has anybody completed challenge 5 in lightning experience superbadge? If yes kindly post the solution of the same.
I'm facing problem in the following section.
Awaiting Approval
If the status changes to awaiting approval and there is a positive discount value, kick off the discount approval process. If no discount is applied, the status updates to Scheduled because no approval is needed when a package is purchased at full price.

It is showing me the following error.
User-added image

Kindly share the solution.
Hi,
I am developing a lightning component to upload file in contentVersion object. I am refering to this site : 
http://webcache.googleusercontent.com/search?q=cache:yDEYXecmDHMJ:peterknolle.com/file-upload-lightning-component/+&cd=1&hl=en&ct=clnk&gl=in

I was successful uploading files upto 3 MB without chunking but I am facing some issue in chunking the file to upload the large files.
Wherever i upload the file , it gives me following error :
System.StringException: Unrecognized base64 character: %
I am attaching code for helper class and apex controller.

Helper Class :
({
    MAX_FILE_SIZE: 4 500 000, /* 6 000 000 * 3/4 to account for base64 */
    CHUNK_SIZE: 950 000, /* Use a multiple of 4 */

    readFile: function(component, helper, file) {
        if (!file) return;
        var reader = new FileReader();
        self = this;
        reader.onload = function() {
            var dataURL = reader.result;
            component.set("v.pictureSrc", "https://s3-us-west-1.amazonaws.com/sfdc-demo/image-placeholder.png");
            self.upload(component, file, dataURL);
        };
        reader.readAsDataURL(file);
    },

    upload: function(component, file, dataURL) {
        console.log('uploading file ...');
         var fromPos = 0;
        var toPos = Math.min(dataURL.length, fromPos + this.CHUNK_SIZE);
        console.log('toPos  '+toPos);
        console.log(' fromPos '+fromPos);
        this.uploadChunk(component, file, dataURL, fromPos, toPos,'');

    },
        uploadChunk : function(component, file, dataURL, fromPos, toPos,contentDocumentId){
            console.log('uploading chunk ');
             var action = component.get("c.saveTheChunkChatterFile");
            var chunk = dataURL.substring(fromPos, toPos);
            console.log(chunk);
            action.setParams({
            parentId: component.get("v.recordId"),
            fileName: file.name,
            base64Data: encodeURIComponent(chunk), 
            contentType: file.type,
            contentDocumentId :contentDocumentId
            });
            var self = this;
             action.setCallback(this, function(a) {
            contentDocumentId = a.getReturnValue();
            console.log('return value '+contentDocumentId);
            fromPos = toPos;
            toPos = Math.min(dataURL.length, fromPos + self.CHUNK_SIZE);    
            if (fromPos < toPos) {
                self.uploadChunk(component, file, dataURL, fromPos, toPos, contentDocumentId);  
            }else{
                component.set("v.message", "File Uploaded");
            }
        });
               component.set("v.message", "Uploading...");

            $A.enqueueAction(action); 
       }
})

Apex Controller : 
 
@AuraEnabled
public static Id saveChatterFiles(Id parentId, String fileName, String base64Data, String contentType)  { 
    system.debug('Saving chatter files '+fileName + ' '+ contentType);
    ContentVersion testContentInsert =new ContentVersion(); 
     testContentInsert.Title =fileName; 
    testContentInsert.VersionData=EncodingUtil.base64Decode(base64Data);
    testContentInsert.PathOnClient='/' + fileName ;
     insert testContentInsert; 
    system.debug('testContentInsert.id '+ testContentInsert.id);
    testContentInsert = [select id, ContentDocumentId from ContentVersion WHERE Id =: testContentInsert.Id];
    ContentDocumentLink cl = new ContentDocumentLink();
    cl.ContentDocumentId = testContentInsert.ContentDocumentId;
    cl.LinkedEntityId = parentId; 
    cl.ShareType = 'V';
     cl.Visibility = 'AllUsers';
    insert cl;
    system.debug('testContentInsert.id');
    return testContentInsert.id;

}


@AuraEnabled                            
public static Id saveTheChunkChatterFile(id parentId,String fileName, String base64Data, String contentType, String contentDocumentId){
        system.debug('saving chatter file');
    if (contentDocumentId == '' || contentDocumentId==null ) {
        system.debug('null id');
        contentDocumentId = saveChatterFiles(parentId, fileName, base64Data, contentType);
    } else {
        system.debug('not null id');
        system.debug('id '+contentDocumentId);
        appendToFileChatter(contentDocumentId, base64Data);
    }

    return Id.valueOf(contentDocumentId);
}

@AuraEnabled
public static void appendToFileChatter(Id contentDocumentId, String base64Data) {
 base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
    system.debug('appending');
    ContentVersion a = [
        SELECT Id, VersionData,ContentDocumentId
        FROM ContentVersion
        WHERE Id = :contentDocumentId
    ];

    String existingBody = EncodingUtil.base64Encode(a.VersionData);
    a.VersionData = EncodingUtil.base64Decode(existingBody + base64Data); 

    update a;
}
Any kind of help or alternative to upload file in contentVersion using lightning component will be greatful.


 
I did exactly what was told in the trail yet i am unable to find the custom link( not a member?) in the login page .....check the images and help me ..stuck here for last two days User-added imageUser-added image
hi ,i am trying the Lightning Experience Specialist

while i installed the  unmanaged LEX Superbadge package.
here comes the issue

"Install the unmanaged package from the pre-work if you haven’t already. Rename all of the standard objects in the schema as specified, and set the default page layouts for Adventure, Adventure Package, and Opportunity to the Relaxation Gauntlet custom layouts. Update the Opportunity stage values, create a sales path for sales reps (highlighting key fields and giving specific coaching guidance), and create an approval process as specified in the business requirements."

i am confused what i should do next .as i am unable to understand ....

help me
The campingList JavaScript controller isn't setting the 'item' as a parameter or saving the record correctly.

My code is as follows:

1---Camping List Component
<aura:component controller="CampingListController">
	
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
    <aura:handler name="addItem" event="c:addItemEvent"
   	action="{!c.handleAddItem }"/>
    
    <aura:attribute name="newItem" type="Camping_Item__c"
     default="{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false }"/>
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    
    <ol>
    <li>Bug Spray</li>
    <li>Bear Repellant</li>
    <li>Goat Food</li>
    </ol>
    
       <!-- NEW EXPENSE FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">

        <c:campingListForm/>

    </div>
    <!-- / NEW EXPENSE FORM -->    
   

    <div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Items</h3>
        </header>
        
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="items">
                    <c:campingListItem item="{!item}"/>
                </aura:iteration>
            </div>
        </section>
    </div>

</aura:component>

2---Camping List Controller
 
({
    // Load items from Salesforce
	doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getItems");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.items", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},

    
    handleAddItem: function(component, event, helper) {
    var newItem = event.getParam("item");
    //helper.createItem(component, newItem);
        this.saveItem(component, item, function(response){
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            var items = component.get("v.items");
            items.push(response.getReturnValue());
            component.set("v.items", items);
        }
    }
          
}
                      
})

3---Camping List Helper

Empty

4---Camping List Form
 
<aura:component >
	
    <aura:registerEvent name="addItem" type="c:addItemEvent"/>
        <!-- CREATE NEW ITEM FORM -->
    <form class="slds-form--stacked">

      <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputText aura:id="itemname" label="Name"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Name}"
                  required="true"/>

          </div>
     </div>

     <div class="slds-form-element slds-is-required">
          <div class="slds-form-element__control">
              <ui:inputNumber aura:id="quantity" label="Quantity"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Quantity__c}"
                  required="true"/>

          </div>
      </div>

      <div class="slds-form-element">
          <div class="slds-form-element__control">
              <ui:inputCurrency aura:id="price" label="Price"
                  class="slds-input"
                  labelClass="slds-form-element__label"
                  value="{!v.newItem.Price__c}"
                  />
          </div>
      </div>

      <div class="slds-form-element">
          <ui:inputCheckbox aura:id="packed" label="Packed?"
              class="slds-checkbox"
              labelClass="slds-form-element__label"
              value="{!v.newItem.Packed__c}"/>
      </div>

      <div class="slds-form-element">
          <ui:button label="Create Camping Item"
              class="slds-button slds-button--brand"
              press="{!c.clickCreateItem}"/>
      </div>

    </form>
    <!-- / CREATE NEW ITEM FORM -->
</aura:component>

5---CampingListFormController
 
({
    
    clickCreateItem: function(component, event, helper) {    
    if(helper.validateItemForm(component)){
        // Create the new item
        var newItem = component.get("v.newItem");
        helper.createItem(component, newItem);
    }
        
        }

})

6---CampingListFormHelper
 
({
 createItem: function(component, newItem) {
    var createItem = component.getItem("createItem");
    createItem.setParams({ "item": item });
    createItem.fire();
             component.set("v.newItem",{ 'sobjectType': 'Camping_Item__c',
                    'Name': '',
                    'Quantity__c': 0,
                    'Price__c': 0,
                    'Packed__c': false }/>);
},
    

		validateItemForm: function(component) {
		
              // Simplistic error checking
        var validItem = true;

        // Name must not be blank
        var nameField = component.find("itemname");
        var itemname = nameField.get("v.value");
        if ($A.util.isEmpty(itemname)){
            validItem = false;
            nameField.set("v.errors", [{message:"Item name can't be blank."}]);
        }
        else {
            nameField.set("v.errors", null);
        }
        
        // Quantity must not be blank
        var quantityField = component.find("quantity");
        var quantity = nameField.get("v.value");
        if ($A.util.isEmpty(quantity)){
            validItem = false;
            quantityField.set("v.errors", [{message:"Quantity can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
		// Price must not be blank
        var priceField = component.find("price");
        var price = priceField.get("v.value");
        if ($A.util.isEmpty(price)){
            validItem = false;
            priceField.set("v.errors", [{message:"Price can't be blank."}]);
        }
        else {
            quantityField.set("v.errors", null);
        }
            return validItem;

	}
})

I am still getting this error:

User-added image

Any help would be appreciated.
 
Hi, I am having trouble with the "Attributes and Expressions" module from trailhead.

Here is the challenge:
Create a Lightning Component to display a single item for your packing list.
  • Create a component called campingListItem that displays the name (ui:outputText) and the three custom fields using the appropriate output components.
  • Add an attribute named 'item' for type Camping_Item__c.
I created an component named campingListItem and this is the code:
<aura:component >
    <aura:attribute name="item" type="<my_domain>__Camping_Item__c"/>
    
    <ui:outputText value="{!v.item.Name}"/>
    <ui:outputCheckbox value="{!v.item.<my_domain>__Packed__c}"/>
    <ui:outputCurrency  value="{!v.item.<my_domain>__Price__c}"/>
    <ui:outputNumber value="{!v.item.<my_domain>__Quantity__c}"/>
</aura:component>

The error that I am getting is: "Challenge Not yet complete... here's what's wrong: 
The packingListItem Lightning Component's attribute tag doesn't exist or its attributes are not set correctly."

With this, I tried to create another component, with the name "packingListItem", but It didn't work.

Can anyone help me?

Thanks,
Hi,
I finally solved LES Challenge 8 after 10+ hours of headache. I had to create a lot of new columns and add data to the rows in my .CSV-file. Some files contained 130 rows and some only 3 rows. This is a rather small number of rows in guessing and therefore I'm wondering if there's an easier way to solve it when, lets say, you have files with 20 000+ rows. I'm looking for a better way to solve it than how I did it, a best practice of some kind. 
How did you guys do it? Is there a best practice?

I'm using the Dataloader.io when importing: 
  1. Downloaded the Superbadge-Lightning-Import.xlsx and split it up/converted into Explorers.csv , Adventures.csv and OpportunitiesWAdventures.csv 
  2. Insert Explorers from Explorers.csv. 
    1. Since Opportunities contains Adventure Package which contains a lookup to Explorer and the Adventure I figured the easiest would be to start inserting the Explorers.csv. Before inserting the Explorer.csv I had to split the Full Name column into First name and Last name to match the Explorer-object's Firstname and Lastname column. 
  3. Insert Adventures from Adventures.csv
    1. Before importing Adventure.csv I removed the Explorer column since it was empty and I also cleaned up the data in the Description column cause it contained commas and was interfering.
  4. Insert Price Book Entry from Adventures.csv
    1. The Adventures has to be in the Price Book to be able to be added to an Adventure Package. Therefore I added a column in the called PricebookID and added the Pricebook ID of the Standard Price Book to the rows. 
      1. Mapped field:
        1. Adventure Name - Adventure (Lookup via Adventure Name)
        2. List Price - List Price
        3. Active (Adventure) - Active
        4. Pricebookid - Price Book ID
  5. Insert Opportunities from OpportunitiesWAdventures.csv. 
    1. Mapped fields:
      1. Close Date - CloseDate, 
      2. Opportunity Name - Name
      3. Probability (%) - Probability
      4. Quantity - TotalOpportunityQuantity
      5. Stage - StageName
  6. Insert Opportunity Contact Role from OpportunitiesWAdventures.csv
    1. Mapped Fields
      1. Opportunity Name to Opportunity ID(Lookup via  Name) 
      2. Explorer to Explorer (Lookup via Full Name)
  7. Insert Adventure Package from OpportunitiesWAdventures.csv
    1. Added new column for Adventure Name in OpportunitiesWAdventures.csv and added the Adventure name (contained as a part in the Opportunity Name column) to all the rows. 
      1. Mapped Fields: 
        1. Opportunity Name - Opportunity ID(Lookup via Name)
        2. Adventure Name - Price Book Entry ID (Lookup via Adventure Name)
        3. Explorer - Explorer (Lookup via Full Name)
Please leave a comment on how you solved it, thanks! :)