• snowMonkey
  • NEWBIE
  • 30 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
i am trying to get the state and country picklist to work in a Web2lead form and was wondering how to get the cascading picklists(country and its states)done by just changing the HTML.

I can resort to a dropdown of html and Javascript ajax calls to get it done the traditional way, but that is not thru salesforce. Any other ways that you know about to get this cascading thing done by using vf/apex?

I am trying to add multiple markers to my google maps on my positions layout where you have a 1 to many with many addresses which i have to get plotted on the map. I tried the same Google api calls on an HTML page with JS calls and it worked.  When i am hardcoding the object names in my page and then call ,without the APEX :REPEAT tag it works again. dont know what is wrong. can someone look into this and tell if something stands out

 

<apex:page standardcontroller="Position__c">
<apex:pageBlock >
<head>
This map shows the locations of candidates who have applied for the {!Position__c.Name} position.....

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

   function initialize()
   {
        var myCenter = new google.maps.LatLng(40.825612,-74.402413);
        var myOptions = { center: myCenter, zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP };

        var map = new google.maps.Map(document.getElementById("googleMap"), myOptions);
        var geocoder = new google.maps.Geocoder();

        <apex:repeat var="ja" value="{!Position__c.nanlabs__Job_Applications__r}">
          counter++;
          var address = "{!ja.nanlabs__Candidate_Number__r.Street__c}, {!ja.nanlabs__Candidate_Number__r.City__c}, {!ja.nanlabs__Candidate_Number__r.State_Province__c}";
          geocoder.geocode( { 'address': address}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK && results.length) {
              if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {      
               map.setCenter(results[0].geometry.location);
                marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location
                   // title: "{!ja.nanlabs__Candidate_Number__r.First_Name__c} + ' ' + {!ja.nanlabs__Candidate_Number__r.Last_Name__c}"
                });
                marker.setmap(map);
              }      
            }
          });
        </apex:repeat>
        
         if(counter == 0) {
         // Display map of US if no Candidates found
            var myPoint = new YGeoPoint(40,-95);
            map.drawZoomAndCenter(myPoint, 14);
            alert("There are no candidates for this position to map.");
        }
    }
  google.maps.event.addDomListener(window, 'load', initialize );
</script>
</head>

<body>
<div id="googleMap" style="width:100%;height:400px;"></div>
</body>
</apex:pageBlock>
</apex:page>

When i login with my DE account ,i cannot access these forums. I have tried to use multiple IDs , browsers et all and this has been with SF support for like 2 months now. (you might be wondering how am i able to post this msg in here)..for some reason it works when i invoke the private browsing mode in firefox...

 

Any idea anyone?

 

I am getting an invalid Type Error on the following code.

 

Code is from the force.com workbook example. Any suggestions as to how to resolve this error. Thanks!

 

public with sharing class ApexTest {	

	public enum Season {Summer,Fall}
	public string modelNumber;
	public Integer numberInStock;
	public static final Integer stockThreshold = 5;

	public ApexTest() {
	modelNumber = 'XX-XX';
	numberInStock = 0;
	system.debug('------------------------------------///////no values, but model number is : ' + modelNumber);
	}
	
	public ApexTest (String theModelNumber, Integer theNumberInStock) {
	modelNumber = theModelNumber;
	numberInStock = theNumberInStock;
	system.debug('------------------------------------///////2  values, but model number is : ' + modelNumber);
	} 

	public interface KitchenUtility {
	   String getModelNumber();
	}
	
	public class Toaster implements KitchenUtility {
	 private String modelNumber;
	  public String getModelNumber() {
		return 'T' + modelNumber;
	  }		
	}
	
	public void setModelNumber(String theModelNumber) {
	   modelNumber = theModelNumber;
	}

	public String getModelNumber() {
           return modelNumber;
	}
}

Calling code :

ApexTest f = new ApexTest('MX', 200);
Toaster t = New Toaster(); 	// This line has the error: Invalid Type Toaster

KitchenUtility [] utilities = new KitchenUtility[] { f, t };
String model = utilities[0].getModelNumber();
System.debug(model);

 

Totally new to SFDC and apex...sorry! :)

 

writing a class to call the simplest WS thru apex and not able to get the request to the ws properly. Can anyone help pls.

 

The erroR is a generic 500 error

 

16:44:46:211 USER_DEBUG [49]|DEBUG|System.HttpResponse[Status=Internal Server Error, StatusCode=500]

 

public with sharing class Integration {

@future (callout=true) 
public static void postOrder(string as1 , String as2) {
	
    httpRequest req = new httpRequest();
    string mycardType = 'Visa';
    string mycardNumber = '1111111111111111';
    
    req.setEndpoint('http://www.webservicex.net/CreditCard.asmx');
    req.setMethod('POST');
    //req.setHeader('Host', 'http://www.webservicex.net');
    //req.setHeader('Content-Type', 'text/xml; charset=utf-8');
    //req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
    
    //req.setHeader('SOAPAction', 'http://www.webservicex.net/ValidateCardNumber');
    
    /*
    string b = '<?xml version="1.0" encoding="utf-8"?>';
    b += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
    b += '<soap:Body>';
    b += '<ValidateCardNumber xmlns="http://www.webservicex.net">';
    b += '<CardType>' + cardType + '</CardType>';
    b += '<CardNumber>' + cardNumber + '</CardNumber>';
    b += '</ValidateCardNumber>';
    b += '</soap:Body>';
    b += '</soap:Envelope>';
    */
    
    req.setBody('cardType='+EncodingUtil.urlEncode(mycardType, 'UTF-8')+'&cardNumber='+EncodingUtil.urlEncode(mycardNumber, 'UTF-8'));    
    //string b = 'cardType=' + mycardType + '&cardNumber=' + mycardNumber ;    
    //req.setBody(b);
    
    req.setCompressed(true);
    //System.debug('Full request: '+ b); 
    
    Http http = new Http(); 
    HTTPResponse res = http.send(req);
    system.debug(res.toString());
    
    System.debug('Response from CC Checking Engine: '+ res.getBody());
    XmlStreamReader reader = new XmlStreamReader(res.getBody());
    system.debug(reader.toString());
    if (res.getStatusCode() != 200) {
            System.debug('Error from ' + req.getEndpoint() + ' : ' +
            res.getStatusCode() + ' ' + res.getStatus());
        }
    else {
            //List<nanlabs__Invoice_Statement__c> invoiceStatements = [SELECT Id FROM Invoice_Statement__c WHERE Id IN :invoiceIds];
            List<nanlabs__Invoice_Statement__c> invoiceStatements = [SELECT Id FROM Invoice_Statement__c ];
    
            for(Invoice_Statement__c inv: invoiceStatements ) {
                string myCallback = reader.getAttributeValue(null, 'ValidateCardNumberResult');
                system.debug('Response is: [' + myCallback  + ']');
                inv.callback__c = myCallback;
                update inv;
            }
        }
}
}

 

i am trying to get the state and country picklist to work in a Web2lead form and was wondering how to get the cascading picklists(country and its states)done by just changing the HTML.

I can resort to a dropdown of html and Javascript ajax calls to get it done the traditional way, but that is not thru salesforce. Any other ways that you know about to get this cascading thing done by using vf/apex?

Can anyone provide me with advice on how to change my Apex Trigger below to not have the SOQL query within my for loop? I am getting the "Too many SOQL queries" error.

 

trigger AccountTeamDuplicateTrigger on Account_Team_Assignment__c (before insert,before update) {
  for (Account_Team_Assignment__c c : Trigger.new){

   Account_Team_Assignment__c[] Account_Team_Assignments= [select Account_Name__c from Account_Team_Assignment__c Where Active__c = TRUE and Business_Segments__c = :c.Business_Segments__c and Account_Name__c = :c.Account_Name__c ];
   
   if (Account_Team_Assignments.size() > 1) {
     c.Representative__c.addError('BDRep cannot be created - An active BD already exists in the Account Team for this Business Segment');
  }     
 }
}

 Where can I find a test class written for a particular apex class.......I can only see the code covered for a particular class but unable to find the test class for it..... 

I am getting an invalid Type Error on the following code.

 

Code is from the force.com workbook example. Any suggestions as to how to resolve this error. Thanks!

 

public with sharing class ApexTest {	

	public enum Season {Summer,Fall}
	public string modelNumber;
	public Integer numberInStock;
	public static final Integer stockThreshold = 5;

	public ApexTest() {
	modelNumber = 'XX-XX';
	numberInStock = 0;
	system.debug('------------------------------------///////no values, but model number is : ' + modelNumber);
	}
	
	public ApexTest (String theModelNumber, Integer theNumberInStock) {
	modelNumber = theModelNumber;
	numberInStock = theNumberInStock;
	system.debug('------------------------------------///////2  values, but model number is : ' + modelNumber);
	} 

	public interface KitchenUtility {
	   String getModelNumber();
	}
	
	public class Toaster implements KitchenUtility {
	 private String modelNumber;
	  public String getModelNumber() {
		return 'T' + modelNumber;
	  }		
	}
	
	public void setModelNumber(String theModelNumber) {
	   modelNumber = theModelNumber;
	}

	public String getModelNumber() {
           return modelNumber;
	}
}

Calling code :

ApexTest f = new ApexTest('MX', 200);
Toaster t = New Toaster(); 	// This line has the error: Invalid Type Toaster

KitchenUtility [] utilities = new KitchenUtility[] { f, t };
String model = utilities[0].getModelNumber();
System.debug(model);

 

Hello,

 

To start off, I have been working with Salesforce as an administrator for about 2 years. Before I began, I had no experience with the Cloud or any platform similar to Salesforce.

 

I would like to get started with more formal administrator and developer instruction, as I intend to get my Administrator and Developer certifications. I believe I'm off on the right foot: going through the tutorials and workbooks Salesforce provides online, but I do not know what my next step should be.

 

For someone at my level, I wonder if Dreamforce would be a worthwhile investment, but I'm worried that the information provided there still beyond my scope?

 

Are the classes provided by Salesforce necessary to obtain their respective certifications, or would I be able to acquire the knowledge they provide from hands-on experience? I know they are not required for certification, but how valuable is the insight they provide?

 

Totally new to SFDC and apex...sorry! :)

 

writing a class to call the simplest WS thru apex and not able to get the request to the ws properly. Can anyone help pls.

 

The erroR is a generic 500 error

 

16:44:46:211 USER_DEBUG [49]|DEBUG|System.HttpResponse[Status=Internal Server Error, StatusCode=500]

 

public with sharing class Integration {

@future (callout=true) 
public static void postOrder(string as1 , String as2) {
	
    httpRequest req = new httpRequest();
    string mycardType = 'Visa';
    string mycardNumber = '1111111111111111';
    
    req.setEndpoint('http://www.webservicex.net/CreditCard.asmx');
    req.setMethod('POST');
    //req.setHeader('Host', 'http://www.webservicex.net');
    //req.setHeader('Content-Type', 'text/xml; charset=utf-8');
    //req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
    
    //req.setHeader('SOAPAction', 'http://www.webservicex.net/ValidateCardNumber');
    
    /*
    string b = '<?xml version="1.0" encoding="utf-8"?>';
    b += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
    b += '<soap:Body>';
    b += '<ValidateCardNumber xmlns="http://www.webservicex.net">';
    b += '<CardType>' + cardType + '</CardType>';
    b += '<CardNumber>' + cardNumber + '</CardNumber>';
    b += '</ValidateCardNumber>';
    b += '</soap:Body>';
    b += '</soap:Envelope>';
    */
    
    req.setBody('cardType='+EncodingUtil.urlEncode(mycardType, 'UTF-8')+'&cardNumber='+EncodingUtil.urlEncode(mycardNumber, 'UTF-8'));    
    //string b = 'cardType=' + mycardType + '&cardNumber=' + mycardNumber ;    
    //req.setBody(b);
    
    req.setCompressed(true);
    //System.debug('Full request: '+ b); 
    
    Http http = new Http(); 
    HTTPResponse res = http.send(req);
    system.debug(res.toString());
    
    System.debug('Response from CC Checking Engine: '+ res.getBody());
    XmlStreamReader reader = new XmlStreamReader(res.getBody());
    system.debug(reader.toString());
    if (res.getStatusCode() != 200) {
            System.debug('Error from ' + req.getEndpoint() + ' : ' +
            res.getStatusCode() + ' ' + res.getStatus());
        }
    else {
            //List<nanlabs__Invoice_Statement__c> invoiceStatements = [SELECT Id FROM Invoice_Statement__c WHERE Id IN :invoiceIds];
            List<nanlabs__Invoice_Statement__c> invoiceStatements = [SELECT Id FROM Invoice_Statement__c ];
    
            for(Invoice_Statement__c inv: invoiceStatements ) {
                string myCallback = reader.getAttributeValue(null, 'ValidateCardNumberResult');
                system.debug('Response is: [' + myCallback  + ']');
                inv.callback__c = myCallback;
                update inv;
            }
        }
}
}