• KCrock88
  • NEWBIE
  • 35 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
Hello! Hoping someone can help - we recently migrated from Case Comments to Case Feed Layouts within our community. 
  • When the "Case Status" field is in "Awaiting Customer Feedback" - we previously had workflow rules to kick the Case Status back to "Working" when a customer posted a comment
  • With Case Feed Layout - we were able to use Flow and Process Builder to replicate this action for a New Case Feed Item
  • With Case Feed Layout - we are struggling to replicate this functionality for a new Case Post Comment (customer posts a Feed Item Comment rather than a new feed Item)
What would be the best way to accomplish this? Not an Apex Developer by trade, but hoping this can be done with a relatively simple trigger - any feedback would be appreciated!
User-added image

 
. We have REGEX formulas that run to scan incoming support tickets for “sensitive data”, i.e. Credit Card #s, SSNs, CVV numbers. We have a workflow that will look at the subject/description of incoming support tickets and check a box if any sensitive information is identified, so our security team can look at it. However, the regex formula we currently have in place is WAY to hypersensitive, it literally flags almost every incoming support ticket as being sensitive.

What we would like to do, is have the regex formula scan the field, and then auto “mask” the sensitive data, i.e.
Ticket comes in, with the CC# - 4444 4444 4444 4444
New value – 4444 44** **** 4444

This is crucial to our PCI compliance, as we can’t have this data floating around in Salesforce and in emails. Every time we get one of these, we have to go around to everyone who got the email notifications and watch them permanently delete them from their computer.

Can you look at the formulas below, and:
1.)    Fix them so they are not so hypersensitive?
2.)    Let us know how we can auto-mask them as they come in.

CVV (ignore dashes and spaces)
REGEX(Description_Copy__c, ".*\\D(?:\\d[ -]*?){3}\\D.*"),

SSN# (ignore dashes and spaces)
REGEX(Description_Copy__c, ".*\\D(?:\\d[ -]*?){9}\\D.*"),

Credit Card# (ignore dashes and spaces)
REGEX(Description_Copy__c, ".*(?:\\d[ -]*?){13,19}.*"),

Any help would be appreciated!!!!

I have a trigger that creates a record in a custom object (Service) when an Opportunity is Closed Won and

-Sets the Record Type based on information in the Opportunity

-Pulls members from the Opportunity Team into User Lookup fields in the new record

-Brings in some values from the Opportunity and sets some default values

trigger ServiceCreation on Opportunity (after update) {

     map<id,Opportunity> oldValueMap = Trigger.oldMap;
    
    FOR(OPPORTUNITY OPP:TRIGGER.NEW){
    
        Opportunity oldOpp = oldValueMap.get(OPP.id);
        //Check if Opportunity is Won, is a Centinel Integration, and is not marked as a Plan Upgrade
        if (OPP.isWon && !oldOpp.isWon && Opp.Platform__c <>'Cardinal 2ID' && Opp.Type<>'Plan Upgrade'){
   				
             Services__c SVC = new Services__c();
            //Queries Opportunity Team Member Table, returns list of User IDs and Team Member Roles
            for(OpportunityTeamMember teamMember:[select UserID,TeamMemberRole from OpportunityTeamMember where OpportunityId=:OPP.ID]){
               //Sets Service Owner and Client Manager in Service based on Opportunity Team Members
                if (teamMember.TeamMemberRole=='Activation Manager'){
                    SVC.OwnerId = teammember.userId;
                } else if (teamMember.TeamMemberRole=='Client Manager'){
                    SVC.Client_Manager__c = teammember.userId;
                }  
                
            }
            //Queries Service Record Types and Developer Names 
            Map<string,id> serviceRTMap = new Map<string,id>();
                for (RecordType RT:[select id,developerName from RecordType where SobjectType='Services__c']){
                 	   serviceRTMap.put(rt.developerName,rt.id);
                }
            //Set record type of Service based on Opportunity Information
            if (opp.Product__c=='Consumer Authentication'){
                Svc.RecordTypeId = serviceRTMap.get('Authentication');
            } else if (opp.Product__c == 'Payment Brands' && opp.Payment_Brands__c.contains('PayPal')){
                Svc.RecordTypeId = serviceRTMap.get('PayPal');
            } else {
                Svc.RecordTypeId = serviceRTMap.get('Payment_Brand');
            }
            //Prefill subset of Service fields, upon creation, with data from the Opportunity
            Svc.Name = Opp.Name; 
            Svc.Register_Date__c = Opp.CloseDate;
            Svc.Stage__c = '1-Boarding';
            Svc.Status__c = 'Registered';
            Svc.Related_Opportunity__c = Opp.ID;
            svc.account__c = Opp.AccountID;
            svc.Sales_Rep__c = Opp.OwnerID;
            svc.Platform__c = Opp.Platform__c;
            svc.Product__c = Opp.Product__c;
            svc.Payment_Brand__c = Opp.Payment_Brands__c;
            svc.Partner__c = Opp.Partner__c;
            svc.Monthly_Transactions__c = Opp.Monthly_Transactions__c;
            svc.Monthly_Revenue__c = Opp.Monthly_Revenue__c;
            svc.Set_Up_Fee__c = Opp.Set_up_Fee__c;
            svc.Annualized_Revenue__c = Opp.Amount;
            svc.RBA__c = opp.Rules__c;
            svc.Adapter__c = Opp.Adapter__c;
            svc.Projected_Activation_Date__c = Opp.Projected_Activation_Date__c;
            Insert SVC;
        }
}
}

 

I am having trouble writing the test method...can anybody help?  How do I write a method that checks to see if the Service record was created, and that the fields are being brought over correctly?

Hello - hope someone can help out. I have a custom object, "Services", that tracks customer onboarding post sale. 

So when the Opportunity is marked closed won, a trigger will automatically insert a "Services" record for that account - pulling in information from the related Opportunity and Account (Both account and related opportunity fields are custom lookup fields on the Service object, NOT master detail).

 

What I am trying to do is pull two members from the Account Team of that Account into the Service:

1.) The user marked as the "Integration Manager" on the Account Team will be the Service Owner

2.) The user marked as the "Client Manager" on the Account Team will be pulled into a custom user lookupfield "Client Manager" on the service record

 

Below is my trigger, attempting to pull from AccountTeamMember

         for(AccountTeamMember teamMember:[select id,TeamMemberRole from AccountTeamMember where accountId=:OPP.AccountID]){
               
                if (teamMember.TeamMemberRole=='Integration Manager'){
                    SVC.OwnerId = teammember.id;
                } else if (teamMember.TeamMemberRole=='Client Manager'){
                    SVC.Client_Manager__c = teammember.id;
                }  
                
            }

 

However, I am getting the following error upon save: Error:Apex trigger ServiceCreation caused an unexpected exception, contact your administrator: ServiceCreation: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Client Manager: id value of incorrect type: 01Mn0000000DVyNEAW: [Client_Manager__c]: Trigger.ServiceCreation: line 51, column 1

 

 

I think I am pulling the ID of the teammember role, rather than the user itself. Looking through workbench, I can not find the right value to set these users. Can anybody help?

 

Hello! Hoping someone can help - we recently migrated from Case Comments to Case Feed Layouts within our community. 
  • When the "Case Status" field is in "Awaiting Customer Feedback" - we previously had workflow rules to kick the Case Status back to "Working" when a customer posted a comment
  • With Case Feed Layout - we were able to use Flow and Process Builder to replicate this action for a New Case Feed Item
  • With Case Feed Layout - we are struggling to replicate this functionality for a new Case Post Comment (customer posts a Feed Item Comment rather than a new feed Item)
What would be the best way to accomplish this? Not an Apex Developer by trade, but hoping this can be done with a relatively simple trigger - any feedback would be appreciated!
User-added image

 
. We have REGEX formulas that run to scan incoming support tickets for “sensitive data”, i.e. Credit Card #s, SSNs, CVV numbers. We have a workflow that will look at the subject/description of incoming support tickets and check a box if any sensitive information is identified, so our security team can look at it. However, the regex formula we currently have in place is WAY to hypersensitive, it literally flags almost every incoming support ticket as being sensitive.

What we would like to do, is have the regex formula scan the field, and then auto “mask” the sensitive data, i.e.
Ticket comes in, with the CC# - 4444 4444 4444 4444
New value – 4444 44** **** 4444

This is crucial to our PCI compliance, as we can’t have this data floating around in Salesforce and in emails. Every time we get one of these, we have to go around to everyone who got the email notifications and watch them permanently delete them from their computer.

Can you look at the formulas below, and:
1.)    Fix them so they are not so hypersensitive?
2.)    Let us know how we can auto-mask them as they come in.

CVV (ignore dashes and spaces)
REGEX(Description_Copy__c, ".*\\D(?:\\d[ -]*?){3}\\D.*"),

SSN# (ignore dashes and spaces)
REGEX(Description_Copy__c, ".*\\D(?:\\d[ -]*?){9}\\D.*"),

Credit Card# (ignore dashes and spaces)
REGEX(Description_Copy__c, ".*(?:\\d[ -]*?){13,19}.*"),

Any help would be appreciated!!!!

I have a trigger that creates a record in a custom object (Service) when an Opportunity is Closed Won and

-Sets the Record Type based on information in the Opportunity

-Pulls members from the Opportunity Team into User Lookup fields in the new record

-Brings in some values from the Opportunity and sets some default values

trigger ServiceCreation on Opportunity (after update) {

     map<id,Opportunity> oldValueMap = Trigger.oldMap;
    
    FOR(OPPORTUNITY OPP:TRIGGER.NEW){
    
        Opportunity oldOpp = oldValueMap.get(OPP.id);
        //Check if Opportunity is Won, is a Centinel Integration, and is not marked as a Plan Upgrade
        if (OPP.isWon && !oldOpp.isWon && Opp.Platform__c <>'Cardinal 2ID' && Opp.Type<>'Plan Upgrade'){
   				
             Services__c SVC = new Services__c();
            //Queries Opportunity Team Member Table, returns list of User IDs and Team Member Roles
            for(OpportunityTeamMember teamMember:[select UserID,TeamMemberRole from OpportunityTeamMember where OpportunityId=:OPP.ID]){
               //Sets Service Owner and Client Manager in Service based on Opportunity Team Members
                if (teamMember.TeamMemberRole=='Activation Manager'){
                    SVC.OwnerId = teammember.userId;
                } else if (teamMember.TeamMemberRole=='Client Manager'){
                    SVC.Client_Manager__c = teammember.userId;
                }  
                
            }
            //Queries Service Record Types and Developer Names 
            Map<string,id> serviceRTMap = new Map<string,id>();
                for (RecordType RT:[select id,developerName from RecordType where SobjectType='Services__c']){
                 	   serviceRTMap.put(rt.developerName,rt.id);
                }
            //Set record type of Service based on Opportunity Information
            if (opp.Product__c=='Consumer Authentication'){
                Svc.RecordTypeId = serviceRTMap.get('Authentication');
            } else if (opp.Product__c == 'Payment Brands' && opp.Payment_Brands__c.contains('PayPal')){
                Svc.RecordTypeId = serviceRTMap.get('PayPal');
            } else {
                Svc.RecordTypeId = serviceRTMap.get('Payment_Brand');
            }
            //Prefill subset of Service fields, upon creation, with data from the Opportunity
            Svc.Name = Opp.Name; 
            Svc.Register_Date__c = Opp.CloseDate;
            Svc.Stage__c = '1-Boarding';
            Svc.Status__c = 'Registered';
            Svc.Related_Opportunity__c = Opp.ID;
            svc.account__c = Opp.AccountID;
            svc.Sales_Rep__c = Opp.OwnerID;
            svc.Platform__c = Opp.Platform__c;
            svc.Product__c = Opp.Product__c;
            svc.Payment_Brand__c = Opp.Payment_Brands__c;
            svc.Partner__c = Opp.Partner__c;
            svc.Monthly_Transactions__c = Opp.Monthly_Transactions__c;
            svc.Monthly_Revenue__c = Opp.Monthly_Revenue__c;
            svc.Set_Up_Fee__c = Opp.Set_up_Fee__c;
            svc.Annualized_Revenue__c = Opp.Amount;
            svc.RBA__c = opp.Rules__c;
            svc.Adapter__c = Opp.Adapter__c;
            svc.Projected_Activation_Date__c = Opp.Projected_Activation_Date__c;
            Insert SVC;
        }
}
}

 

I am having trouble writing the test method...can anybody help?  How do I write a method that checks to see if the Service record was created, and that the fields are being brought over correctly?

Hello - hope someone can help out. I have a custom object, "Services", that tracks customer onboarding post sale. 

So when the Opportunity is marked closed won, a trigger will automatically insert a "Services" record for that account - pulling in information from the related Opportunity and Account (Both account and related opportunity fields are custom lookup fields on the Service object, NOT master detail).

 

What I am trying to do is pull two members from the Account Team of that Account into the Service:

1.) The user marked as the "Integration Manager" on the Account Team will be the Service Owner

2.) The user marked as the "Client Manager" on the Account Team will be pulled into a custom user lookupfield "Client Manager" on the service record

 

Below is my trigger, attempting to pull from AccountTeamMember

         for(AccountTeamMember teamMember:[select id,TeamMemberRole from AccountTeamMember where accountId=:OPP.AccountID]){
               
                if (teamMember.TeamMemberRole=='Integration Manager'){
                    SVC.OwnerId = teammember.id;
                } else if (teamMember.TeamMemberRole=='Client Manager'){
                    SVC.Client_Manager__c = teammember.id;
                }  
                
            }

 

However, I am getting the following error upon save: Error:Apex trigger ServiceCreation caused an unexpected exception, contact your administrator: ServiceCreation: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Client Manager: id value of incorrect type: 01Mn0000000DVyNEAW: [Client_Manager__c]: Trigger.ServiceCreation: line 51, column 1

 

 

I think I am pulling the ID of the teammember role, rather than the user itself. Looking through workbench, I can not find the right value to set these users. Can anybody help?