• Dejan Cvetkoski
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 8
    Replies
I trying to send email with attachment in javascript but i can't, somebody help me.
 sforce.connection.sessionId = '{!$Api.Session_ID}';
        var oppId = document.getElementById('{!$Component.page.form.oppId}');
        var query = "SELECT Account.Email__c FROM Opportunity WHERE Id = '" + oppId.value + "'";
        var record = sforce.connection.query(query);
        record = record.getArray('records');
var singleRequest = new sforce.SingleEmailMessage();
        var fileAttachment = new sforce.EmailFileAttachment();
        singleRequest.subject = 'Test Mail';
        singleRequest.toAddresses = record[0].Account.Email__c;
        singleRequest.optOutPolicy = 'FILTER';
        singleRequest.plainTextBody = j$('#textArea').val();
        
        fileAttachment.Body =  new Blob([bodyAttachment],{ type: 'application/pdf'});
        fileAttachment.ContentType = 'application/pdf';
        fileAttachment.FileName = name + '.pdf';
        fileAttachment.Inline = false;
        console.log(fileAttachment);
        singleRequest.fileAttachments = ([fileAttachment]);
        var sendMailRes = sforce.connection.sendEmail([singleRequest]);

User-added image
I don't know what is the problem. 
Thanks!
Hi people, i need help:

I have map of list and that map it's very big, for every key i have list and i execute query for that list.
Map<String,List<String>> map = new Map<string,List<String>>();
for(String key : map.keySet()){
    List<Sobject>  lsit = [SELECT Id, Name, Code FROM Sobject WHERE Name in map.get(key)] ;
}
How i can optimize this, if have way for execute in one query all that, how i can execute multiple list in query? This is important for me!
Thanks.
 
Anyone help me. I send json object with webhook to  /services/apexrest/myService/test, but i can't reseve them, my class is 
@RestResource(urlMapping='/myService/test/*')
global class myWeb {
	 @HttpGet
    global static void sayHello() {
        RestRequest request = RestContext.request; 
        RestResponse response = RestContext.response;
        String accountId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        System.debug(accountId);
    }
}

But result after execute is System.NullPointerException: Attempt to de-reference a null object. I need send from woocommerce wordpress plugin with webhooks to salesforce. Anyone help me. Thanks :)
Anyone help me. I send json object with webhook to  /services/apexrest/myService/test, but i can't reseve them, my class is 
@RestResource(urlMapping='/myService/test/*')
global class myWeb {
	 @HttpGet
    global static void sayHello() {
        RestRequest request = RestContext.request; 
        RestResponse response = RestContext.response;
        String accountId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        System.debug(accountId);
    }
}

But result after execute is System.NullPointerException: Attempt to de-reference a null object. I need send from woocommerce wordpress plugin with webhooks to salesforce. Anyone help me. Thanks :)
Anyone help me. How i can unzip file in apex class?? Thanks 
Anyone help me. How i can upload file to dropbox with dropbox api?  Thanks
I trying to send email with attachment in javascript but i can't, somebody help me.
 sforce.connection.sessionId = '{!$Api.Session_ID}';
        var oppId = document.getElementById('{!$Component.page.form.oppId}');
        var query = "SELECT Account.Email__c FROM Opportunity WHERE Id = '" + oppId.value + "'";
        var record = sforce.connection.query(query);
        record = record.getArray('records');
var singleRequest = new sforce.SingleEmailMessage();
        var fileAttachment = new sforce.EmailFileAttachment();
        singleRequest.subject = 'Test Mail';
        singleRequest.toAddresses = record[0].Account.Email__c;
        singleRequest.optOutPolicy = 'FILTER';
        singleRequest.plainTextBody = j$('#textArea').val();
        
        fileAttachment.Body =  new Blob([bodyAttachment],{ type: 'application/pdf'});
        fileAttachment.ContentType = 'application/pdf';
        fileAttachment.FileName = name + '.pdf';
        fileAttachment.Inline = false;
        console.log(fileAttachment);
        singleRequest.fileAttachments = ([fileAttachment]);
        var sendMailRes = sforce.connection.sendEmail([singleRequest]);

User-added image
I don't know what is the problem. 
Thanks!
Hi people, i need help:

I have map of list and that map it's very big, for every key i have list and i execute query for that list.
Map<String,List<String>> map = new Map<string,List<String>>();
for(String key : map.keySet()){
    List<Sobject>  lsit = [SELECT Id, Name, Code FROM Sobject WHERE Name in map.get(key)] ;
}
How i can optimize this, if have way for execute in one query all that, how i can execute multiple list in query? This is important for me!
Thanks.
 
Anyone help me. I send json object with webhook to  /services/apexrest/myService/test, but i can't reseve them, my class is 
@RestResource(urlMapping='/myService/test/*')
global class myWeb {
	 @HttpGet
    global static void sayHello() {
        RestRequest request = RestContext.request; 
        RestResponse response = RestContext.response;
        String accountId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        System.debug(accountId);
    }
}

But result after execute is System.NullPointerException: Attempt to de-reference a null object. I need send from woocommerce wordpress plugin with webhooks to salesforce. Anyone help me. Thanks :)
Anyone help me. I send json object with webhook to  /services/apexrest/myService/test, but i can't reseve them, my class is 
@RestResource(urlMapping='/myService/test/*')
global class myWeb {
	 @HttpGet
    global static void sayHello() {
        RestRequest request = RestContext.request; 
        RestResponse response = RestContext.response;
        String accountId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        System.debug(accountId);
    }
}

But result after execute is System.NullPointerException: Attempt to de-reference a null object. I need send from woocommerce wordpress plugin with webhooks to salesforce. Anyone help me. Thanks :)
Hi,

I am encouring some issues and errors whilst uploading a file to dropbox from Salesforce. The integration is nearly compelted and getting, deleting, downloading files is working as it should. Now the uploading part is where I am getting errors.

We need large amount of file storage so Dropbox was our best option. Because we have a complex application we need to create a custom integration and therefor cannot use the standard Dropbox appexchange application.

When a user selects a file to upload it will not get saved on the Salesforce server. Instead we create a Attachment object and do not save it. And use the following code to upload a file to dropbpx:

HttpRequest request = new HttpRequest();
		request.setMethod('POST');
		request.setEndpoint('https://api-content.dropbox.com/1/files_put/auto/test123.zip');
		request.setHeader('Authorization', 'OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="XXXXX", oauth_token="XXXXX, oauth_signature="XXXXX&XXXXXXX"');
		request.setHeader('Content-Length', String.valueOf(file.body.size()));
		request.setHeader('Content-Type', 'application/octet-stream');
		request.setBodyAsBlob(file.body);
		
		System.debug(request);
		
		Http hp = new Http();
		
		HttpResponse response = hp.send(request);
		if(response != null){
			System.debug(response.getBody());	
		}
Uploading works for very small file sized (1MB). Does anyone have any idea what could be the problem?

Help will be much appreciated. 




I want code for to upload file on dropbox using httprequest and httpresponse after authentication and getting access point.

Hi,

 I want to create Webhook for Campaign Monitor. I just gone through http://www.campaignmonitor.com/api/webhooks/....

In that I found, we have to mention an URL in JSON body to create a Webhook. For that what is the URL I have to specify.