• test777
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 2
    Replies

Hi All,

    I am writing code like this.for displaying pointer in the google maps in vf page based on the address of the account object.

<apex:page standardController="Account" sidebar="false" showHeader="false">

<head>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
var map;
var geocoder;
var address;

function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(40.730885,-73.997383), 15);
map.addControl(new GLargeMapControl);
GEvent.addListener(map, "click", getAddress);
geocoder = new GClientGeocoder();
}

function getAddress(overlay, latlng) {
if (latlng != null) {
address = latlng;
geocoder.getLocations(latlng, showAddress);
}
}

function showAddress(response) {
map.clearOverlays();
if (!response || response.Status.code != 200) {
alert("Status Code:" + response.Status.code);
} else {
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(
'<b>orig latlng:</b>' + response.name + '<br/>' +
'<b>latlng:</b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
'<b>Status Code:</b>' + response.Status.code + '<br>' +
'<b>Status Request:</b>' + response.Status.request + '<br>' +
'<b>Address:</b>' + place.address + '<br>' +
'<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' +
'<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
}
}

$(document).ready(function() {

var myOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
}

var map;
var marker;

var geocoder = new google.maps.Geocoder();
var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, "+ "{!Account.Billingstate}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";

var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.Billingstate}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
});

geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);
//center map
map.setCenter(results[0].geometry.location);

//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Account.Name}",
draggable:true


});

//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});

}

} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});

function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}

});
</script>

<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>

</head>

<body onload="initialize()">
<div id="map"></div>
</body>
</apex:page>

 

 

But i want extension like when dragging the pointer from oone location (ameerpet) to another location like(madhura nager) then automatically update the address in the account object as madhuranagar instead of ameerpet>Any one can u help me this.Its urgent for me.

 

Thanks in advance.

anu

Hi All,

    I  have displayed like that When we click on a button in an account, it should disply a pointer in the state entered in the account on Google Map with Account name Up to this working fine.But when we drag the pointer to some other location on Google Map and click on a Save button, it should change the account address to the new address .

Hi All,

      For single sign on settings in salesforce enable the SAML .In this which type  file i have to browse in the identity provider certificate. and issuer.Any one can u please help me this.

 

 

 

Thanks in advance.

Hi all ,

      I have one object called Leaves.This object contains fields like fromdate(date),todate(date),employee(lookup of employee object.)First time create the record in leaves object successfully.In this no of days as formula field like as follows.Noofdays=todate-fromdate+1 and Noofavailableleaves  like as follows,Noofavailabledays=12-noofdays.It works fine.

 

first time,

      Fromdate:1/5/2012

     Todate:1/6/2012

No.of.days=2

No.of.availableleaves=12-2=10

employee=abc;    

                       It works fine.


 

Second time when i try to create record with same employee,Then  i want the values like this in formula fields.

 Fromdate:2/5/2012

     Todate:2/6/2012

No.of.days=2

No.of.available leaves=10-2=8Because in the previous record the same employee is created and this emaployee contains noofavailableleavs is 10.next time i want to display the value vaue based on the first created record

employee=abc; 

 

Problem:But in the second time also display  the No.of.available leaves as 10.How to fix this.i hope it would be clear. Any one can u please help me.

 

Thanks in advance.

 

 

 

Hi all,

     i have one object called leaves.In this we have to calculate the no of used days quarterly wize.

i.e.,from date,To date two date fields.Based on the from date,to date  two values are entered then no of days obtained.

no.of.days=todate-fromdate+1; and these no of days are calculated based on quarterly wize. Any one can u please help me this.

 

 

Thanks in advance

Hi all,

   i want to insert the record through vf page. and in that page didnt display account name.But in the back end field of account name i want to store the inserted account id as value in that account name field.Any one can you please help me.

 

 

Thanks in advance.

Hi all,

     i wrote test class for this trigger

 

trigger ActivityReportTrigger on Task (before insert)
{
account a1;
integer count=0;
integer count1=0;
list<Account> acclist= new list<Account>();
Map<String,Integer> m= new Map<String,Integer>();
Map<String,Integer> m1= new Map<String,Integer>();
set<id> s= new set<id>();
for(task t:trigger.new)
s.add(t.whatid);
for(account a:[select id,Sum_of_emails__c,Sum_of_calls__c,Sum_of_call_durations__c from account where id in:s])
a1=a;
for(task t:trigger.new)
{
if(m.get(t.Subject)!=null && t.Subject!=null && t.Subject=='Email')
count=m.get(t.Subject);
count++;
system.debug(count+'$$$$$');
m.put(t.Subject,count);
for(String tm: m.keyset())
{
if(m.get(t.Subject)!=null && t.Subject!=null && t.Subject=='Email')
{
a1.Sum_of_emails__c=a1.Sum_of_emails__c+m.get(tm);
update a1;
}
}
}
for(task t:trigger.new)
{
if(m1.get(t.Five9__Five9CallType__c)!=null && t.Five9__Five9CallType__c!=null )
count1=m1.get(t.Five9__Five9CallType__c);
count1++;
system.debug(count+'$$$$$');
m1.put(t.Five9__Five9CallType__c,count1);
for(String tm1: m1.keyset())
{
if(m1.get(t.Five9__Five9CallType__c)!=null && t.Five9__Five9CallType__c!=null )
a1.Sum_of_calls__c=a1.Sum_of_calls__c+m1.get(tm1);
update a1;
}
}
for(task t:trigger.new)
{
if(t.CallDurationInSeconds!=null && t.Five9__Five9CallType__c!=null )
a1.Sum_of_call_durations__c=a1.Sum_of_call_durations__c+t.CallDurationInSeconds;
update a1;
}
}

 

But i wrote test class for this trigger as follows.

@isTest
public class activitytestcls
{
public static testMethod void verifyaccdetails()
{
task t=new task()
//t.Owner='William Raney';
t.Status='Not Started';
t.Priority='Normal';
t.Subject='Email';
t.Five9__Five9CallType__c='Test';
insert t;
account account a=[select id,Sum_of_emails__c,Sum_of_calls__c,Sum_of_call_durations__c from account where id =:t.id];
update a;
}
}

 

But it showing an one failure like as follows.

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ActivityReportTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.ActivityReportTrigger: line 25, column 1: [>

 

How to fix this.Any one can u please help me this.

 

Thansk in advance.

 



Hi All,

     i want to display the pick list in vf page.In that pick list i want to display the another custom object records.Its urgent.Any one can u please help me this.

 

Thanks in advance.

Hi all,

    i want to move the more than 2000 accounts from google analytics to salesforce using web analytics app.Any one can you please help me .Its very urgent for me.

 

Thanks in advance

Anu

Hi All,

      I want to send bulk of records from salesforce to other database using http callout.Any one can you please help me.Its urgent.

 

Thanks in advance.

Hi all,

   i am new to apex scheduling class.I need to write apex class for scheduling each 5 minutes.Any one can u please help me this.

 

 

Thanks in advance.

anu

Hi All,

     i need to call webservice method of enterprise edition in java class.i  wrote like this for stub.

Here Dss is the webservice class name of Enterprise edition.

 

import com.sforce.soap.schemas._class.Dss.DssBindingStub;
import com.sforce.soap.schemas._class.Dss.DssServiceLocator;

 

Function like this

private void method123()

{

DssBindingStub accountBindingStub=null;

accountBindingStub=(DssBindingStub) new DssServiceLocator().getDss();

accountBindingStub.setHeader(new DssServiceLocator().getServiceName().getNamespaceURI(), "SessionHeader",new SessionHeader(connection.getConfig().getSessionId()));
String p="<?xml version='1.0' encoding='UTF-8'?>"+
"<OrderStatusNotification xmlns='http://www.hns.com/iag/schemas/partner'>"+
"<MessageHeader>"+
"<TransactionDateTime>11/01/2011 10:21:20</TransactionDateTime>"+
"<TransactionCode>CON</TransactionCode>"+
"<TransactionSequenceId>DSS115825734</TransactionSequenceId>"+
"</MessageHeader>"+
"<SAN>DNYPP002</SAN>"+
"<OrderId>2990077</OrderId>"+
"<FSOId>3438998</FSOId>"+
"<CONCode>0</CONCode>"+
"<ConMessage>Order accepted, SAN assigned, Field Service Order created, Distributor assigned. Installation not scheduled. Order modification allowed.</ConMessage>"+
"<Name>"+
"<FirstName>Parul</FirstName>"+
"<LastName>Goel</LastName>"+
"</Name>"+
"<InstallAddress>"+
"<StreetAddress1>1400 Spring Garden Street</StreetAddress1>"+
"<StreetAddress2>String</StreetAddress2>"+
"<City>Greensboro</City>"+
"<State>NC</State>"+
"<PostalCode>27412</PostalCode>"+
"<CountryCode>US</CountryCode>"+
"</InstallAddress>"+
"</OrderStatusNotification>";

String s=accountBindingStub.notification(p);

System.out.println('-----------'+s);

}

 

Here notification is the metod which is in the Dss class of enterprise edition.

 

And for this i generate  jar files using wsc-20.jar(dss.jar,enterprise.jar,metadata.jar).All thes jar files are added under the java projece.But i got a message like 

import com.sforce.soap.schemas._class.Dss.DssBindingStub;
import com.sforce.soap.schemas._class.Dss.DssServiceLocator; packages are not resolved.

Any one can u help me this .

 

 

 

 

Thanks in advance.

Hi All,

      I need to navigate the tab from one tab to another tab based on the action done in the vf page.Any one can u please help me this.Its urgent.I hope can any one solve this problem.

 

Thanks in advance.

Hi all,

   i need to write a test class for the following class it shows one failure as list has no rows for assignment to SObject. and it covers 54%.How to fix this issue.Any one can u please help me this .

public class ManagementController {
    public Setting__c Setting {get;set;}    private Boolean NewRecord;    public ManagementController(){        List<Setting__c> Settings = [Select Id, Click_License__c, User_License__c, Country_Name_Style__c, Country_List__c, Use_International_Data__c, Use_Royal_Mail_UK_Data__c, Use_USPS_Data__c, Royal_Mail_Company__c, Royal_Mail_Reverse__c, USPS_Reverse__c from Setting__c where Name = 'Master'];                if ((Settings != null) && (Settings.size() > 0)) {            Setting = Settings[0];            NewRecord = false;        }        else {            Setting = new Setting__c();            Setting.Name = 'Master';            NewRecord = true;        }    }        public PageReference UpdateRecord() {        upsert Setting;                if (NewRecord) {            SetupStandardRecords standardrecords = new SetupStandardRecords(Setting);            NewRecord = false;        }                UpdateSettingsDocument();                            return null;    }        public String getScriptId() {        return [select Id from Document where DeveloperName = 'Lookup_Component'].Id;    }        private void UpdateSettingsDocument() {        List<Address__c> Addresses = [select Street_Field__c, City_Field__c, State_Field__c, Postalcode_Field__c, Country_Field__c, Company_Field__c from Address__c where Setting__c = :Setting.Id];        List<Action__c> Actions = [select Event__c, Code__c from Action__c where Setting__c = :Setting.Id];            SettingsPublisher Publisher = new SettingsPublisher();        Publisher.UpdateDocument(Setting, Addresses, Actions);    }        static testMethod void testManagementController() {     SettingsPublisher Publisher = new SettingsPublisher();        ManagementController controller = new ManagementController();        Setting__c s=new Setting__c(name='Master');        insert s;                controller.UpdateRecord();        controller.getScriptId();        controller.UpdateSettingsDocument() ;   

}}

 

 

Thanks in advance

Hi all,

    I want to cover the test coverage for 

public string readXMLResponse(XmlStreamReader reader) {   string retValue; // Read through the XML  while(reader.hasNext())  {    if (reader.getEventType() == XmlTag.START_ELEMENT)    {            if (reader.getLocalName() == 'TransactionDateTime')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssTransactionDateTime = reader.getText();       }       }       if (reader.getLocalName() == 'TransactionCode')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssTransactionCode= reader.getText();       }       }       if (reader.getLocalName() == 'TransactionSequenceId')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssTransactionSequenceId= reader.getText();                   }       }         if (reader.getLocalName() == 'CustomerId')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssCustomerId= reader.getText();        Account acc=[select id,Dss_Customer_Id__c,Account_Customer_ID__c from account where id=:accountid limit 1];         acc.Dss_Customer_Id__c=dssCustomerId;         acc.Account_Customer_ID__c=dssCustomerId;         update acc;                 }       }        if (reader.getLocalName() == 'CorrelationTransactionId')       {        reader.next();        system.debug('%%%%%%%%%%%%%%%%');        if (reader.getEventType() == XmlTag.characters)       {          dssCorrelationTransactionId= reader.getText();                   Order_Line_Items__c orc=[ select id,orders__c,Transaction_Sequence_ID__c,TransactionCode__c,TransactionDateTime__c,Correlation_Transaction_ID__c from Order_Line_Items__c  where orders__c =:oid limit 1];       orc.Correlation_Transaction_ID__c=dssCorrelationTransactionId;    update orc;       }       }          if (reader.getLocalName() =='Message')       {        reader.next();                if (reader.getEventType() == XmlTag.characters)       {          dssMessage= reader.getText();          system.debug(dssMessage+'DMMMMMMMMMMMMM');         }                         }       if (reader.getLocalName() =='ConMessage')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssMessage1= reader.getText();          system.debug(dssMessage1+'DMMMMMMMMMMMMM1');         }                         }       if (reader.getLocalName() == 'OrderId')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dss_order_id= reader.getText();         Opportunity opp=[select id,DSS_Order_ID__c from opportunity where id=:opptid limit 1];         opp.DSS_Order_ID__c=dss_order_id;         Order__c orr=[select id,DSS_Order_ID__c from Order__c where id=:oid limit 1];         orr.DSS_Order_ID__c=dss_order_id;         system.debug( orr.DSS_Order_ID__c+'IDDDDDDDDDDDDDDDDDD');         update opp;         update orr;       }       }                    }       reader.next();       }       return null;       }Any one can u plase help me this .

 

Thanks in advance.

Hi all,

      i have written tes class for this.But it covers 71%.How to rectify to cover 75% above.Any one can u please help me.

 

public  class optwizardcls {public string tabname{set;get;}public string url{get;set;}public string url1{get;set;}public string url2{get;set;}public string url3{get;set;}public string url4{set;get;}public string url5{get;set;}public string ust;public String a1id{get;set;}public String aid{get;set;}public Id cid{get;set;}public Id pid{get;set;}public Id oid{get;set;}public id qid{set;get;}pagereference pref;public set<id> conset=new set<id>();String TabInFocus = System.currentPageReference().getParameters().get('aid');public optwizardcls(){a1id=apexpages.currentPage().getParameters().get('aid');aid=apexpages.currentPage().getParameters().get('accid');cid=apexpages.currentPage().getParameters().get('cntid');pid=apexpages.currentPage().getParameters().get('ploc');oid=apexpages.currentPage().getParameters().get('oppId');qid=apexpages.currentPage().getParameters().get('quoteid');url='apex/accountwizard';if(aid!=null)url1='/apex/WizardContact?accid='+aid;if(aid!=null)url2='/apex/physicallocation?accid='+aid;if(aid!=null)url3='/apex/opportunitywizard?accid='+aid;
}
public void getaccrefreshtab(){if(aid!=null)url='apex/accountwizard?accid='+aid;else if(a1id!=null)url='apex/accountwizard?aid='+a1id;}public void getcontRefreshTab(){try{url1='/apex/WizardContact?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account');   ApexPages.addMessage(myMsg);}}public void getphyrefreshtab(){try{url2='/apex/physicallocation?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account');   ApexPages.addMessage(myMsg);}}
public void getopprefreshtab(){try{url3='/apex/opportunitywizard?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account');   ApexPages.addMessage(myMsg);}}public void getquoteRefreshTab(){try{url4='/apex/QuoteWizard?accid='+aid;}catch(StringException e){ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Please select Account');   ApexPages.addMessage(myMsg);}}
static testmethod void optwizardtest(){
//Account acc=new Account(name='test',Account_Customer_ID__c='123test');//insert acc;test.starttest();optwizardcls opt=new optwizardcls();
opt.getaccrefreshtab();opt.getcontRefreshTab();opt.getphyrefreshtab();opt.getopprefreshtab();opt.getquoteRefreshTab();test.stopTest();
}
}

 

 

thanks in advance 

Hi all,

     I want to find out the end point url of salesforce.for connecting salesforce with dss database.How to give end point url and its login username,password,security token using http callouts.Any one can you help me this.Its Urgent.

Hi All,

     I try to read the data from XMl.i got a message like.<message>&lt;li>Site [DNYF7181] is active in DSS. Such order(s) are allowed ONLY during MOVE scenario without any transport service offering(s) (i.e. Ku, Ka and DSL).&lt;li>SAN - ['DNYF7181'] already exists. Code PIM 864</message>.i want to display the data like as  "SAN - ['DNYF7181'] already exists. Code PIM 864"?How to access this one.Any one can you please help me out.

 

 

Thanks in advance.

Hi All,

    i want to find out the end point url of my sandbox account. for connecting to another database.ANy one can u please help me this.

 

Thanks in advance.

Hi all,

 i want to write validation rule for text field name as sample and its default value is 'Test'. When i create the record first time its value is saved as usually.But when i try to edit the record at that time sample field does not allowing the value as Test.Need to change that value in second time.Any one can u please help me that.

 

Thanks in advance.

Hi All,

      I need to navigate the tab from one tab to another tab based on the action done in the vf page.Any one can u please help me this.Its urgent.I hope can any one solve this problem.

 

Thanks in advance.

Hi all,

   i need to write a test class for the following class it shows one failure as list has no rows for assignment to SObject. and it covers 54%.How to fix this issue.Any one can u please help me this .

public class ManagementController {
    public Setting__c Setting {get;set;}    private Boolean NewRecord;    public ManagementController(){        List<Setting__c> Settings = [Select Id, Click_License__c, User_License__c, Country_Name_Style__c, Country_List__c, Use_International_Data__c, Use_Royal_Mail_UK_Data__c, Use_USPS_Data__c, Royal_Mail_Company__c, Royal_Mail_Reverse__c, USPS_Reverse__c from Setting__c where Name = 'Master'];                if ((Settings != null) && (Settings.size() > 0)) {            Setting = Settings[0];            NewRecord = false;        }        else {            Setting = new Setting__c();            Setting.Name = 'Master';            NewRecord = true;        }    }        public PageReference UpdateRecord() {        upsert Setting;                if (NewRecord) {            SetupStandardRecords standardrecords = new SetupStandardRecords(Setting);            NewRecord = false;        }                UpdateSettingsDocument();                            return null;    }        public String getScriptId() {        return [select Id from Document where DeveloperName = 'Lookup_Component'].Id;    }        private void UpdateSettingsDocument() {        List<Address__c> Addresses = [select Street_Field__c, City_Field__c, State_Field__c, Postalcode_Field__c, Country_Field__c, Company_Field__c from Address__c where Setting__c = :Setting.Id];        List<Action__c> Actions = [select Event__c, Code__c from Action__c where Setting__c = :Setting.Id];            SettingsPublisher Publisher = new SettingsPublisher();        Publisher.UpdateDocument(Setting, Addresses, Actions);    }        static testMethod void testManagementController() {     SettingsPublisher Publisher = new SettingsPublisher();        ManagementController controller = new ManagementController();        Setting__c s=new Setting__c(name='Master');        insert s;                controller.UpdateRecord();        controller.getScriptId();        controller.UpdateSettingsDocument() ;   

}}

 

 

Thanks in advance