• Milan Patel 16
  • -2 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 5

I am trying to send a mobile push notification to my android device based on apex trigger, and I didn't see notification banner but in console I can see onNotification event fired and I can see my payload info. I have followed In react native app react-native-push-notification library, all changes are done as per the document mention here https://www.npmjs.com/package/react-native-push-notification.
updated MobilePushServiceDevice whenever user open the with token and service type
On FCM created the project and follow this document https://firebase.google.com/docs/cloud-messaging/android/client
create connected enable push notification added server key

   Messaging.PushNotification msg = new Messaging.PushNotification();
                Map<String, Object> androidPayload = new Map<String, Object>();
                Set<String> userSet = new Set<String>();
                androidPayload.put('title', idVSnickname.get(cbuId)+' assigned you a task');
                androidPayload.put('message', subject);
                androidPayload.put('parentId', str[4].trim());
                androidPayload.put('id', str[0].trim());
                androidPayload.put('objectName', 'Task');
                androidPayload.put('record', str[5]);
                msg.send('Mimit', userSet);

Hey guys,

I'm currently trying to implement a button or some type of system to make life much easier. Once you press this "so called" button, it will auto fill the other side with the same information. 

If left side "contact name", "Company Name" and "Bill to" has information displayed in it, i want a button or something similar i can click, which will then auto fill the right sides text boxes "Contact Name", "Company Name" and "Ship to" with the same information. Just saves alot of time when doing thousands of these daily.

Please see image attached to understand what i mean much better. :)User-added imageThanks alot!!!!
In Objective C, I follow the steps as outlined here and it works fine: https://developer.salesforce.com/docs/atlas.en-us.noversion.mobile_sdk.meta/mobile_sdk/ios_rest_apis_using_methods.htm?search_text=forceios

But when following the same steps translating the code into Swift, I run into an issue with the SFRestRequest initializer, whose signature is below:
Public convenience init(method: SFRestMethod, path: String, queryParams: [String : String]?)

As you can see, queryParams takes a Swift Dictionary with a key and value of the String type.  But when you follow the example, it seems you end up with a Dictionary with a key of the String type and value of the Dictionary type; and thus we have a type mismatch.

This doesn't seem to be a problem in Objective C, because upon inspection of the method signature in SFRestRequest.m, queryParams appears to be able to take a generic NSDictionary: 
+ (instancetype)requestWithMethod:(SFRestMethod)method path:(NSString *)path queryParams:(NSDictionary *)queryParams

For reference here is the Swift code I'm trying out:
//build the queryParams dictionary from a JSON String
let body: String = "{ \"body\" :{\"messageSegments\" :[{ \"type\" : \"Text\",\"text\" : \"My Comment\"}]}}"
        let queryParams = SFJsonUtils.objectFromJSONString(body) as! [String:AnyObject] 
//construct and send the request
        let request = SFRestRequest(method: SFRestMethod.POST, path: "/services/data/v36.0/connect/communities/my_community_ID/chatter/feed-elements/my_element_ID/capabilities/comments/items", queryParams: queryParams as? [String:String])
        SFRestAPI.sharedInstance().send(request, delegate: self)

But unwrapping queryParams fails and resolves to nil.  Trying to forcefully cast queryParams to [String:String] does not work either, and just causes a crash.

How might I get around this?
Anyone else having trouble connecting to the UpWork group for Salesforce.com? I've tried everything and can't get past the screen to start a dev. org. and submit my application. *sigh*