• Frederik Witte 19
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 10
    Replies
I am trying to get the Session ID for my salesforce partialbox. 

My Code:

    curl https://test.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=definitely the correct client id" -d "client_secret=definitely the correct client secret" -d "username=mymail@mail.com.partialbox" -d "password=passandsecuritytoken"

What else I did:

- Grant full access in my connected app settings
- Set Ip restrictions to loose ip restrictions
- "All users can authorize themselfes"
- Double checked pass, client id, client secret, username

I am still getting the error `{"error":"invalid_grant","error_description":"authentication failure"}`.

I searched through the SF forums and StackOverflow questions, but I couldn't find any solution for this. Does anyone know, what else could be the problem here? 
Hey guys,

I have been reading through many posts about scheduled apex test class, but they all just show the basic Test Class which is written in the docs. My problem ist that I only have 20% code coverage(5/24). This is my current test:

@istest
class TestLeadToBoerse {

   static testmethod void test() {
   Test.startTest();

      Lead l = new Lead();
      l.FirstName = 'Test';
      l.LastName = 'Tester';
      l.Phone = '05112323';
      l.City = ' Hannover';
      l.Street = 'Karl Str. 23';
      l.Email = 'karlotto@webmail.com';
      l.Company = 'Test';
      insert l;

      // Schedule the test job

      String jobId = System.schedule('testBasicScheduledApex',
      '0 0 0 3 9 ? 2022', 
         new leadToBoerseAfter24H());

      // Get the information from the CronTrigger API object
      CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, 
         NextFireTime
         FROM CronTrigger WHERE id = :jobId];

      // Verify the expressions are the same
      System.assertEquals('0 0 0 3 9 ? 2022', 
         ct.CronExpression);

      // Verify the job has not run
      System.assertEquals(0, ct.TimesTriggered);

      // Verify the next time the job will run
      System.assertEquals('2022-09-03 00:00:00', 
         String.valueOf(ct.NextFireTime));
      System.assertNotEquals('testScheduledApexFromTestMethodUpdated',
         [SELECT id, FirstName FROM Lead WHERE id = :l.id].FirstName);

   Test.stopTest();
   }
}

And this is my current Code: 

global class leadToBoerseAfter24H implements Schedulable{
 
 // Execute method
    global void execute(SchedulableContext SC) {
        // Code to be executed when the schedule class wakes up
        for(List<Lead> leads:[SELECT FirstName, LastName, Phone, MobilePhone, PostalCode, City, Street, Email, CreatedDate FROM Lead WHERE CreatedDate < YESTERDAY AND CreatedDate > 2015-04-06T01:02:03Z AND Email != null AND Status = 'Offen' AND (Lead_Status__c = null OR Lead_Status__c = 'Telefonisch nicht erreicht') AND (LeadSource = 'FWS Lead' OR LeadSource = 'AdressButler' OR LeadSource = 'WH Landingpage')]){
             List<lb_Leads__c> nL = new List<lb_Leads__c>();
            for(Lead l : leads){
               lb_Leads__c newL = new lb_Leads__c();
               newL.Vorname__c = l.FirstName;
               newL.Nachname__c = l.LastName;
               newL.Telefon__c = l.Phone;
               newL.Erstellt_datum__c = date.today();
               newL.Auktionsstart__c = date.today();
               newL.Anfangspreis__c = 120;
               newL.Status__c = 'active';
               newL.Stadt__c = l.City;
               if(l.PostalCode != null)
                   newL.PLZ__c = l.PostalCode;
               else
                   newL.PLZ__c = 'Keine Angabe';
               newL.Stra_e__c = l.Street;
               newL.Email__c = l.Email;
               newL.Mobiltelefon__c = l.MobilePhone;
               newL.Beschreibung__c = 'Pflegeimmobilie als Kapitalanlage';
               nL.add(newL);
            }
            if(!nL.isEmpty()){
                insert nL;
                delete leads;
            }
        }
   }
 }

I would be so, so grateful for any help I can get. 

Best regards!
Hey guys,

I wrote the following class:

global class ChangeImmo implements Schedulable{
    // Execute method global void execute(SchedulableContext SC) {
        List<Realty_User__c> rs = [SELECT Buttons__c FROM Realty_User__c WHERE not (Buttons__c INCLUDES ('Terminplaner'))];
        for(Realty_User__c r : rs){
            r.Buttons__c += ';Terminplaner';
            update r;
        }
     }
}

Then I sheduled it for a one time run.

It worked on our testbox, but not in the live version. We have 1700 users, of which around 730 don't have the "Terminplaner". Does someone know, why this is not working?

Thank you in advance :)!
Hey guys, 

with this tutorial: https://developer.salesforce.com/page/Getting_Started_with_the_Force.com_REST_API I have successfully put up a REST Webservice.
What I need to do now:
A user fills out a form, when the form is submitted, some custom data + the content of the form is being send with the url. Like 'myurl.com/oauth?acc_id=123123&content_of_form="thecontent" '. But I just can't find out on how to do this. I think I need the php curl for this, because the link in the browser cant contain the user information, so I need the POST method for this and need to do it behind the scenes. So I have no clue where to get started and then after that, how can I use this information in my java/apex class? That I can pass the parameters into some function? 

I searched for dozens of keywords on google and I can't find any tutorial for this. 

So two questions on this:

1. How can I call my Application in SalesForce with all the needed information(clientID, Secret, etc), with php or if there is a way to pass in data via java, then via java 
2. How can I then use this information from my url? 

Thank you really, really much in advance, any help is greatly appreciated, as I am miserably struggling with this.

Best regards

Frederik

Hey guys, 

I have to work on the following project: 

An external button calls a REST Webservice and sends an ID. This ID is the trail to the user which called the button. Now I need to generate a .pdf with the user information. This .pdf then needs to be send to three different e-mail addresses, of which one has a different body. All of this needs to be done programmatically, so that the user only presses a button, and the rest is done automatically.

 

I found a huge documentation about REST Webservice, so I don't need a start here. But I can't find a documentation on how to generate a .pdf all by code and send this via email. All I could find is .pdf in combination with a visualforce page. Does someone have a nice tutorial on generating a .pdf by code only and sending it via mail? 

Thanks in advance!

Hey guys,

I wrote the following class:

global class ChangeImmo implements Schedulable{
    // Execute method global void execute(SchedulableContext SC) {
        List<Realty_User__c> rs = [SELECT Buttons__c FROM Realty_User__c WHERE not (Buttons__c INCLUDES ('Terminplaner'))];
        for(Realty_User__c r : rs){
            r.Buttons__c += ';Terminplaner';
            update r;
        }
     }
}

Then I sheduled it for a one time run.

It worked on our testbox, but not in the live version. We have 1700 users, of which around 730 don't have the "Terminplaner". Does someone know, why this is not working?

Thank you in advance :)!

Hey guys, 

I have to work on the following project: 

An external button calls a REST Webservice and sends an ID. This ID is the trail to the user which called the button. Now I need to generate a .pdf with the user information. This .pdf then needs to be send to three different e-mail addresses, of which one has a different body. All of this needs to be done programmatically, so that the user only presses a button, and the rest is done automatically.

 

I found a huge documentation about REST Webservice, so I don't need a start here. But I can't find a documentation on how to generate a .pdf all by code and send this via email. All I could find is .pdf in combination with a visualforce page. Does someone have a nice tutorial on generating a .pdf by code only and sending it via mail? 

Thanks in advance!