• chandrasekhar reddy
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 9
    Replies
   
curl --data "api_user=user&api_key=pwd&to=mymail@gmail.com&toname=Ram&subject=Testtt&from=othermail@gmail.com&text=testingtextbody&--form files[attachment.pdf]=@http://www.tutorialspoint.com/java/pdf/java_strings.pdf;type=application/pdf" https://someendpoint.com/api/mail.send.xml


I have above the cURL command. I want to convert above call to HTTP multipart POST because above request has a pdf attachment. I am doing as below. Is my multipart POST request construction correct?

   
String boundary = 'delimiter';
      String header = '--'+boundary+'\n';  //boundary is random string
      String footer = '\n\n--'+boundary+'--'; // blank line separates body/footer
      String test='jjjjj';
      String bodyText = 'Content-Disposition: form-data; name="files[myfile.pdf]";\n'
                    + 'filename="http://www.tutorialspoint.com/java/pdf/java_strings.pdf"\n'
                    + 'Content-Type: application/pdf\n\n' // Blank line separates header/body
                    + test;
    
    
    bodyText += '--'+boundary+'\r\nContent-Disposition: form-data; name ="api_user"\r\n\r\n superuser123';
    bodyText += '--'+boundary+'\r\nContent-Disposition: form-data; name ="api_key"\r\n\r\n superpwd12345';
    bodyText += '--'+boundary+'\r\nContent-Disposition: form-data; name ="to"\r\n\r\n myemail@gmail.com';
    bodyText += '--'+boundary+'\r\nContent-Disposition: form-data; name ="from"\r\n\r\n someother@gmail.com';
    bodyText += '--'+boundary+'\r\nContent-Disposition: form-data; name ="text"\r\n\r\n hellooooooooooooooooooooooooo';
    
    
      String body = header + bodyText + footer;
      HttpRequest req = new HttpRequest();
    
      req.setHeader('Content-Type','multipart/form-data; boundary='+boundary);
      req.setHeader('Content-Length',String.valueof(body.length()));
      req.setMethod('POST');
      req.setEndpoint('https://someendpoint.com/api/mail.send.xml');
      req.setBody(body);
      req.setTimeout(60000);
      Http http = new Http();
      HTTPResponse res = http.send(req);
      System.debug('response:'+req.getBody());


Thanks!




 
In an inbound webservice if want to provide a structure like
<foo bar="baz">bar</foo>
----------------

webservice string foo;

will create a tag like <foo></foo>
how will i introduce an attribute for this tag -bar = "baz"  ?
Is it possible in Apex web service?
Hi,
I created a Lead then converted. After conversion, It created an Account, Contact and Opportunity. Now If I delete the converted Lead then will there be any impact on already created Account, Contact and Opportunity ?



Thanks!
Hi,
I have below debug logs.
00:52:52.736|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 68 out of 100 ******* CLOSE TO LIMIT
  Number of query rows: 39 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 12 out of 150
  Number of DML rows: 12 out of 10000
  Maximum CPU time: 706 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|LIMIT_USAGE_FOR_NS|ASF|
  Number of SOQL queries: 9 out of 100
  Number of query rows: 5 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|LIMIT_USAGE_FOR_NS|CRMfusionDBR101|
  Number of SOQL queries: 4 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|CUMULATIVE_LIMIT_USAGE_END
In above logs, what are LIMIT_USAGE_FOR_NS|(default) , LIMIT_USAGE_FOR_NS|ASF and LIMIT_USAGE_FOR_NS|CRMfusionDBR101  ?
Could you please explain me what those _NS terms are?
Hi,
I recently received an email from Salesforce as in below Knowledge Article (https://help.salesforce.com/apex/HTViewSolution?urlname=Salesforce-disabling-SSL-3-0-encryption&language=en_US&elq_mid=7926&elq_cid=19980259). I have a Soap web service written in SFDC and this service is called in Java web service using Enterprise wsdl and web service wsdl. As said in article, where should I enable TLS 1.0 in my API ? Do i need to enable in my Java web service or SFDC web service?
I have below Enum class.
 
public enum SfOperationStatus {
    SUCCESS("The SalesForce.com operation was successful."),
    Unsuccessful("The SalesForce.com operation was unsuccessful."),
    Error("An error occurred while executing the SalesForce.com operation."),
    ;
     private String msg;

    private SfOperationStatus(String message) {
        this.msg = message;
    }

    public String getMessage() {
        return this.msg;
    }
}
Above code gives below error.

Error: Compile Error: expecting right curly bracket, found '(' at line 2 column 11

Any help Please?
 
I have below code.

global class ConvertLeadWebService
    {
        webService static  Database.LeadConvertResult convertLead(Lead myLead) 
        {
            Database.LeadConvert lc = new database.LeadConvert();
            lc.setLeadId(myLead.id);
            LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
            lc.setConvertedStatus(convertStatus.MasterLabel);
            Database.LeadConvertResult lcr = Database.convertLead(lc);         
            return lcr;
        }
    }
But above code is not saved and I am getting below error.

Error: Compile Error: Invalid return type: Database.LeadConvertResult at line 3 column 55


Any help?
Hi,
My Lead table has 1300000 records (<2 million). I am using beloq SOQL query.

select id, company, phone, statecode from Lead where statecode='AB'
Here statecode is custom field and has been indexed.

Above query returns 200000 records. Which is exceeding selective threshold limit. Because for 1300000 records, selective threshold limit is 115000 (10% in first million records+ 5% in rest of the records). But my query returns 200000 records. when the query retutns more than selective threshold, indexes will not be considered and query takes long time to return the result. How can i avoid this issue?

If i use LIMIT as below, still the indexes on statecode will be ignored?

select id, company, phone, statecode from Lead where statecode='AB' LIMIT 100000
Please suggest me. Thanks!


Savepoint sp = Database.setSavepoint();
    try {
        insert callReport;
        upsertParticipants(callReport.Id);
        upsertProducts(callReport.Id);
        upsertTasks(callReport.Id);
    }
    catch(Exception ex) {
        ApexPages.addMessages(ex);
        Database.rollback(sp);
        callReport = callReport.clone(false);
        return null;       
    }

I have above code. sp is reference variable to SavePoint. My question is, what exactly sp is going to hold the value ?
Hi,
I have below debug logs.
00:52:52.736|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 68 out of 100 ******* CLOSE TO LIMIT
  Number of query rows: 39 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 12 out of 150
  Number of DML rows: 12 out of 10000
  Maximum CPU time: 706 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|LIMIT_USAGE_FOR_NS|ASF|
  Number of SOQL queries: 9 out of 100
  Number of query rows: 5 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|LIMIT_USAGE_FOR_NS|CRMfusionDBR101|
  Number of SOQL queries: 4 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|CUMULATIVE_LIMIT_USAGE_END
In above logs, what are LIMIT_USAGE_FOR_NS|(default) , LIMIT_USAGE_FOR_NS|ASF and LIMIT_USAGE_FOR_NS|CRMfusionDBR101  ?
Could you please explain me what those _NS terms are?
Hi,
I created a Lead then converted. After conversion, It created an Account, Contact and Opportunity. Now If I delete the converted Lead then will there be any impact on already created Account, Contact and Opportunity ?



Thanks!
Hi,
I have below debug logs.
00:52:52.736|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 68 out of 100 ******* CLOSE TO LIMIT
  Number of query rows: 39 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 12 out of 150
  Number of DML rows: 12 out of 10000
  Maximum CPU time: 706 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|LIMIT_USAGE_FOR_NS|ASF|
  Number of SOQL queries: 9 out of 100
  Number of query rows: 5 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|LIMIT_USAGE_FOR_NS|CRMfusionDBR101|
  Number of SOQL queries: 4 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:52:52.736|CUMULATIVE_LIMIT_USAGE_END
In above logs, what are LIMIT_USAGE_FOR_NS|(default) , LIMIT_USAGE_FOR_NS|ASF and LIMIT_USAGE_FOR_NS|CRMfusionDBR101  ?
Could you please explain me what those _NS terms are?
Hi,
I recently received an email from Salesforce as in below Knowledge Article (https://help.salesforce.com/apex/HTViewSolution?urlname=Salesforce-disabling-SSL-3-0-encryption&language=en_US&elq_mid=7926&elq_cid=19980259). I have a Soap web service written in SFDC and this service is called in Java web service using Enterprise wsdl and web service wsdl. As said in article, where should I enable TLS 1.0 in my API ? Do i need to enable in my Java web service or SFDC web service?
Hi,
My Lead table has 1300000 records (<2 million). I am using beloq SOQL query.

select id, company, phone, statecode from Lead where statecode='AB'
Here statecode is custom field and has been indexed.

Above query returns 200000 records. Which is exceeding selective threshold limit. Because for 1300000 records, selective threshold limit is 115000 (10% in first million records+ 5% in rest of the records). But my query returns 200000 records. when the query retutns more than selective threshold, indexes will not be considered and query takes long time to return the result. How can i avoid this issue?

If i use LIMIT as below, still the indexes on statecode will be ignored?

select id, company, phone, statecode from Lead where statecode='AB' LIMIT 100000
Please suggest me. Thanks!


Savepoint sp = Database.setSavepoint();
    try {
        insert callReport;
        upsertParticipants(callReport.Id);
        upsertProducts(callReport.Id);
        upsertTasks(callReport.Id);
    }
    catch(Exception ex) {
        ApexPages.addMessages(ex);
        Database.rollback(sp);
        callReport = callReport.clone(false);
        return null;       
    }

I have above code. sp is reference variable to SavePoint. My question is, what exactly sp is going to hold the value ?