• Ramakrishnan Ayyanar
  • NEWBIE
  • 79 Points
  • Member since 2013


  • Chatter
    Feed
  • 1
    Best Answers
  • 5
    Likes Received
  • 4
    Likes Given
  • 17
    Questions
  • 63
    Replies
Hi All,
I created a trigger so that when a new event is created in Public Calendar a new record under custom object CalendarEV will be created automatically, I also created the test class, it runs successfully but no code coverage, please help.

trigger CalendarEV on Event (after insert) {
    List<Event> Events = new List<Event>();
   for (Event e : Trigger.new) {
           if (e.Subject != null ) {
               CalendarEV__c C = new CalendarEV__c();
               c.Name = e.Subject;
               c.Start__c = e.StartDateTime;
               c.End__c = e.EndDateTime;
               c.Location__c = e.Location;
               c.Description__c = e.Description;
                
              insert C;
        }
    }
   }


@isTest
public class CalendarEVTest
{
    static testMethod void insertNewCalendarEV()
    {
        Test.StartTest();
        Event event = new Event();
        event.Subject = 'Test Event';
        event.Location = 'Test Location';
        event.Description = 'Test Description';      
        Test.StopTest();
    }
}
Hi,
Test Push notification from connected app successfully sends alert, sound, badge to my IOS device. But Notification using apex code & connected app is not sending any notifications to my IOS Device.

any one help me
I need how to add attachment in webtolead form.I created one rich text field,but it's also not supported in html. so i need any other alternative solution.
Thanks for Response.

I need one help.

i have json string value. i need to deserialize ths json string.

Json String Get Url:

http://api.crunchbase.com/v/2/organization/google?user_key=f781f4a0a7bedbad9861dd607069fd1b

Please use this url. need to deserialize ths mentioned url json string.

 
I need how to parse json Children items with any example
I need  Integrate Quickbooks  with Salesforce .I'm done with one way integration(SF to QB Online),but i need QB online to SF.
I worte one test class.In this test class one Map.get() method is used.
if i run test ,i got the error .

"Methods defined as TestMethod do not support getContent call, test skipped"

Please any one tell me solution.
Problems:

1)If DOB is Feb 29 Leap year.How to find next birthday for that particular date?

No Need Validation rule for this code.

End-of-century years 1700, 1800,1900,2100 these years are not leap year in these problems are resolved.........

To find the next Birthday formula

How to create......

step-1: create the custom field for Date of Birth----It's type-Date

step-2: create the formula field for Birthday ---It's type-Date

code:

if(
MONTH(ramki__DOB__c) = 2 &&
DAY(ramki__DOB__c) = 29 ,
DATE(IF(Year(today())<=Year(ramki__DOB__c),
Year(ramki__DOB__c),
IF(
OR(MOD(Year(today())+4-MOD(Year(today()),4),400)=0,
AND(MOD(Year( today())+ 4-MOD(Year(today()),4),4)=0,
MOD(Year(today())+ 4-MOD(Year( today()),4),100)<>0)),
Year(today())+ 4-MOD(Year( today()),4),
Year(today())+ 8-MOD(Year( today()),4))
),
MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
if(Year( today()) <= Year( ramki__DOB__c)  ,
DATE(Year(ramki__DOB__c),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) ,
IF (DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) > TODAY(),
         DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
         DATE (YEAR(TODAY())+1,MONTH(ramki__DOB__c),DAY(ramki__DOB__c))
       )))

it's correctly worked for leap year dates.......
this is code for find the next Birthday friends......


Easily Calculate Age:

create formula field -------(Number)

Age=YEAR( ramki__BirthDay__c) - YEAR(ramki__DOB__c)
----
softramki@gmail.com
+919944112175
This methods are used for Get Same Role and Subordinate Users.

public static Set<ID> getSameRoleSubordinateUsers()
     {
         Set<ID> userIds = new Set<ID>();
     
        // get current user's role id
          Map<Id,User> users = new Map<Id, User>([Select Id, Name From User where UserRoleId=:userinfo.getuserroleid()]);
          userIds.addAll(users.keySet());
         
        // get all of the roles underneath the user
         Set<Id> allSubRoleIds = getAllSubRoleIds(new Set<ID>{userinfo.getuserroleid()});
        
        // get all of the ids for the users in those roles
         Map<Id,User> subUsers = new Map<Id, User>([Select Id, Name From User where
          UserRoleId IN :allSubRoleIds]);
         
          userIds.addAll(Subusers.keySet());
      
        // return the ids as a set so you can do what you want with them
         return userIds;
    }

   private static Set<ID> getAllSubRoleIds(Set<ID> roleIds)
   {

        Set<ID> currentRoleIds = new Set<ID>();
    
        // get all of the roles underneath the passed roles
        for(UserRole userRole :[select Id from UserRole where ParentRoleId IN :roleIds AND ParentRoleID != null])
    
        currentRoleIds.add(userRole.Id);
    
        // go fetch some more rolls!
        if(currentRoleIds.size() > 0)

          currentRoleIds.addAll(getAllSubRoleIds(currentRoleIds));
    
        return currentRoleIds;

    }

Thank's 
Ramakrishnan Ayyanar
+919944112175
can any one explain me about locking statements.

when the record is locked.
when the record is released.
I tried to create folder via apex code
      
      code:

        Folder fold=new Folder();
        fold.AccessType='Shared';
        fold.DeveloperName=UserInfo.getUserName();
        fold.AccessType='Shared';
        fold.Name='testfolder';
        fold.Type='Report';
        insert fold;

i got the error dml not allowed on folder.



XmlParseVFPage:

<apex:page Controller="Xmlparsar">

<apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Parse Xml" action="{!Parsexml}" />   
                <apex:commandButton value="ParseXML File" action="{!Parsexmlfile}"/>
            </apex:pageBlockButtons>
            <apex:inputTextArea value="{!xmlstring}" style="width:336px;height:260px;"/> &nbsp;&nbsp;
            <apex:inputTextArea value="{!outxmlstring}" style="width:336px;height:260px;" id="response"/><br/>

            <apex:outputLabel value="Select Xml File" for="file"/>
            <apex:inputFile fileName="{!fileName}" value="{!body}"/>
        </apex:pageBlock>
    </apex:form>
   
</apex:page>

Apex Class

public  class Xmlparsar
{
    //xml string
    public String xmlstring{get;set;}
   
    //display xml string
    public String outxmlstring{get;set;}
   
    //rootelement
    public String rootElement{get;set;}
   
    //
    public String filename{get;set;}
   
    public blob body{get;set;}
      
    //constructor
    public Xmlparsar()
    {
    
    }
   
    
//Parsing xml what you entered in the left text area
    public pagereference Parsexml()
    {
       DOM.Document xmlDOC = new DOM.Document();
       xmlDOC.load(xmlstring);
       DOM.XMLNode rootElement = xmlDOC.getRootElement();
       outxmlstring=String.valueof(xmlDOC.getRootElement().getName());
       for(DOM.XMLNode xmlnodeobj:xmlDOC.getRootElement().getChildElements())
       //.getChildren())
       {        
         
         
          loadChilds(xmlnodeobj);         
       }      
       return null;
    }
   
    //loading the child elements
    public void loadChilds(DOM.XMLNode xmlnode)
    {
        for(Dom.XMLNode child : xmlnode.getChildElements())
        {
          if(child.getText()!= null)
          {
          outxmlstring+='\n'+child.getName()+': '+child.getText();
       
          }
          loadChilds(child);       
        }
    }
   
   
//This is for parsing xml file what you selected
  public pagereference Parsexmlfile()
  {
       DOM.Document xmlDOC = new DOM.Document();
       xmlstring=body.tostring();         
       xmlDOC.load(xmlstring);
       DOM.XMLNode rootElement = xmlDOC.getRootElement();
       outxmlstring=String.valueof(xmlDOC.getRootElement().getName());//gives you root element Name
       for(DOM.XMLNode xmlnodeobj:xmlDOC.getRootElement().getChildElements())
       {        
                  
          loadChilds(xmlnodeobj); 
       }      
      return null;
    }
}

Apex Test Class

@isTest
public class XmlParsarTest
{
    
    //test for parse xml only
    @isTest static void Parsexml()
    {      
        Xmlparsar xmlpar=new Xmlparsar();
        PageReference pageRef = Page.XmlParseVFPage;
        Test.setCurrentPage(pageRef);
        xmlpar.xmlstring='<?xml version="1.0"?><catalog><book id="bk101"><author>Gambardella, Matthew</author></book></catalog>';
        xmlpar.Parsexml();
        System.assertNotEquals(null, xmlpar.outxmlstring);
    }
   
    @isTest static void ParsexmlFile()
    {
        Xmlparsar xmlpar=new Xmlparsar();
        PageReference pageRef = Page.XmlParseVFPage;
        Test.setCurrentPage(pageRef);
        List<StaticResource> resourceList=[SELECT body FROM StaticResource WHERE Name = :'testxmlfile' limit 1];
        xmlpar.body=resourceList[0].body;
        System.debug('xmlpar.body'+xmlpar.body);
        System.debug('xmlpar.xmlstring'+xmlpar.xmlstring);
        xmlpar.Parsexmlfile();
        System.assertNotEquals(null, xmlpar.outxmlstring);
    }
   
  
}

Any one please help to me. How to Access  Communities through API?.

 

I needed Soap protocol using in the API.

Hi Friends,

 

To find the next Birthday formula 

 

How to create......

 

step-1: create the custom field for Date of Birth----It's type-Date

 

step-2: create the formula field for Birthday ---It's type-Date

 

code:

 

if( 
MONTH(ramki__DOB__c) = 2 && 
DAY(ramki__DOB__c) = 29 , 
DATE( 
IF(Year(Today())<=Year(ramki__DOB__c),Year(ramki__DOB__c), 
IF( 
OR(MOD(Year(Today())+ 4-MOD(Year(Today()),4),400)=0, 
AND(MOD(Year(Today())+ 4-MOD(Year(Today()),4),4)=0, 
MOD(Year(Today())+ 4-MOD(Year(Today()),4),100)<>0)), 
Year(Today())+ 4-MOD(Year(Today()),4), 
Year(Today())+ 8-MOD(Year(Today()),4)) 
), 
MONTH(ramki__DOB__c),DAY(ramki__DOB__c)), 
if( 
Year( ramki__DOB__c ) <= Year(Today()) && MONTH(Today())<= MONTH(ramki__DOB__c)&& DAY(Today()) <= DAY(ramki__DOB__c) , 
DATE(Year(Today()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) , 
DATE(IF(Year(Today())<Year(ramki__DOB__c), Year(ramki__DOB__c),Year(Today())+1) ,MONTH(ramki__DOB__c),DAY(ramki__DOB__c))))

 

 

it's correctly worked for leap year dates.......

this is code for find the next Birthday friends......

 

 

Easily Calculate Age:

 

create formula field -------(Number)

 

Age=YEAR( ramki__BirthDay__c) - YEAR(ramki__DOB__c)

----

softramki@gmail.com

+919944112175

 

 

 

Problems:

1)If DOB is Feb 29 Leap year.How to find next birthday for that particular date?

No Need Validation rule for this code.

End-of-century years 1700, 1800,1900,2100 these years are not leap year in these problems are resolved.........

To find the next Birthday formula

How to create......

step-1: create the custom field for Date of Birth----It's type-Date

step-2: create the formula field for Birthday ---It's type-Date

code:

if(
MONTH(ramki__DOB__c) = 2 &&
DAY(ramki__DOB__c) = 29 ,
DATE(IF(Year(today())<=Year(ramki__DOB__c),
Year(ramki__DOB__c),
IF(
OR(MOD(Year(today())+4-MOD(Year(today()),4),400)=0,
AND(MOD(Year( today())+ 4-MOD(Year(today()),4),4)=0,
MOD(Year(today())+ 4-MOD(Year( today()),4),100)<>0)),
Year(today())+ 4-MOD(Year( today()),4),
Year(today())+ 8-MOD(Year( today()),4))
),
MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
if(Year( today()) <= Year( ramki__DOB__c)  ,
DATE(Year(ramki__DOB__c),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) ,
IF (DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)) > TODAY(),
         DATE (YEAR(TODAY()),MONTH(ramki__DOB__c),DAY(ramki__DOB__c)),
         DATE (YEAR(TODAY())+1,MONTH(ramki__DOB__c),DAY(ramki__DOB__c))
       )))

it's correctly worked for leap year dates.......
this is code for find the next Birthday friends......


Easily Calculate Age:

create formula field -------(Number)

Age=YEAR( ramki__BirthDay__c) - YEAR(ramki__DOB__c)
----
softramki@gmail.com
+919944112175
This methods are used for Get Same Role and Subordinate Users.

public static Set<ID> getSameRoleSubordinateUsers()
     {
         Set<ID> userIds = new Set<ID>();
     
        // get current user's role id
          Map<Id,User> users = new Map<Id, User>([Select Id, Name From User where UserRoleId=:userinfo.getuserroleid()]);
          userIds.addAll(users.keySet());
         
        // get all of the roles underneath the user
         Set<Id> allSubRoleIds = getAllSubRoleIds(new Set<ID>{userinfo.getuserroleid()});
        
        // get all of the ids for the users in those roles
         Map<Id,User> subUsers = new Map<Id, User>([Select Id, Name From User where
          UserRoleId IN :allSubRoleIds]);
         
          userIds.addAll(Subusers.keySet());
      
        // return the ids as a set so you can do what you want with them
         return userIds;
    }

   private static Set<ID> getAllSubRoleIds(Set<ID> roleIds)
   {

        Set<ID> currentRoleIds = new Set<ID>();
    
        // get all of the roles underneath the passed roles
        for(UserRole userRole :[select Id from UserRole where ParentRoleId IN :roleIds AND ParentRoleID != null])
    
        currentRoleIds.add(userRole.Id);
    
        // go fetch some more rolls!
        if(currentRoleIds.size() > 0)

          currentRoleIds.addAll(getAllSubRoleIds(currentRoleIds));
    
        return currentRoleIds;

    }

Thank's 
Ramakrishnan Ayyanar
+919944112175
XmlParseVFPage:

<apex:page Controller="Xmlparsar">

<apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Parse Xml" action="{!Parsexml}" />   
                <apex:commandButton value="ParseXML File" action="{!Parsexmlfile}"/>
            </apex:pageBlockButtons>
            <apex:inputTextArea value="{!xmlstring}" style="width:336px;height:260px;"/> &nbsp;&nbsp;
            <apex:inputTextArea value="{!outxmlstring}" style="width:336px;height:260px;" id="response"/><br/>

            <apex:outputLabel value="Select Xml File" for="file"/>
            <apex:inputFile fileName="{!fileName}" value="{!body}"/>
        </apex:pageBlock>
    </apex:form>
   
</apex:page>

Apex Class

public  class Xmlparsar
{
    //xml string
    public String xmlstring{get;set;}
   
    //display xml string
    public String outxmlstring{get;set;}
   
    //rootelement
    public String rootElement{get;set;}
   
    //
    public String filename{get;set;}
   
    public blob body{get;set;}
      
    //constructor
    public Xmlparsar()
    {
    
    }
   
    
//Parsing xml what you entered in the left text area
    public pagereference Parsexml()
    {
       DOM.Document xmlDOC = new DOM.Document();
       xmlDOC.load(xmlstring);
       DOM.XMLNode rootElement = xmlDOC.getRootElement();
       outxmlstring=String.valueof(xmlDOC.getRootElement().getName());
       for(DOM.XMLNode xmlnodeobj:xmlDOC.getRootElement().getChildElements())
       //.getChildren())
       {        
         
         
          loadChilds(xmlnodeobj);         
       }      
       return null;
    }
   
    //loading the child elements
    public void loadChilds(DOM.XMLNode xmlnode)
    {
        for(Dom.XMLNode child : xmlnode.getChildElements())
        {
          if(child.getText()!= null)
          {
          outxmlstring+='\n'+child.getName()+': '+child.getText();
       
          }
          loadChilds(child);       
        }
    }
   
   
//This is for parsing xml file what you selected
  public pagereference Parsexmlfile()
  {
       DOM.Document xmlDOC = new DOM.Document();
       xmlstring=body.tostring();         
       xmlDOC.load(xmlstring);
       DOM.XMLNode rootElement = xmlDOC.getRootElement();
       outxmlstring=String.valueof(xmlDOC.getRootElement().getName());//gives you root element Name
       for(DOM.XMLNode xmlnodeobj:xmlDOC.getRootElement().getChildElements())
       {        
                  
          loadChilds(xmlnodeobj); 
       }      
      return null;
    }
}

Apex Test Class

@isTest
public class XmlParsarTest
{
    
    //test for parse xml only
    @isTest static void Parsexml()
    {      
        Xmlparsar xmlpar=new Xmlparsar();
        PageReference pageRef = Page.XmlParseVFPage;
        Test.setCurrentPage(pageRef);
        xmlpar.xmlstring='<?xml version="1.0"?><catalog><book id="bk101"><author>Gambardella, Matthew</author></book></catalog>';
        xmlpar.Parsexml();
        System.assertNotEquals(null, xmlpar.outxmlstring);
    }
   
    @isTest static void ParsexmlFile()
    {
        Xmlparsar xmlpar=new Xmlparsar();
        PageReference pageRef = Page.XmlParseVFPage;
        Test.setCurrentPage(pageRef);
        List<StaticResource> resourceList=[SELECT body FROM StaticResource WHERE Name = :'testxmlfile' limit 1];
        xmlpar.body=resourceList[0].body;
        System.debug('xmlpar.body'+xmlpar.body);
        System.debug('xmlpar.xmlstring'+xmlpar.xmlstring);
        xmlpar.Parsexmlfile();
        System.assertNotEquals(null, xmlpar.outxmlstring);
    }
   
  
}
Our notes & attchemnet are accessible through files(ie ContentDocumentLink replacement of attachment object), As we can not access/get attachment through lightning experience.
reference: https://help.salesforce.com/apex/HTViewSolution?urlname=Attachments-are-not-returned-in-Lightning-Experience-search&language=en_US
I want to display the attachment(image file) on lightning component, How can I display it?
I tried following code :
<apex:image url="/servlet/servlet.FileDownload—file=06941000000SKtyAAG" width="50" height="50" />  
 <apex:image url="/servlet/servlet.FileDownload?file={!attchmentId}"/>

 
Hello..

Someone created a Visual Force page at my org a few years back.. Now we are having an issue and I have no experience with coding of any sort. I am hoping I can send screen shots to someone to help me figure this out..

If anyone out there can help me please let me know..

Thanks!
Hey

I have created a trigger to map my custom lead "Type" field to the AccountType field. I finally got the trigger to save, however when I try to convert a lead record and create a new account record I recevie the following error:

Error: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, accountType: execution of BeforeInsert caused by: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Lead.ConvertedAccountId Trigger.accountType: line 9, column 1: [] (System Code)

Coul really use some help solving. Also the trigger is below:

trigger accountType on Account (before insert){
  Set<Id> accts = new Set<Id>();
  FOR(Account a: trigger.new){
     accts.add(a.Id);
  }
   List<Lead> leads=[SELECT Id, Type__c FROM Lead WHERE convertedAccountId IN: accts];
  Map<Id,String> leadMap=new Map<Id,String>();
  FOR(Lead l: leads){
   leadMap.put(l.ConvertedAccountID,l.Type__c);
  }
  FOR(Account a2: trigger.new){
    IF(leadMap.containsKey(a2.Id)){
      a2.Type=leadMap.get(a2.Id); 
    }
  }
}
Hi all ,
          I have a requirement that i need to to display all Contacts and Leads of our Organization on Google maps using Single Visualforce page to track All Contacts and Leads from Current Location, Here i displayed all Leads from current location but i need to display All Contacts also for the same Page if any one knows pls help

Here is my code

Class:
--------
global with sharing class LeadsNearbyMe {

public Lead leads{get; set;}

@RemoteAction
   global static List<Lead> getNearby(String lat, String lon) {

        if(lat == null || lon == null || lat.equals('') || lon.equals('')) {
            lat = '51.096214';
            lon = '3.683153';
        }

        String queryString =
            'SELECT Id, Name, Location__Longitude__s, Location__Latitude__s, ' +
                'Street, City,State,Country, PostalCode ' +
            'FROM Lead ' +
            'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') < 60 ' +
            'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' +
            'LIMIT 25';
        return(database.Query(queryString));
    }
}

Page:
--------

<apex:page sidebar="false" showheader="false" controller="LeadsNearbyMe">
 
  <apex:includeScript value="{!$Resource.googleMapsAPI}" />
      <script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCROH4OR9fzDhmprWPL1wGWfPT4uGUeMWg&sensor=false">
        </script>
        
    <!-- Setup the map to take up the whole window -->
    <style>
        html, body { height: 100%; }
        .page-map, .ui-content, #map-canvas { width: 100%; height:100%; padding: 0; }
        #map-canvas { height: min-height: 100%; }
    </style>
    
    <script>
        function initialize() {
            var lat, lon;
          
             if (navigator.geolocation) {
                 navigator.geolocation.getCurrentPosition(function(position){
                     lat = position.coords.latitude;
                     lon = position.coords.longitude;                    
                     
                     // Use Visualforce JavaScript Remoting to query for nearby conts      
                     Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.LeadsNearbyMe.getNearby}', lat, lon,
                         function(result, event){
                             if (event.status) {
                                 console.log(result);
                                 createMap(lat, lon, result);           
                             } else if (event.type === 'exception') {
                                 //exception case code          
                             } else {
                                            
                             }
                          },
                          {escape: true}
                      );
                  });
              } else {
                  // Set default values for map if the device doesn't have geolocation capabilities
                    /** Eindhoven **/
                    lat = 51.096214;
                    lon = 3.683153;
                    
                    var result = [];
                    createMap(lat, lon, result);
              }
          
         }
    
         function createMap(lat, lon, leads){
            var currentPosition = new google.maps.LatLng(lat,lon);
            var mapDiv = document.getElementById('map-canvas');
            var map = new google.maps.Map(mapDiv, {
                center: currentPosition,
                zoom: 13,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });
            
            // Set a marker for the current location
            var positionMarker = new google.maps.Marker({
                map: map,
                position: currentPosition,
                title: 'You are here',
            });
            
            // Keep track of the map boundary that holds all markers
            var mapBoundary = new google.maps.LatLngBounds();
            mapBoundary.extend(currentPosition);
            
            // Set markers on the map from the @RemoteAction results
            var cont;
            for(var i=0; i<leads.length;i++){
                cont = leads[i];
                console.log(leads[i]);
                setupMarker();
            }
       map.fitBounds(mapBoundary);

           function setupMarker(){
                var contNavUrl;
           
                try{
                    if(sforce.one){
                        contNavUrl =
                            'javascript:sforce.one.navigateToSObject(\'' + cont.Id + '\')';
                    }
                } catch(err) {
                    console.log(err);
                    contNavUrl = '\\' + cont.Id;
                }
                
                var contDetails =
                    
                    cont.Name + ',' +
                    cont.Street + ',' +
                    cont.City + ',' +
                    cont.PostalCode;
           var marker = new google.maps.Marker({
                   map: map,
                   icon : "{!URLFOR($Resource.GoogleMarkers, 'GoogleMark/4-l.png')}",
                   title:contDetails,
                   position: new google.maps.LatLng(
                                   cont.Location__Latitude__s,
                                   cont.Location__Longitude__s)
               });
               mapBoundary.extend(marker.getPosition());
           }
                  
           }
 
        google.maps.event.addDomListener(window, 'load', initialize);
        
    </script>
<body style="font-family: Arial; border: 0 none;">
 
        <div id="map-canvas"></div>
    </body>
 
</apex:page>


Screen shot:
------------------

User-added image


Thanks & Regards,
  • January 07, 2015
  • Like
  • 2
I'm using Crystal Reports 2013 and SFDC as my datasource and receive an error message when trying to connect:
Login failed
HY000:INVALID_LOGIN:Invalid username, password, security token; or user locked out. [Databse Vendor Code: 58]

I am connecting to a sanbox, test.salesforce.com, and I have added the IP address of the server where Crystal Reports 2013 is installed to the sandbox trusted sites.  I have tried using just the password and password+token in the login credential and receive the error either way.
I use the same credentials to successfully login to Data Loader.
 
Hi All,
I created a trigger so that when a new event is created in Public Calendar a new record under custom object CalendarEV will be created automatically, I also created the test class, it runs successfully but no code coverage, please help.

trigger CalendarEV on Event (after insert) {
    List<Event> Events = new List<Event>();
   for (Event e : Trigger.new) {
           if (e.Subject != null ) {
               CalendarEV__c C = new CalendarEV__c();
               c.Name = e.Subject;
               c.Start__c = e.StartDateTime;
               c.End__c = e.EndDateTime;
               c.Location__c = e.Location;
               c.Description__c = e.Description;
                
              insert C;
        }
    }
   }


@isTest
public class CalendarEVTest
{
    static testMethod void insertNewCalendarEV()
    {
        Test.StartTest();
        Event event = new Event();
        event.Subject = 'Test Event';
        event.Location = 'Test Location';
        event.Description = 'Test Description';      
        Test.StopTest();
    }
}
How to Know All triggers events and best practices
I need  Integrate Quickbooks  with Salesforce .I'm done with one way integration(SF to QB Online),but i need QB online to SF.

I am using SAP Crystal Reports 2013 and trying to connect to SFDC. Getting an error message though have a valid user name/password and security token. Please help !

 

The error message is :

 

HY000: Invalid_Login: Invalid username, password, security token; or user locked out. [Database Vendor Code:41]

 

 

  • December 09, 2013
  • Like
  • 1

Do we have video chatting on salesforce?????????? like chatter................

  • June 17, 2013
  • Like
  • 0
11/28/14 06:00 AM is the string i want only date from it any help is appriciable

Hi,

 

Can anyone tell me where to find some quality documention on parsing XML with apex. I have no experience in parsing XML, so some detailed walkthrough's would be very helpful.

 

Thanks!

  • March 13, 2013
  • Like
  • 0

When rendering a page as a PDF the filename of the PDF is the name of the page which is not a good thing. The problem with this is that the name is not unique and can cause confusion with the user.

 

I'm working on a quoting app that renders a quote as a PDF. Some broswers open the PDF embed, others automatically launch your PDF reader, and some prompt you to save or open. The problem is that if opened or saved theses files are all saved as qoute.pdf, qoute[1].pdf, quote[2].pdf, quote[3].pdf. The problem should be obvious.

 

Ideally you should be able to define the name of the generated PDF but I haven't figured out how to do this.

 

Thanks,

Jason

  • February 25, 2009
  • Like
  • 1
Hi all ,
          I have a requirement that i need to to display all Contacts and Leads of our Organization on Google maps using Single Visualforce page to track All Contacts and Leads from Current Location, Here i displayed all Leads from current location but i need to display All Contacts also for the same Page if any one knows pls help

Here is my code

Class:
--------
global with sharing class LeadsNearbyMe {

public Lead leads{get; set;}

@RemoteAction
   global static List<Lead> getNearby(String lat, String lon) {

        if(lat == null || lon == null || lat.equals('') || lon.equals('')) {
            lat = '51.096214';
            lon = '3.683153';
        }

        String queryString =
            'SELECT Id, Name, Location__Longitude__s, Location__Latitude__s, ' +
                'Street, City,State,Country, PostalCode ' +
            'FROM Lead ' +
            'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') < 60 ' +
            'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'km\') ' +
            'LIMIT 25';
        return(database.Query(queryString));
    }
}

Page:
--------

<apex:page sidebar="false" showheader="false" controller="LeadsNearbyMe">
 
  <apex:includeScript value="{!$Resource.googleMapsAPI}" />
      <script type="text/javascript"
        src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCROH4OR9fzDhmprWPL1wGWfPT4uGUeMWg&sensor=false">
        </script>
        
    <!-- Setup the map to take up the whole window -->
    <style>
        html, body { height: 100%; }
        .page-map, .ui-content, #map-canvas { width: 100%; height:100%; padding: 0; }
        #map-canvas { height: min-height: 100%; }
    </style>
    
    <script>
        function initialize() {
            var lat, lon;
          
             if (navigator.geolocation) {
                 navigator.geolocation.getCurrentPosition(function(position){
                     lat = position.coords.latitude;
                     lon = position.coords.longitude;                    
                     
                     // Use Visualforce JavaScript Remoting to query for nearby conts      
                     Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.LeadsNearbyMe.getNearby}', lat, lon,
                         function(result, event){
                             if (event.status) {
                                 console.log(result);
                                 createMap(lat, lon, result);           
                             } else if (event.type === 'exception') {
                                 //exception case code          
                             } else {
                                            
                             }
                          },
                          {escape: true}
                      );
                  });
              } else {
                  // Set default values for map if the device doesn't have geolocation capabilities
                    /** Eindhoven **/
                    lat = 51.096214;
                    lon = 3.683153;
                    
                    var result = [];
                    createMap(lat, lon, result);
              }
          
         }
    
         function createMap(lat, lon, leads){
            var currentPosition = new google.maps.LatLng(lat,lon);
            var mapDiv = document.getElementById('map-canvas');
            var map = new google.maps.Map(mapDiv, {
                center: currentPosition,
                zoom: 13,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });
            
            // Set a marker for the current location
            var positionMarker = new google.maps.Marker({
                map: map,
                position: currentPosition,
                title: 'You are here',
            });
            
            // Keep track of the map boundary that holds all markers
            var mapBoundary = new google.maps.LatLngBounds();
            mapBoundary.extend(currentPosition);
            
            // Set markers on the map from the @RemoteAction results
            var cont;
            for(var i=0; i<leads.length;i++){
                cont = leads[i];
                console.log(leads[i]);
                setupMarker();
            }
       map.fitBounds(mapBoundary);

           function setupMarker(){
                var contNavUrl;
           
                try{
                    if(sforce.one){
                        contNavUrl =
                            'javascript:sforce.one.navigateToSObject(\'' + cont.Id + '\')';
                    }
                } catch(err) {
                    console.log(err);
                    contNavUrl = '\\' + cont.Id;
                }
                
                var contDetails =
                    
                    cont.Name + ',' +
                    cont.Street + ',' +
                    cont.City + ',' +
                    cont.PostalCode;
           var marker = new google.maps.Marker({
                   map: map,
                   icon : "{!URLFOR($Resource.GoogleMarkers, 'GoogleMark/4-l.png')}",
                   title:contDetails,
                   position: new google.maps.LatLng(
                                   cont.Location__Latitude__s,
                                   cont.Location__Longitude__s)
               });
               mapBoundary.extend(marker.getPosition());
           }
                  
           }
 
        google.maps.event.addDomListener(window, 'load', initialize);
        
    </script>
<body style="font-family: Arial; border: 0 none;">
 
        <div id="map-canvas"></div>
    </body>
 
</apex:page>


Screen shot:
------------------

User-added image


Thanks & Regards,
  • January 07, 2015
  • Like
  • 2
Hi All,

What is the best integration approach which need to be followed when integrating SFDC and SAP with middileware SAP PI and the volume of data is expected to be between 1000 and 1500

Scenario 1 :: When SAP PI need to invoke SFDC
Scenario 2 :: When SFDC need to invoke SAP PI

Thanks...
Our company is just beginning implementation of SFDC, and will need a consultant to come into our Los Angeles office to help with initial setup for a couple of days. We are in the west Los Angeles Area near LAX Airport. (Hawthorne/90250). Initially, we will need help with setup of custom fields, as well as importing customer and Item data. Longer term, we'll need to make sure salesforce1 is setup and operating correctly.  Please contact me James at  jkiehle@fulham.com if interested & available.  Consultant needed ASAP, please reply with qualifications and rates.

I am using SAP Crystal Reports 2013 and trying to connect to SFDC. Getting an error message though have a valid user name/password and security token. Please help !

 

The error message is :

 

HY000: Invalid_Login: Invalid username, password, security token; or user locked out. [Database Vendor Code:41]

 

 

  • December 09, 2013
  • Like
  • 1
How to Integrate Quick Books With our App I'm new to Quickbook. Is there any material available for intergrating the Quickbook with our(salesforce) application and alsio i need some coding for the intergrating the QB. reply as soon as possible.. regards,