• Baylor Peak
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 16
    Replies
Hello all,

I have a user who is consistently making API calls to Salesforce, but I am unable to figure out what records he is creating. Under his Contact, he has 0 records, yet he is making several API calls to Salesforce on a daily basis.

Is there a way to query on whether or not a record was generated from an API call from an external system?

Regards,
Baylor Peak

Hello all,

I am still pretty new to Salesforce admin and APIs in general but I have an admin we need to deactivate and stop all his access, transfer any record ownership, workflows, locate any APEX code he created.
 
I checked and I can't find any records under their username and can't find any records or APEX they created or have any ownership of those records, but they are accessing the API on a consistent basis.

So, first, how can I see what they are doing via the API, where are those records or what code is creating them, etc? How can I see excactly what they are doing each time they access the API? I checked the login history and see it's all SOAP Enterprise but I can't find where the source login is, what they are creating in Salesforce, etc?

Seconnly, If I deactivate them and revoke their access to all listed oAuth apps, will that stop their ability to access the API, and prevent them from accessing our org in any way etc?

Hello all,

I am able to query all the active users in a specific profile:

select user.id, user.FirstName, user.LastName, user.profile.name, user.Username, user.IsActive FROM user, user.profile where profile.name = 'xxxxx' AND IsActive=True


That just returns the active users for the profile, but I am trying to query only the active system admins in a specific profie.

What am I doing wrong please?:)

 

Hello all,

I finally got my Trigger to do what I want, almost...

I ran into a snag that I can't figure out why it's occuring.

I've notcied that my Total Touchpoint fields are not reflecting correctly when there are no Activities under Activity History. So let's say Total Contacs is showing 10, I can add and delete Tasks and it updates correctly until I delete the last Task. Once I delete the last Task under Activity History, it leaves 1 for the Total Contacts field.

Beating my head around this....

Here is my whole code and I would love some input on whay it's not working like it should be unless I am missing something?:D

trigger TaskRollupSummaryTrigger on Task (after insert, after update, after delete) {
    Set<ID> contactIdSet = new Set<ID>();
    if(Trigger.isInsert || Trigger.isupdate){
        for (Task t : trigger.new) {
            if (t.whoId != NULL) {
                contactIdSet.add(t.whoId);
            }
        }
    }

    if(Trigger.isDelete){
        For(Task t : trigger.old){
            contactIdSet.add(t.whoId);
        }
    }
    
    if (contactIdSet.size() > 0) {
        AggregateResult[] groupedResults = [SELECT WhoId, Type, Count(ID) FROM Task WHERE WhoId IN :contactIdSet AND Type IN ('Call','Email','In-Person Meeting') GROUP BY WhoId, Type];
        
        Map<ID, Contact> contactMap = new Map<ID, Contact>([SELECT Id, Total_Call_Touchpoints__c FROM Contact WHERE Id IN :contactIdSet]);
    
        for (AggregateResult g : groupedResults) {    
            System.debug('####' + g.get('WhoId') + ' : ' + g.get('expr0'));
            Contact c = contactMap.get((String)g.get('WhoId'));
            
            if ((String)g.get('Type') == 'Call') {
                c.Total_Call_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'Email') {
                c.Total_Email_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'In-Person Meeting') {
                c.Total_Meeting_Touchpoints__c = (Decimal)g.get('expr0');
            }
        }
        update contactMap.values();
    }
}

Regards for all your help:)
Helo all,

I have a Trigger that does a rollup of different Touchpoints on a Task. One of these Touchpoints is "Email".

What's happening is on an Insert/Update/Delete, the filed is recalculated with teh total numbert of Email Activities, except for those that came from an Outbound source via Email to Salesforce.

User-added image
So these Outbound emails are generated an an Activity and I want to be able to include the count of these Outbound Email Messages in my Total Email Touchpoints rollup.

Is this possible, becasue I am havinmg trouble trying to figure out what Object associated with External emails sent to Saleforce so I can just quertry on that object to get my number?

Regards,
Baylor

Hello all,

I am still getting my feet wet with Apex but have come a good way, but still would be very gracilous for this awesome community's input please:)

I have a Trigger on Task after activities are either inserted or updated that performs a rollup for touchpoints on open activities.

The issue is if a user deletes an activity, the rollup is unaffected resulting in an erroneus count for the touchpoints.

This is my code:

trigger TaskRollupSummaryTrigger on Task (after insert, after update) {
    Set<ID> contactIdSet = new Set<ID>();

    for (Task t : trigger.new) {
        if (t.whoId != NULL) {
            contactIdSet.add(t.whoId);
        }
    }
    
    if (contactIdSet.size() > 0) {
        AggregateResult[] groupedResults = [SELECT WhoId, Type, Count(ID) FROM Task WHERE WhoId IN :contactIdSet AND Type IN ('Call','Email','In-Person Meeting') GROUP BY WhoId, Type];
        
        Map<ID, Contact> contactMap = new Map<ID, Contact>([SELECT Id, Total_Call_Touchpoints__c FROM Contact WHERE Id IN :contactIdSet]);
    
        for (AggregateResult g : groupedResults) {    
            System.debug('####' + g.get('WhoId') + ' : ' + g.get('expr0'));
            Contact c = contactMap.get((String)g.get('WhoId'));
            
            if ((String)g.get('Type') == 'Call') {
                c.Total_Call_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'Email') {
                c.Total_Email_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'In-Person Meeting') {
                c.Total_Meeting_Touchpoints__c = (Decimal)g.get('expr0');
            }
        }
        update contactMap.values();
    }
}

First question is why isn't the SELECT counting acxtivities that have been deleted?

Is there a way to get the trigger to see when activities are deleted and refelct that in the ttouchpoint rollups?

Hello all,

I have a user who is consistently making API calls to Salesforce, but I am unable to figure out what records he is creating. Under his Contact, he has 0 records, yet he is making several API calls to Salesforce on a daily basis.

Is there a way to query on whether or not a record was generated from an API call from an external system?

Regards,
Baylor Peak

Hello all,

I am able to query all the active users in a specific profile:

select user.id, user.FirstName, user.LastName, user.profile.name, user.Username, user.IsActive FROM user, user.profile where profile.name = 'xxxxx' AND IsActive=True


That just returns the active users for the profile, but I am trying to query only the active system admins in a specific profie.

What am I doing wrong please?:)

 

Hello all,

I finally got my Trigger to do what I want, almost...

I ran into a snag that I can't figure out why it's occuring.

I've notcied that my Total Touchpoint fields are not reflecting correctly when there are no Activities under Activity History. So let's say Total Contacs is showing 10, I can add and delete Tasks and it updates correctly until I delete the last Task. Once I delete the last Task under Activity History, it leaves 1 for the Total Contacts field.

Beating my head around this....

Here is my whole code and I would love some input on whay it's not working like it should be unless I am missing something?:D

trigger TaskRollupSummaryTrigger on Task (after insert, after update, after delete) {
    Set<ID> contactIdSet = new Set<ID>();
    if(Trigger.isInsert || Trigger.isupdate){
        for (Task t : trigger.new) {
            if (t.whoId != NULL) {
                contactIdSet.add(t.whoId);
            }
        }
    }

    if(Trigger.isDelete){
        For(Task t : trigger.old){
            contactIdSet.add(t.whoId);
        }
    }
    
    if (contactIdSet.size() > 0) {
        AggregateResult[] groupedResults = [SELECT WhoId, Type, Count(ID) FROM Task WHERE WhoId IN :contactIdSet AND Type IN ('Call','Email','In-Person Meeting') GROUP BY WhoId, Type];
        
        Map<ID, Contact> contactMap = new Map<ID, Contact>([SELECT Id, Total_Call_Touchpoints__c FROM Contact WHERE Id IN :contactIdSet]);
    
        for (AggregateResult g : groupedResults) {    
            System.debug('####' + g.get('WhoId') + ' : ' + g.get('expr0'));
            Contact c = contactMap.get((String)g.get('WhoId'));
            
            if ((String)g.get('Type') == 'Call') {
                c.Total_Call_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'Email') {
                c.Total_Email_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'In-Person Meeting') {
                c.Total_Meeting_Touchpoints__c = (Decimal)g.get('expr0');
            }
        }
        update contactMap.values();
    }
}

Regards for all your help:)
Helo all,

I have a Trigger that does a rollup of different Touchpoints on a Task. One of these Touchpoints is "Email".

What's happening is on an Insert/Update/Delete, the filed is recalculated with teh total numbert of Email Activities, except for those that came from an Outbound source via Email to Salesforce.

User-added image
So these Outbound emails are generated an an Activity and I want to be able to include the count of these Outbound Email Messages in my Total Email Touchpoints rollup.

Is this possible, becasue I am havinmg trouble trying to figure out what Object associated with External emails sent to Saleforce so I can just quertry on that object to get my number?

Regards,
Baylor

Hello all,

I am still getting my feet wet with Apex but have come a good way, but still would be very gracilous for this awesome community's input please:)

I have a Trigger on Task after activities are either inserted or updated that performs a rollup for touchpoints on open activities.

The issue is if a user deletes an activity, the rollup is unaffected resulting in an erroneus count for the touchpoints.

This is my code:

trigger TaskRollupSummaryTrigger on Task (after insert, after update) {
    Set<ID> contactIdSet = new Set<ID>();

    for (Task t : trigger.new) {
        if (t.whoId != NULL) {
            contactIdSet.add(t.whoId);
        }
    }
    
    if (contactIdSet.size() > 0) {
        AggregateResult[] groupedResults = [SELECT WhoId, Type, Count(ID) FROM Task WHERE WhoId IN :contactIdSet AND Type IN ('Call','Email','In-Person Meeting') GROUP BY WhoId, Type];
        
        Map<ID, Contact> contactMap = new Map<ID, Contact>([SELECT Id, Total_Call_Touchpoints__c FROM Contact WHERE Id IN :contactIdSet]);
    
        for (AggregateResult g : groupedResults) {    
            System.debug('####' + g.get('WhoId') + ' : ' + g.get('expr0'));
            Contact c = contactMap.get((String)g.get('WhoId'));
            
            if ((String)g.get('Type') == 'Call') {
                c.Total_Call_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'Email') {
                c.Total_Email_Touchpoints__c = (Decimal)g.get('expr0');
            } else if ((String)g.get('Type') == 'In-Person Meeting') {
                c.Total_Meeting_Touchpoints__c = (Decimal)g.get('expr0');
            }
        }
        update contactMap.values();
    }
}

First question is why isn't the SELECT counting acxtivities that have been deleted?

Is there a way to get the trigger to see when activities are deleted and refelct that in the ttouchpoint rollups?