• kavya mareedu
  • NEWBIE
  • 105 Points
  • Member since 2018
  • Salesforce Developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 35
    Questions
  • 40
    Replies
Component: 
<aura:component>
     <aura:handler event="c:AccountsLoaded" action="{!c.onAccountsLoaded}"/>
    <aura:attribute name="map" type="Object"/>
     <aura:attribute name="accounts" type="Account" />
    <ltng:require styles="/resource/leaflet/leaflet.css" scripts="/resource/leaflet/leaflet.js" afterScriptsLoaded="{!c.jsLoaded}" />
    <div id="map"/>
</aura:component>

JS:

({
    
    jsLoaded: function(component, event, helper) {
       var accounts = event.getParam('accounts');
        for (var i=0; i<accounts.length; i++) {          
            var account = accounts[i];
            var map = L.map('map', {zoomControl: false}).setView([account.BillingLatitude, account.BillingLongitude],11);
            L.tileLayer(
            'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
            }).addTo(map);
        component.set("v.map", map);
        
        var circle = L.circle([account.BillingLatitude, account.BillingLongitude], {
            color: 'red',
            fillColor: '#f03',
            fillOpacity: 0.5,
            radius:10000
        }).addTo(map);
        
        L.marker([account.BillingLatitude, account.BillingLongitude]).addTo(map).bindPopup(account.Name).openPopup(); 
        //L.marker([account.BillingLatitude, account.BillingLongitude]).addTo(map).bindPopup('Hyatt').openPopup(); 
        //L.marker([account.BillingLatitude, account.BillingLongitude]).addTo(map).bindPopup('Marriott Marquis').openPopup();
        

        }      
    }
})


Error: 

This page has an error. You might just need to refresh it. Action failed: c:leafflet$controller$jsLoaded [Unable to get property 'length' of undefined or null reference] Failing descriptor: {c:leafflet}
({ jsLoaded: function(component, event, helper) { var map = L.map('map', {zoomControl: false}) .setView([51.5, -0.09], 13); L.tileLayer( 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri' }).addTo(map); component.set("v.map", map);var circle = L.circle([51.508, -0.11], {color: 'red',fillColor: '#f03',fillOpacity: 0.5,radius: 500}).addTo(map);var polygon = L.polygon([[51.509, -0.08],[51.503, -0.06],[51.51, -0.047]]).addTo(map);}})[[code]]czowOlwiXCI7e1smKiZdfQ==[[/code]]

In my requirement I have a form as shown below:

In the highlighted part the customer will choose the closest regional hub where he lives, but there are close to 700 options in this picklist. I want to enhance this field in such a way, I will replace this picklist with ZipCode. Whenever the customer gives you any input as Zipcode we should show him a map highlighting the place which he has given and from there taking that highlighted place as center we should add a radius to the map upto 10 kms and show what all places he can choose in that places.
User-added image

 
global class OTFAutomationReport implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext bc)
    {
        //String query = 'select Id,OTF_Total_Hours__c,OTFClient__c, OTF_Date__c, (select Date__c, Duration_Hours__c from Time_Logs__r) from account where Name='+80 Acres Farms+';
       
        
        system.debug('==query==>' +[select Id,OTF_Total_Hours__c,OTFClient__c, OTF_Date__c, (select Date__c, Duration_Hours__c from Time_Logs__r) from account where Name='80 Acres Farms']);
        return Database.getQueryLocator([select Id,OTF_Total_Hours__c,OTFClient__c, OTF_Date__c, (select Date__c, Duration_Hours__c from Time_Logs__r) from account where Name='80 Acres Farms']);
       
    }
    global void execute(Database.BatchableContext bc, List<account> scope)
    {
        system.debug('==scope==>' +scope);
        //decimal TotalHours=0.0;
        list<account> accUpdate = new list<account>();
        for(account a: scope)
           
        {
            a.OTF_Total_Hours__c=0.0;
            system.debug('a===>1st loop' +a);
            for(Time_Log__c tl : a.Time_Logs__r)
            { system.debug('a===>2nd loop' +tl);
            
                //system.debug('a==a.OTF_Total_Hours__c=>2nd loop' +a.OTF_Total_Hours__c);
             system.debug('a=tl.Duration_Hours__c==>2nd loop' +tl.Duration_Hours__c);
            
                if(tl.Duration_Hours__c!=NUll && a.OTF_Total_Hours__c!=Null){
                a.OTF_Total_Hours__c +=tl.Duration_Hours__c;
                system.debug('==TotalHours==>' +a.OTF_Total_Hours__c);
                if(a.OTF_Total_Hours__c>=20 && a.OTFClient__c==false)
                {
                    a.OTFClient__c=true;
                    system.debug('==a.OTFClient__c==>' +a.OTFClient__c);
                    a.OTF_Date__c=tl.Date__c;
                    accUpdate.add(a);
                }
                }
            }
           
            
        }
        system.debug('==accUpdate > ' +accUpdate);
        update accUpdate;
       
    }
    global void finish(Database.BatchableContext BC)
    {}   
    
}
 
Hello Team,

I need help in building process builder. My requirement is on Account object there is a field(Multi select Picklist) called "Ecosystem Partners" with 9 different values say a,b,c,d,e,f,g,h,i. Now, when I select any of the ecosystem partner it should add the "user" who is associated with one of the ecosystem partners as an account team member. I can achive this functionality when one value is selected. If multiple values are selected then multiple members should be added as account team members. Please guide me 
In your process you will create a new Seed Bank Agencies dataset.
Load the pre-populated Account object.
Load the Agency Detail.txt file to update the Account object with the recently added fields since the initial import.
Create a filter to select records associated with the Seed Bank project from the Account object.
Add the custom fields from the Agency Detail.txt file to the Account object.
Register the Account object as the new Seed Bank Agencies dataset.

Yasmine is curious to see what Mosaic will be able to do with the new datasets you'll be creating. With that in mind, you show Benito how to create lenses from the datasets for the executive team to experiment with.
I am working On Business Administration Super Badge people. When I am trying to import the File they are asked me to do via data Loader I am not able to do it. When I checked the Login History it says API security Token required. When I reset the security token and tried to loggin back it gives me the same error. How should I achieve my challenge 1. It's more than 3 hours I am not able to fix it. Please help me folks.

I have to write a test class for the below schedule apex class, That too with 100% code coverage and system assert equals. How should I start what to do please help me. I really really need all you guys support.

global class DailyPrintbleAndDossierScheduler implements Schedulable
{
    global void execute(SchedulableContext ctx)
    {
        database.executeBatch(new BrokerDataAggregateResultDeleteBatch());
        database.executeBatch(new BrokerDataTopOfficesDeleteBatch());
        database.executeBatch(new BrokerDataSummaryDeleteBatchController());
    }
}

Topic Name: 
Extend Your Reporting Strategy with the AppExchange


Challenge is:

You’ve been asked to create a new Lead trending dashboard. Rather than creating the dashboard from scratch, install a CRM adoption dashboard package from AppExchange in your Trailhead Playground and update one of the dashboard components as specified below. (Note: While it's a best practice to clone a dashboard before you modify it, for this example, you can go ahead and edit the dashboard directly.)
Get your username and password for your Trailhead Playground using the instructions in this article
Install Salesforce Adoption Dashboards from AppExchange into your Trailhead Playground
Refresh the 3 - Sales & Marketing Adoption dashboard in the Salesforce Adoption Dashboards folder at least once
In the 3 - Sales & Marketing Adoption dashboard, edit the New LEAD Trend by Source component and uncheck the Use chart as defined in source report option
Change the dashboard component for New LEAD Trend by Source to a pie chart and set the wedges to Lead Source
Save your changes
Having trouble installing your app? Read this article for help
I need help in writing a batch apex class. I have two custom objects Agg_Datas_c and Agg_Datas_Final_c

In the two objects we have same fields they are called 18 GWP,19 GWP, 18 commission, 19 commission also a picklist field. 

I have a write a batch apex class in such a way that I should fetch the aggregate data from database in start method. 

In execute method I have to calculate variance and variancepercent

In finish method I have to put the data in other object. I am stuck in middle please help me.

global class Batch_AggregateDataTransfer implements Database.Batchable<sObject> {
    //start method to fetch the aggregate data from Database.
    global Database.QueryLocator start(Database.BatchableContext BC){
        string query ='SELECT SUM(X2018_GWP__c),SUM(X2019_GWP__c) FROM Agg_Data_c__c';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext BC, List<Agg_Data_c__c> Batch){
        for(Agg_Data_c__c obj_Agg: Batch){
            AggregateResult ar = (AggregateResult)obj_Agg;
            Double counter1 = Double.valueOf(ar.get('X2018_GWP__c'));
            Double counter2 = Double.valueOf(ar.get('X2019_GWP__c'));
            Double variance=counter1-counter2;
            Double variancePercent= (counter1-counter2)*0.01;
            
        }
    }
    global void finish(Database.BatchableContext BC){
        {
            
        }
        
    }
    
}
Hi  i am new in Salesforce
I am Beginner
So Please Help me Out from this Scenario

When an Account's Billing Zip/Postal Code field value is changed and entered new value then
this situation will occur
1.Change the Account Owner to the Sales Representative assigned to the new zip code(Sales Representative is users that will be in another custom Object Terriotry object its a lookup )
2.Change the Owner Field of all the Account's Contacts to the same Sales Representative
3.Change the Owner Field of all the Account's Open Opportunities to the Same Sales RepresentativeIn this Image this are the Sales Representative in Custom Object TerritoryIn this Image This are the Custom fileds of territory objectSo Please Help Me out From this Scenario How to Start From where i dont know 

Please Reply As Soon Possible

Thanks
Neeraj Sharma
public class Colors {
    public string colors;
    public List<string> myList;
    public set<string> newList;
    
    public colors(){
        myList=new List<string>{'Blue','Blue violet','Red','Green','Dark Red','Light Red','Orange Red','Coral Red',
            'Forest Green','Hunter Green','Sage Green','Black','Red','Orange','Yellow','Blue violet'};
                system.debug(myList.size()); 
 newList=new set<string>();
        newList.addAll(myList);
        system.debug(newList);
}
Here is my program:

public class Outbound_Example_3 {
    public void invoke(){
        Messaging.SingleEmailMessage msg =new Messaging.SingleEmailMessage();
        Contact con=[select id ,AccountId from Contact where createdDate=TODAY];
        msg.setTargetObjectId(con.Id);
        msg.setWhatId(con.AccountId);
        EmailTemplate et =[select id from EmailTemplate where name='Case Response'];
        msg.setTemplateId(et.id);
        
        Document doc =[select id,Name,Body,ContentType ,Type from Document where name='Email Messaging'];
        Messaging.EmailFileAttachment eft1 =new Messaging.EmailFileAttachment();
        eft1.setFileName(doc.Name+doc.type);
        eft1.setBody(doc.body);
        eft1.setContentType(doc.ContentType);
        
        PageReference p=Page.EmailSerc;
        Blob body=p.getContentAsPDF();
        Messaging.EmailFileAttachment eft2 =new Messaging.EmailFileAttachment();
        eft2.setFileName('EmailSerc');
        eft2.setBody(body);
        List<Messaging.EmailFileAttachment> files =new List<Messaging.EmailFileAttachment>{eft1,eft2};
        msg.setFileAttachments(files);
        Messaging.Email[] emails =new Messaging.Email[]{msg};
        Messaging.sendEmail(emails);    
        
    }
}


Outbound_Example_3 ou=new Outbound_Example_3();
ou.invoke();


Please let me know where am I going wrong.
Thanks!
Hello,

I am a 'Ranger' now and I want to know when will I get my hoodie !!!

 
My question is: When ever lead is inserted, with leadsource as web set wilson as owner of record. If the leadsource is other than web then assign it to lifeQueue as owner.

Ans:

public class Lead_Example {
    
    User u= [Select id from User where FirstName LIKE 'wilson'];
    group g= [Select id from Group where type='Queue' and name='LifeQueue'];
    public static void callMe(List<Lead> leads) 
    {
        for(Lead l: leads)
        {
            if(l.LeadSource=='web')
            {
                l.OwnerId= u.id;
            }else{
                l.OwnerId=g.id;
            }
        }
    }
}

Trigger Callout:
trigger Lead_Example on Lead (before insert) {
    List<Lead> leads=Trigger.new;
    
    Lead_Example.callMe(Trigger.new);
    
}
I properly installed CLI. In a command window, I enter:

sfdx force:auth:web:login -d -a DevHub

in order to log in to the trial Dev Hub that I created. The aforementioned command opens the Salesforce login page in the web browser, so I log in using my Developer Hub Trial Org credentials and click Allow. After that, web browser show me an error: "This site can't be reached. localhost took too long to respond".

This is the URL that Salesforce use after I authenticate in the browser: http://localhost:1717/OauthRedirect?code=aPrxbOND3gL_2LbSR7rKPdvD0XBVk2YpErl3pphY2f3xvZ1wf5SSPJByDleRLPMtzCQWnNGAdg%3D%3D&state=f2f8254fac23

I don't know what happen.

User-added image

User-added image

User-added image