• Mickey Stringer 5
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 17
    Replies
I am trying to access either/both LoginEvent and EventLogFile via REST SOQL query. I have a need to obtain login history older than 6 months.

Both return a response that says the SObject is not supported. For LoginEvent, it seems as though it is not recognized at all - it recommends appending '__c' for a custom object. For EventLogFile, it simply says 'not supported.'

I have confirmed other, simple queries - like SELECT Id FROM Contact LIMIT 10 - work correctly.

And since I was led to querying these objects by this help article (https://help.salesforce.com/articleView?id=monitor_login_forensics_considerations.htm&type=5), I also went to Event Monitoring Settings to enable Login Forensics, but it is not an option. I took this to mean that Login Forensics are enabled by default at this point.

Has anyone had success querying these objects? Or have you found a more reliable way of obtaining login history older than 6 months?
All of our Visualforce pages suddenly stopped displaying all fields and values. I see no changes made to the pages, the underlying classes, the objects and fields referenced, nor to guest profile permissions.
On the Salesforce side, the only message I see is that legacy SOAP API versions were retired today, but I don't see how that comes into play here. Furthermore, they say those versions are usable until the Winter '19 release (we are on Summer '18).

Has anyone seen this before?
I've seen many variations of this question, but none seem to provide the answer. I want to pass multiple parameters (different parameters, not different values of the same parameter) to the GET method of a RestResource class. I want to then retrieve each parameter and send them to the appropriate method for processing (each param goes to a different method, then the aggregate result is returned to the client). I'm currently going about this like so:
param1Var = RestContext.request.params.get('param1'); 
param2Var = RestContext.request.params.get('param2'); 
param3Var = RestContext.request.params.get('param3');

The issue I'm having is that only the first parameter is being grabbed.
My URL looks like this - apexrest/apiClass?param1=X&param2=Y&param3=Z
For every parameter after the first one I receive the error, "'param' is not recognized as an internal or external command, operable program or batch file." The variables set to the parameter values also remain null.
How can I accomplish this? I would like to pass all parameters very simply in the URL
I know there are many threads posted aboubt this compile error, but none seem to offer a solution to what I'm experiencing. The method is static, I've checked for typos, I think I'm passing the right argument...

Background: I'm trying to refactor our org's triggers to revolve around a simple trigger framework. As such, I now need to rip out the logic from the triggers and put them into their own classes. Starting small, I'm working on a trigger that updates the name of a custom object.

The framework I'm using is here: http://chrisaldridge.com/triggers/lightweight-apex-trigger-framework/

The trigger handler class is:
public class PersonTriggerHandler implements TriggerHandlerInterface {

    public Boolean IsDisabled() {
        return false;
    }
 
    public void BeforeInsert(List<SObject> newItems) {
    
        PersonNameUpdate.beforeInsert(newItems);
    
    }
 
    public void BeforeUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems) {
    
        PersonNameUpdate.beforeUpdate(newItems, oldItems);
    
    }
 
    public void BeforeDelete(Map<Id, SObject> oldItems) {}
 
    public void AfterInsert(Map<Id, SObject> newItems) {}
 
    public void AfterUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems) {}
 
    public void AfterDelete(Map<Id, SObject> oldItems) {}
 
    public void AfterUndelete(Map<Id, SObject> oldItems) {}

}

And the PersonNameUpdate class:
public class PersonNameUpdate {

    public static void beforeInsert(List<Person__c> insertList) {
        for (Person__c pers : insertList) {
            pers.Name = (pers.First_Name__c +' '+pers.Last_Name__c);
        }
    }
    
    public static void beforeUpdate(Map<Id, Person__c> newMap, Map<Id, Person__c> oldMap) {
        
        for(Person__c pers : [SELECT Id, Name, First_Name__c, Last_Name__c FROM Person__c WHERE Id IN: newMap.keySet()]){
            
            boolean firstNameChanged = (pers.First_Name__c != oldMap.get(pers.Id).First_Name__c);
            boolean lastNameChanged = (pers.Last_Name__c != oldMap.get(pers.Id).Last_Name__c);
            
            if(firstNameChanged || lastNameChanged) {
            pers.Name = (pers.First_Name__c +' '+pers.Last_Name__c);
            }
            
        }
        
    }

}

I receive the error when I add PersonNameUpdate.beforeUpdate(newItems, oldItems); to the handler class. The full error is
"Error: Compile Error: Method does not exist or incorrect signature: void beforeUpdate(Map<Id,SObject>, Map<Id,SObject>) from the type PersonNameUpdate"

This made me wonder if passing a generic SObject argument to a method that accepts a Person__c Map was invalid, but it works fine in the BeforeInsert method... I'm lost.
Hi all,
I developed a trigger for our org that updates a checkbox based on a corresponding checkbox in related contacts. Not being a knowledgeable developer, I took an existing trigger we have working in production, stripped it down and modified it to work on this custom object. I got it working in the sandbox and after deploying to production, am unable to create new records in this object because of a query limit in the trigger.

Having read several forum posts throughout creating this new trigger, I understand the placement and scope of SOQL queries is very important in Apex. As far as placement, I mimicked what was i nthe original trigger and so trusted it wasn't being done in loops and such. As far as scope, as you see below the Person list is unqualified, but there are no Person records yet in production. The Contact list is qualified by the Person__r.Id existing in the Person list. 

I thought perhaps that having no Person records, and thus no Contact records with Person__r.Id returning a value, that might cause the list to return all Contacts, but I disabled the trigger, added a Person record, and then re-enabled it to no avail.

Posting code snippet where the lists occur. Do you all see anything improper? Thanks!
FYI, firstRunBefore is set to TRUE in the helper class
if(PDMPRegistrationTriggerHelperClass.firstRunBefore){
    PDMPRegistrationTriggerHelperClass.firstRunBefore = false;
    List<Id> personIds = new List<Id>();
    for(Person__c p : Trigger.new){
      personIds.add(p.Id);
    }

    // Get Contacts for all People
    // Prevents query within the loop below
    List<Contact> contacts = [SELECT Id, FirstName, LastName, PDMP_Registered__c, Person__r.Id
      FROM Contact WHERE Person__r.Id IN: personIds];

    System.debug('Number of Contacts: ' + Trigger.new.size());

    for(Person__c p : Trigger.new) {
      System.debug('Person: ' + p.Name);
      System.debug('PDMP Registration Status: ' + p.PDMP_Registered__c);


      // Get Contacts for this Person
      List<Contact> con = new List<Contact>();
      for(Contact loopCon : contacts){
        if(loopCon.Person__r.Id == p.Id){
          con.add(loopCon);
          System.debug('Contact: ' + loopCon.FirstName + ' ' + loopCon.LastName);
        }
      }
      if(con.size() == 0){
        System.debug('Contact: None');
      }

 
I am trying to access either/both LoginEvent and EventLogFile via REST SOQL query. I have a need to obtain login history older than 6 months.

Both return a response that says the SObject is not supported. For LoginEvent, it seems as though it is not recognized at all - it recommends appending '__c' for a custom object. For EventLogFile, it simply says 'not supported.'

I have confirmed other, simple queries - like SELECT Id FROM Contact LIMIT 10 - work correctly.

And since I was led to querying these objects by this help article (https://help.salesforce.com/articleView?id=monitor_login_forensics_considerations.htm&type=5), I also went to Event Monitoring Settings to enable Login Forensics, but it is not an option. I took this to mean that Login Forensics are enabled by default at this point.

Has anyone had success querying these objects? Or have you found a more reliable way of obtaining login history older than 6 months?
All of our Visualforce pages suddenly stopped displaying all fields and values. I see no changes made to the pages, the underlying classes, the objects and fields referenced, nor to guest profile permissions.
On the Salesforce side, the only message I see is that legacy SOAP API versions were retired today, but I don't see how that comes into play here. Furthermore, they say those versions are usable until the Winter '19 release (we are on Summer '18).

Has anyone seen this before?
I've seen many variations of this question, but none seem to provide the answer. I want to pass multiple parameters (different parameters, not different values of the same parameter) to the GET method of a RestResource class. I want to then retrieve each parameter and send them to the appropriate method for processing (each param goes to a different method, then the aggregate result is returned to the client). I'm currently going about this like so:
param1Var = RestContext.request.params.get('param1'); 
param2Var = RestContext.request.params.get('param2'); 
param3Var = RestContext.request.params.get('param3');

The issue I'm having is that only the first parameter is being grabbed.
My URL looks like this - apexrest/apiClass?param1=X&param2=Y&param3=Z
For every parameter after the first one I receive the error, "'param' is not recognized as an internal or external command, operable program or batch file." The variables set to the parameter values also remain null.
How can I accomplish this? I would like to pass all parameters very simply in the URL
I know there are many threads posted aboubt this compile error, but none seem to offer a solution to what I'm experiencing. The method is static, I've checked for typos, I think I'm passing the right argument...

Background: I'm trying to refactor our org's triggers to revolve around a simple trigger framework. As such, I now need to rip out the logic from the triggers and put them into their own classes. Starting small, I'm working on a trigger that updates the name of a custom object.

The framework I'm using is here: http://chrisaldridge.com/triggers/lightweight-apex-trigger-framework/

The trigger handler class is:
public class PersonTriggerHandler implements TriggerHandlerInterface {

    public Boolean IsDisabled() {
        return false;
    }
 
    public void BeforeInsert(List<SObject> newItems) {
    
        PersonNameUpdate.beforeInsert(newItems);
    
    }
 
    public void BeforeUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems) {
    
        PersonNameUpdate.beforeUpdate(newItems, oldItems);
    
    }
 
    public void BeforeDelete(Map<Id, SObject> oldItems) {}
 
    public void AfterInsert(Map<Id, SObject> newItems) {}
 
    public void AfterUpdate(Map<Id, SObject> newItems, Map<Id, SObject> oldItems) {}
 
    public void AfterDelete(Map<Id, SObject> oldItems) {}
 
    public void AfterUndelete(Map<Id, SObject> oldItems) {}

}

And the PersonNameUpdate class:
public class PersonNameUpdate {

    public static void beforeInsert(List<Person__c> insertList) {
        for (Person__c pers : insertList) {
            pers.Name = (pers.First_Name__c +' '+pers.Last_Name__c);
        }
    }
    
    public static void beforeUpdate(Map<Id, Person__c> newMap, Map<Id, Person__c> oldMap) {
        
        for(Person__c pers : [SELECT Id, Name, First_Name__c, Last_Name__c FROM Person__c WHERE Id IN: newMap.keySet()]){
            
            boolean firstNameChanged = (pers.First_Name__c != oldMap.get(pers.Id).First_Name__c);
            boolean lastNameChanged = (pers.Last_Name__c != oldMap.get(pers.Id).Last_Name__c);
            
            if(firstNameChanged || lastNameChanged) {
            pers.Name = (pers.First_Name__c +' '+pers.Last_Name__c);
            }
            
        }
        
    }

}

I receive the error when I add PersonNameUpdate.beforeUpdate(newItems, oldItems); to the handler class. The full error is
"Error: Compile Error: Method does not exist or incorrect signature: void beforeUpdate(Map<Id,SObject>, Map<Id,SObject>) from the type PersonNameUpdate"

This made me wonder if passing a generic SObject argument to a method that accepts a Person__c Map was invalid, but it works fine in the BeforeInsert method... I'm lost.
Hi all,
I developed a trigger for our org that updates a checkbox based on a corresponding checkbox in related contacts. Not being a knowledgeable developer, I took an existing trigger we have working in production, stripped it down and modified it to work on this custom object. I got it working in the sandbox and after deploying to production, am unable to create new records in this object because of a query limit in the trigger.

Having read several forum posts throughout creating this new trigger, I understand the placement and scope of SOQL queries is very important in Apex. As far as placement, I mimicked what was i nthe original trigger and so trusted it wasn't being done in loops and such. As far as scope, as you see below the Person list is unqualified, but there are no Person records yet in production. The Contact list is qualified by the Person__r.Id existing in the Person list. 

I thought perhaps that having no Person records, and thus no Contact records with Person__r.Id returning a value, that might cause the list to return all Contacts, but I disabled the trigger, added a Person record, and then re-enabled it to no avail.

Posting code snippet where the lists occur. Do you all see anything improper? Thanks!
FYI, firstRunBefore is set to TRUE in the helper class
if(PDMPRegistrationTriggerHelperClass.firstRunBefore){
    PDMPRegistrationTriggerHelperClass.firstRunBefore = false;
    List<Id> personIds = new List<Id>();
    for(Person__c p : Trigger.new){
      personIds.add(p.Id);
    }

    // Get Contacts for all People
    // Prevents query within the loop below
    List<Contact> contacts = [SELECT Id, FirstName, LastName, PDMP_Registered__c, Person__r.Id
      FROM Contact WHERE Person__r.Id IN: personIds];

    System.debug('Number of Contacts: ' + Trigger.new.size());

    for(Person__c p : Trigger.new) {
      System.debug('Person: ' + p.Name);
      System.debug('PDMP Registration Status: ' + p.PDMP_Registered__c);


      // Get Contacts for this Person
      List<Contact> con = new List<Contact>();
      for(Contact loopCon : contacts){
        if(loopCon.Person__r.Id == p.Id){
          con.add(loopCon);
          System.debug('Contact: ' + loopCon.FirstName + ' ' + loopCon.LastName);
        }
      }
      if(con.size() == 0){
        System.debug('Contact: None');
      }