• MichelCR
  • 30 Points
  • Member since 2021

  • Chatter
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 11

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
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;
            insert LsTeamMember;


 public void handleAfterInsert(List<Account> lstAccount){


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

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:

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

	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;

        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;
    Entitlement testEntitlementAfterProcess = [
                        'Entitlement not created');


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
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');
        return resultObject;
    public class accWrapper{
        public String testId;
        public String testName;

Test class:
public class accountController_Test {
    static testMethod void testName(){  
        List<string> strList = new List<string>();

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

Thanks in advance


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.