• Sasha_SFDC
  • NEWBIE
  • 30 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 20
    Replies
I am using the apex:map component in a Visualforce page. I can successfully render a map using coordinates pulled through an apex class.

However, the resulting location on the Visualforce page is slightly different to that shown if I put the same coordinates directly into Google Maps. (See maps below)

Does anyone know why this is happening?

VF page map code
 
<!-- Display the address on a map -->
        <apex:map width="600px" height="400px" mapType="roadmap" zoomLevel="17" center="{!program.Location__r.LatitudeTEXT__c},{!program.Location__r.LongitudeTEXT__c}">
            <apex:mapMarker title="" position="{!program.Location__r.LatitudeTEXT__c},{!program.Location__r.LongitudeTEXT__c}"/>
        </apex:map>

Visualforce Page Map
(you can see the coordinates returned from the apex class just above the map - these are what the map is using.)

User-added image

Google Map
(notice coordinates are the same as the VF page, but pin location is different)

User-added image
  • May 13, 2015
  • Like
  • 0
Hello everyone,

I am developing a native iOS app using Salesforce SDK (connected app). I want to use push notification api to send notification to anyone who is involved in some events (out of Salesforce). But it does not work for me.
https://developer.salesforce.com/docs/atlas.en-us.pushImplGuide.meta/pushImplGuide/connect_resources_notifcations_push.htm

 Here's the uri which I use to send a post method:
/services/data/v31.0/connect/notifications/push

and the server returned an error:
{
        "message": "The requested API is not available to portal users. You may need to specify a community for portal user access.",
        "errorCode": "FUNCTIONALITY_NOT_ENABLED"
}
Hello, can someone tell me what the full URL is for push notification resources

Also, what's the namespace of the connected app that the push notifications are sent to?

thanks!
Hi All,

I have one task. I want to display 100 map markers in a single visualforce page. I tried apex:map tag, but 10 makers only per page. I tried some javascirpt coding also, again I got 10 markers only. so please give me your suggestion how to display 100 map markers in a page. 

Thanks,
Vijay
Hi everyone,

I am working on iOS & Android native apps within Salesforce SDK. I am also using Chatter Rest API & Salesforce Community. I have configured Push Notification for Connected App & Client side. But I don't see any remote notifications from Salesforce after the other users have liked/commented my feed. So that Salesforce does not automatically send push notifications to device, does it?
I am using the apex:map component in a Visualforce page. I can successfully render a map using coordinates pulled through an apex class.

However, the resulting location on the Visualforce page is slightly different to that shown if I put the same coordinates directly into Google Maps. (See maps below)

Does anyone know why this is happening?

VF page map code
 
<!-- Display the address on a map -->
        <apex:map width="600px" height="400px" mapType="roadmap" zoomLevel="17" center="{!program.Location__r.LatitudeTEXT__c},{!program.Location__r.LongitudeTEXT__c}">
            <apex:mapMarker title="" position="{!program.Location__r.LatitudeTEXT__c},{!program.Location__r.LongitudeTEXT__c}"/>
        </apex:map>

Visualforce Page Map
(you can see the coordinates returned from the apex class just above the map - these are what the map is using.)

User-added image

Google Map
(notice coordinates are the same as the VF page, but pin location is different)

User-added image
  • May 13, 2015
  • Like
  • 0
Hi,


When re-rendering the parent element of a apex:map, I get this error message displayed instead of the map:
"HTTP ERROR 401  Problem accessing /maps/JavascriptHandler. Reason:      Unauthorized Powered by Jetty://".

It works fine on the first loading. Any idea?
Hello,

I'm looking to add some of the new apex:map functionality to one of the orgs I manage.  While it's pretty fantastic how they've made it so easy, there's also some basic things I've noticed lacking.  Specifically...

1. Controlling the color of the map markers.  This is key if you want to show more than one type of thing on the map.

2. Showing a window of data about whatever's at each marker.

3. Capturing marker-related events.  For example, I'd like to capture mouseup, so users can choose a location off the map.

Has anyone approached these challenges yet?  If so, how have you solved them?

Thanks a lot,

Steve
Oakland
Hello, There are many discussions on how to map locations with google maps prior to the spring 2015 release, but now that apex:map and apex:mapmarker are available, I would like to figure out how to modify the marker color using that to bring in a new map rather than the javascript methods that have been previously used.

I currently importing the map to account pages with this code on the visualforce page:
 
<apex:page standardController="Account" extensions="accountMapExtensionTwo">

  <!--This page must be accessed with an Account Id in the URL. -->
  
  <apex:map width="600px" height="400px" mapType="roadmap">

    <apex:repeat value="{!Accounts}" var="acct">
        <apex:mapMarker title="{!acct.name}" position="{!acct.loc}"/>
    </apex:repeat>

  </apex:map>
  

</apex:page>



<!--<apex:page standardController="Account" extensions="accountMapExtension">

  This page must be accessed with an Account Id in the URL. 
  
  <apex:map width="600px" height="400px" mapType="roadmap">

    <apex:repeat value="{!Accounts}" var="acct">
        <apex:mapMarker title="{!Accounts[acct].Name}" position="{!Accounts[acct].BillingStreet},{!Accounts[acct].BillingCity},{!Accounts[acct].BillingState}"/>
    </apex:repeat>

  </apex:map>
  

</apex:page>-->

I then have an apex class that uses this code:
 
public class accountMapExtensionTwo {

    private final Account account;
    
    public accountMapExtensionTwo(ApexPages.StandardController stdController) {
        this.account = (Account)stdController.getRecord();
    }
    
    List<DisplayAccounts> Accts;
    
    public List<DisplayAccounts> getAccounts() {
        
        Map<Id,Account> mapList = new Map<Id,Account>();
        Set<Account> childList = new Set<Account>();
        Set<Id> parentId = new Set<Id>();
        
        Accts = new List<DisplayAccounts>();

        for(Account a : [SELECT Name, Location__longitude__s, Location__latitude__s, Parent.Id, BillingStreet, BillingCity, BillingState, (SELECT Name, Location__longitude__s, Location__latitude__s, BillingStreet, BillingCity, BillingState FROM ChildAccounts) FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('Id')]){
            
            accts.add(new DisplayAccounts(a));
            
            mapList.put(a.id,a);
            
            parentId.add(a.Parent.id);
            
            for(Account acc : a.ChildAccounts){
            
                accts.add(new DisplayAccounts(acc));
                
                mapList.put(acc.id,acc);
            }
        }
        
        List<Account> mapValueList = new List<Account>();
        mapValueList = mapList.values();
        
        for(Account a : [SELECT Name, Location__longitude__s, Location__latitude__s, BillingStreet, BillingCity, BillingState, (SELECT Name, BillingStreet, BillingCity, BillingState  FROM ChildAccounts) FROM Account WHERE Id IN :mapValueList]){
            
            for (Account acc : a.ChildAccounts){
            
                accts.add(new DisplayAccounts(acc));
                
                mapList.put(acc.id,acc);
            }
        }
        
        for(Account a : [SELECT Parent.Id FROM ACCOUNT WHERE Id IN :parentId]){
            parentId.add(a.Parent.Id);
        }
        
        for(Account a : [SELECT Name, Location__longitude__s, Location__latitude__s, BillingStreet, BillingCity, BillingState FROM Account WHERE Id IN :parentId]){
            
            accts.add(new DisplayAccounts(a));
            
            mapList.put(a.id,a);
        }
        
        return accts;
        
    } 
    
    public class DisplayAccounts {
        private Account acct;
        public DisplayAccounts (Account a){
            this.acct = a;
        }
        
        public Map<String,Double> loc {
            get { return 
                new Map<String,Double>{
                    'latitude' => acct.Location__latitude__s,
                    'longitude' => acct.Location__longitude__s
               };
           }
       }
       
       public String name {
           get { return acct.Name;}
       }
       
    }
}
This works perfect for what I'm trying to do, I should note that I'm using geocode for the map marker location.

This code lets you map multple places on an account page, by selecting the parent/child relationship that the accounts are a part of, translating the address for those accounts to geocode, and then displaying the points on a map of a parent account and it's child accounts..

What I'm running into however, is there is almost no documentation on how to change the color of apex:mapmarker. What I would like to do is set it up so that I can change the color of the mapmarker based on a custom field variable. I would also like to potentially change the color of the markers based on the parent/child relationship. However, any help at all on how to change the color/marker icon of apex:mapmarker would be greatly appreciated.

Thank you!







 
I am a development in the "SalesforceMobileSDK for iOS".
While using Chatter REST API for exchanging the data, we're attempting for Push notification using Push Notification resources.
However we can't send any Push Notification but recieve UNKNOWN_EXCEPTION even though we set upthe  POST Palameter referring to API Guide. 

Code you are using is following.
 
NSMutableArray *sendUserIds = [[NSMutableArray alloc] init];
[sendUserIds addObject:@"UserID1"];
[sendUserIds addObject:@"UserID2"];
[sendUserIds addObject:@"UserID3"];
    
NSString *payload = @"{'aps':{'alert':'test', 'badge':0, 'sound':'default'}}";
NSDictionary *sendDic = [[NSDictionary alloc] initWithObjectsAndKeys:@"PushTest", @"appName", @"PushTest", @"namespace", sendUserIds, @"userIds", payload, @"payload", nil];

// URL and Request Object creation
NSString *url = [NSString stringWithFormat:@"/%@/connect/notifications/push",@"v32.0"];
SFRestRequest *req =[SFRestRequest requestWithMethod:SFRestMethodPOST path:url queryParams:sendDic];
    
//POST Execution
[[SFRestAPI sharedInstance] sendRESTRequest:req failBlock:^(NSError *e) {
    NSLog(@"/connect/notifications/push error:: %@",e);
} completeBlock:^(id jsonResponse) {
    NSLog(@"MessegeOk");
}];

Error trace after the above code execution will be below.
 
--------
Response
--------
[{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)","errorCode":"UNKNOWN_EXCEPTION"}]
, [The operation couldn’t be completed. (NSURLErrorDomain error 500.)]
2015-02-17 10:06:51:927 [592:807] ERROR|SFNetworkOperation|callDelegateDidFailWithError An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)
2015-02-17 10:06:51.927 [592:148638] -[MKNetworkOperation operationFailedWithError:] [Line 1792] State: 0
2015-02-17 10:06:51.932 [592:148875] /connect/notifications/push error:: Error Domain=NSURLErrorDomain Code=500 "An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)" UserInfo=0x1d2a3d30 {NSLocalizedFailureReason=UNKNOWN_EXCEPTION, SFOriginalApiError=<CFArray 0x1d290f40 [0x39ef4460]>{type = immutable, count = 1, values = (
	0 : <CFBasicHash 0x1d298640 [0x39ef4460]>{type = immutable dict, count = 2,
entries =>
	0 : <CFString 0x1d2b95c0 [0x39ef4460]>{contents = "message"} = <CFString 0x1d29b8e0 [0x39ef4460]>{contents = "An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)"}
	2 : <CFString 0x1d2b0860 [0x39ef4460]>{contents = "errorCode"} = <CFString 0x1d2b63c0 [0x39ef4460]>{contents = "UNKNOWN_EXCEPTION"}
}

)}, NSLocalizedDescription=An unexpected error occurred. Please include this ErrorId if you contact support: 633409168-7007 (1770975217)}
Hi there

I've been testing the maps example from the release notes today and every other time it get  URL No Longer Exists page.
For a couple of minutes it works fine then for another it gives me the error then it works again.
Is anybody experiencing the same issue?

Where can I learn more about apex:mapMarker and apex:map markers?
The release page redirects to api  version 32 which isn't helpful

thanks
  • January 11, 2015
  • Like
  • 1