• MichelCR
  • NEWBIE
  • 30 Points
  • Member since 2021

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 11
    Replies
Hello

I am trying to add a look up in my flow that is dependent on what kind of user is activating the flow.

I know the trick to user "recordId" to look up informaiton about the reocrd the user is on but is there something like this I can use to reference the user who has activated the flow?

Thank you
 Nicole
How do I send an old Set of values and a new Set of values via a deserialized JSON body?

I have an array of  accountRoles and I need  to send them to an external database.
Hello everyone , 

Im creating a trigger that automate creating a team member for an account if statement but its not working , there is my Code 

public static void CreateAccountTeam(List<Account> listAccounts){
        List<AccountTeamMember> LsTeamMember = new List <AccountTeamMember>();
        List<Account> LsAccs = new List<Account>();
        system.debug('Mostafa1'+ listAccounts);
            for (Account a :listAccounts)
            {
                system.debug('mostafa2a'+ a);
                    if(a.CreatedBy.Type_role__c == 'CAINV' || a.CreatedBy.Type_role__c == 'DESK')
                {
                  AccountTeamMember tm = new AccountTeamMember();
                  tm.UserId = a.CreatedById;
                  tm.AccountId = a.Id;
                  tm.TeamMemberRole='CAINV';
                    LsTeamMember.add(tm);
                  system.debug('Mostafa3'+LsTeamMember);
                }
        }
            insert LsTeamMember;

    }

 public void handleAfterInsert(List<Account> lstAccount){
        AP01_AccountRules.CreateAccountTeam(lstAccount);

    }

there is trigger : 
if(Trigger.isAfter && Trigger.isInsert){
        system.debug('## AccountTrigger -- after insert');
        handler.handleAfterInsert(Trigger.new);
    }

can some one help me to resolve this 
I'm stuck on this project currently. A case in salesforce is created every single time a user fills in a form and this causes an email to be sent to the user. However, an issue occurs with auto-reply emails resulting in email loop.
I've created a custom metadata object in salesforce for autoresponse emails (with a subject field and a body field), and I need to be able to code a trigger in Apex whenever a codeword in a list of our metadata records gets called.
**My question is, how can I code to check if an email contains a word that is in the metadata? Or in other words, query the metadata like a list. **
The current stand-in code snippet is as follows, the goal is to replace the string with a metadata object that can be updated outside of code. Any help is greatly appreciated!!
Current code:
for(Case thisCase : (List<Case>)Trigger.new){
    
        if(thisCase.Origin == 'Email - Access York') {
        
           if(thisCase.Subject.toLowerCase().startsWith('automatic reply:')) {
                thisCase.addError('Not saving Automatic Reply');
            }
             else if (thisCase.Subject.startsWith('Out of Office:')) {
                thisCase.addError('Not saving Out of Office');
            } 
            
        }
    
    else if(thisCase.Origin == 'Email - Transit') {
        
           if(thisCase.Subject.toLowerCase().startsWith('automatic reply:')) {
                thisCase.addError('Not saving Automatic Reply');
            }
             else if(thisCase.Subject.startsWith('Out of Office:')) {
                thisCase.addError('Not saving Out of Office');
            } 
            
        }

 
Hello All,
I have one big list of accounts as follows:
List<Account> lstMain = [SELECT Id FROM Account WHERE balance__c > 1000000];

I have several other smaller lists as follows:
List<Account> lstVip = [SELECT Id FROM Account Where vip__c = true];

List<Account>lstSpecial = [SELECT Id FROM Account where special__c = true];

List<Account>lstNearMe = [SELECT Id FROM Account where state =:currentState AND status = 'valid'];

What I need to do is produce a final list.  The final list has to start with 'lstMain' and remove from 'lstMain' those that aren't in 'lstVip' or 'lstSpecial' or 'lstNearMe'.  What is the most efficient way to accomplish this?  Should I use a map instead of a list?
  • February 19, 2021
  • Like
  • 0
Hi all,
I am trying to discover why while compiling a test class method, this is telling me 'Variable doesn't exist' in the row:
System.assertEquals(testEntitlement.Id



I would appreciate if someone could tell me what I am doing wrong?:
 
@isTest
    private static void EntitlementUpdate() {
    //ARRANGE
        User serviceUser = [
        SELECT
            Id
        FROM
            User
        WHERE
            Email =: 'test.serviceuser@google.com'
    ];
	
	 Account testAccount = [
        SELECT 
            Id 
        FROM 
            Account];
			
       Product2 testProduct = [
        SELECT 
            Id 
        FROM 
            Product2];
		

	CaseAsset__c testCaseAsset = new CaseAsset__c(Name='Test Case Asset', Account__c=testAccount.Id, SerialNumber__c='123', Product__c = testProduct.Id, StartDate__c = System.today(), EndDate__c = System.today() + );
    testCaseAsset.OwnerId = serviceUser.ID;
    
    insert testCaseAsset;

    //ACT
    test.startTest();
    System.runAs(serviceUser){
        Entitlement testEntitlement = new Entitlement();
		testEntitlement.AccountID = testCaseAsset.Account__c;
		testEntitlement.Name = testCaseAsset.Name;
        testEntitlement.CasesPerEntitlement = integer.valueOf(testCaseAsset.NoOfCasesPerYear__c);
        testEntitlement.EndDate = testCaseAsset.EndDate__c;
        testEntitlement.StartDate = testCaseAsset.StartDate__c;
        testEntitlement.IsPerIncident = true;
        testEntitlement.CaseAsset__c = testCaseAsset.Id;
        testEntitlement.RemainingCases = integer.valueOf(testCaseAsset.NoOfCasesPerYear__c);
		insert testEntitlement;
    }   
    test.stopTest();
    //ASSERT
    Entitlement testEntitlementAfterProcess = [
        SELECT 
            Id,
            Name
        FROM 
            Entitlement
        ];
        System.assertEquals(testEntitlement.Id,
                        testEntitlementAfterProcess.Name,
                        'Entitlement not created');
   
    }

 
Hello

I am trying to add a look up in my flow that is dependent on what kind of user is activating the flow.

I know the trick to user "recordId" to look up informaiton about the reocrd the user is on but is there something like this I can use to reference the user who has activated the flow?

Thank you
 Nicole
Hi All,
I am trying to cover wrapper class in calss. But it s not covering. I am sharing my class and test class.

Apex class
public class accountCController {
    @AuraEnabled (cacheable=true)
    public static List<accWrapper> getNameValues(List<string> acname){
        List<accWrapper> resultObject = new List<accWrapper>();
        string query = 'SELECT Id,Name FROM account  WHERE  Name';
        query+='=: acname';
        List<SObject> lstResult = Database.query(query);
        for (SObject res : lstResult) {
            accWrapper obj = new accWrapper();
            obj.testId = (String)res.get('Id');
            obj.testName = (String)res.get('Name');
            resultObject.add(obj);
        }       
        return resultObject;
    }
    public class accWrapper{
        @AuraEnabled
        public String testId;
        @AuraEnabled
        public String testName;
    }
	}

Test class:
@isTest
public class accountController_Test {
    static testMethod void testName(){  
        List<string> strList = new List<string>();
        strList.add('A');
        strList.add('B');
        accountCController.getNameValues(strList);
       
    }
}


Its covering "getNameValues" method but it is not covering wrapper class. Please help me on this.​​​​​​​

Thanks in advance

Regards,
​​​​​​​Ramana

Hello everyone,

I have build a Screen Flow that works just fine. However when I run the same flow (copy) as autolaunched flow he crashes with "Too many SOQL queries: 101" pretty early in the process. 

Not sure what I am missing as the queries are identical?!

Thanks in Advance

How to set some text in custom field when the picklist value changes one value to another?  Suppose there is 4-5 values in picklist and when the value of picklist is changing from 1 to 2 or 1 to 3 or 1 to 4 then set some text into custom field suppose A, same if picklist value chaning 2 to 3 or 2 to 4 then set B in custom field.
If anyone know the solution please share, Appriciated..

Hello everyone

I have a community with different pages. The community might be used in different countries so it will have some functionalities that are available in some cases but not in others (for example open current discounts).

I have a custom metadata type with records for each country where the settings for different functionalities are stored - for example 

UK - open current discounts - true
US - open current discounts - false.

Is there a way to get that information only once (I call an apex class that makes a query for the metadata) and set it for the session, so that all pages can use it or I have to call the method from each page.