• John L Schneider II
  • NEWBIE
  • 40 Points
  • Member since 2016
  • Salesforce Administrator
  • NexGen Consultants


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
My apologies if this is a stupid question, but I have tried and tried and cannot figure out what is going wrong here.  I am used to using Eclipse all the time but am trying to make the switch to SFDX, however.....I'm stuck fairly early.

This is the command I'm using
sfdx force:project:create --projectname fsc --outputdir c:\Users\johns\Desktop\Temporary_Deletes_Daily --template standard
This is the error I am getting.
Error: Unrecognized flag: {"name":"projectname","char":"n","required":true,"description":"name of the generated project","longDescription":"The name for the new project. Any valid folder name is accepted.","type":"string","values":[]}
    at flags.forEach.flag (C:/Program Files/Salesforce CLI/client/node_modules/force-language-services/dist/common/main/LegacyCommand.js:77:31)
    at Array.forEach (<anonymous>)
    at Function.toFlagsConfig (C:/Program Files/Salesforce CLI/client/node_modules/force-language-services/dist/common/main/LegacyCommand.js:28:19)
    at Object.<anonymous> (C:/Program Files/Salesforce CLI/client/node_modules/force-language-services/dist/oclif/force/project/create.js:31:66)
    at Module._compile (C:/Program Files/Salesforce CLI/client/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at LazyLoader.loadModule (C:/Program Files/Salesforce CLI/client/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:139:21)
    at Function._load (C:/Program Files/Salesforce CLI/client/node_modules/@salesforce/lazy-require/lib/LazyLoader.js:115:29)
    at require (C:/Program Files/Salesforce CLI/client/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at fetch (C:/Program Files/Salesforce CLI/client/node_modules/@oclif/config/lib/plugin.js:101:21)
    at Plugin.findCommand (C:/Program Files/Salesforce CLI/client/node_modules/@oclif/config/lib/plugin.js:115:21)
    at Object.load (C:/Program Files/Salesforce CLI/client/node_modules/@oclif/config/lib/plugin.js:48:72)

10:46:07.528 sfdx force:project:create --projectname fsc --outputdir c:\Users\johns\Desktop\Temporary_Deletes_Daily --template standard ended with exit code 1

 
I'm tired and overthinking this.  I think.  Can someone give me a hand and either point me in the right direction or just write the test class for this?

Thanks!
 
public with sharing class InvocableLogger {

@InvocableMethod  

public static void log(List<String> messages){               

System.debug(messages);

}

}

Y'all are awesome!
I have found formulas that calculate the age or time between two DateTimes in business hours.  What I am trying to calculate is the DateTime value that answers created + 4 business hours.  I understand this won't be the true business hours set in setup, but I am comfortable saying its a weekday and hours are 8 to 5.
trigger Contact on Contact (before insert, before update) {
    for (Contact c1 : trigger.new)
    {
        string fullname = c1.LastName;
        string firstname = c1.FirstName;
        if( fullname.containsWhitespace() == true )
        {
            if (String.isBlank(firstname) == true)
            {
                string fn;
                string ln;
                fn = fullname.substring(0,fullname.indexOf(' '));
                ln = fullname.substring(fullname.indexOf(' ')+1);
                c1.LastName = ln;
                c1.FirstName = fn;
            }
        }
    }
}

As the topic says, this works when I create a record through the GUI but not when loading records through Data Loader (CLI Batch or Bulk).

I am attempting to split the value in LastName whenever the FirstName is blank and the LastName has a space in it.
I am looking to get a list of accounts that do not have any contacts who are members of a specific campaign.

Here is the code I have, but I cannot figure the way to get the list.
public class AccountListController6 {
    
    private String sortOrder = 'Name';
    public List<Account> getAccounts() {
        String strEt6 = '701220000001Q1GAAU';
        List<Account> results = Database.query(
            'SELECT Id,Name ' +
            'FROM Account ' +
            'WHERE ID ' +
            'NOT IN ' +
            '(SELECT Contact.AccountId ' +
            'FROM CampaignMember ' +
            'WHERE CampaignId = :strEt6) ' +
            'ORDER BY ' + sortOrder + ' ASC ' +
            'LIMIT 10'
        );
        return results;
    }
}

 
I am working on a unti test that creates leads and then add them to campaign.  Here is the where I am at.  I am currently stuck at how to add the leads created in bulk to the campaign I create in the test class.
 
@isTest
public class UnitTest_Lead {
    static testMethod void runPositiveTestCases(){

        final string givenLastName = 'Weebles';
        try{
        System.debug('Inserting 1 Lead... (single record validation)');
        
        Lead testLead1 = new Lead(LastName = 'Weebles',
                                 Company ='Weebles Widgets');
        insert testLead1;
        
        //Validate single insert
        for(Lead l:[SELECT LastName FROM Lead WHERE
                   CreatedDate = TODAY])

        System.assertEquals(givenLastName, l.LastName);
        }
		catch(DmlException e1) {
		System.debug('An unexpected error has occurred: ' + e1.getMessage());
        }
        
        try{
        //Bulk validation
        System.debug('Inserting 2000 Leads... (bulk validation)');
        
        List<Lead> testLead2 = new List<Lead>();
        for(integer i=0; i<2000; i++) {
            testLead2.add(new Lead(LastName = 'Weebles',Company = 'Weebles Widgets' + i, Email = i+'@weebles.com'));
        }
        insert testLead2;
        }
		catch(DmlException e2) {
		System.debug('An unexpected error has occurred: ' + e2.getMessage());
        }
        
        try{
		//Create a campaign
        Campaign camp1 = new Campaign(Name = 'Test Campaign 1', IsActive = True);
        insert camp1;
        }
		catch(DmlException e3) {
		System.debug('An unexpected error has occurred: ' + e3.getMessage());
        }
        
        try{
        Campaign campID = [SELECT Id FROM Campaign WHERE Name = 'Test Campaign 1'
                           AND IsActive = True AND CreatedDate = :System.today()];
        //Add the bulk contacts to campaign
        //This is where I'm stuck
        List<CampaignMember> testCampMemb1 = new List<CampaignMember>();
        for(integer i=0; i<2000; i++) {
            testCampMemb1.add(new CampaignMember(LeadId__r.Email = i+'@weebles.com', CampaignId = campID, Status = 'Sent'));
        }
        insert testCampMemb1;
            
        }
		catch(DmlException e3) {
		System.debug('An unexpected error has occurred: ' + e3.getMessage());
        }
    }
}

 
SELECT Contact.AccountId
FROM CampaignMembers
WHERE
Contact.AccountId NOT IN (SELECT Contact.AccountId FROM CampaignMember WHERE CampaignId = '7011A00000142mwQAA' AND Contact.Client_Options__c = 'Kick Me') AND
Contact.AccountId IN (Select Contact.AccountId FROM Contact WHERE Id IN (Select ContactId FROM CampaignMember WHERE CampaignId = '7011A00000142mwQAA')
ORDER BY Owner.Name ASC

I am trying to get a list of Accounts who have contacts that are members of a campaign (ID is in code) but don't have a contact that is a member of the same campaign with a contact.textfield (Client_Options__c) set to 'Kick Me'.

I'm running in to the "The inner and outer selects should not be on the same object type" error and can't figure out a way around this.  This is a query that is run on demand so either a revised query or something I could drop in to Execute Anonymouse would be fantastic!  I appreciate any guidance here!
trigger Contact on Contact (before insert, before update) {
    for (Contact c1 : trigger.new)
    {
        string fullname = c1.LastName;
        string firstname = c1.FirstName;
        if( fullname.containsWhitespace() == true )
        {
            if (String.isBlank(firstname) == true)
            {
                string fn;
                string ln;
                fn = fullname.substring(0,fullname.indexOf(' '));
                ln = fullname.substring(fullname.indexOf(' ')+1);
                c1.LastName = ln;
                c1.FirstName = fn;
            }
        }
    }
}

As the topic says, this works when I create a record through the GUI but not when loading records through Data Loader (CLI Batch or Bulk).

I am attempting to split the value in LastName whenever the FirstName is blank and the LastName has a space in it.
I am looking to get a list of accounts that do not have any contacts who are members of a specific campaign.

Here is the code I have, but I cannot figure the way to get the list.
public class AccountListController6 {
    
    private String sortOrder = 'Name';
    public List<Account> getAccounts() {
        String strEt6 = '701220000001Q1GAAU';
        List<Account> results = Database.query(
            'SELECT Id,Name ' +
            'FROM Account ' +
            'WHERE ID ' +
            'NOT IN ' +
            '(SELECT Contact.AccountId ' +
            'FROM CampaignMember ' +
            'WHERE CampaignId = :strEt6) ' +
            'ORDER BY ' + sortOrder + ' ASC ' +
            'LIMIT 10'
        );
        return results;
    }
}

 
SELECT Contact.AccountId
FROM CampaignMembers
WHERE
Contact.AccountId NOT IN (SELECT Contact.AccountId FROM CampaignMember WHERE CampaignId = '7011A00000142mwQAA' AND Contact.Client_Options__c = 'Kick Me') AND
Contact.AccountId IN (Select Contact.AccountId FROM Contact WHERE Id IN (Select ContactId FROM CampaignMember WHERE CampaignId = '7011A00000142mwQAA')
ORDER BY Owner.Name ASC

I am trying to get a list of Accounts who have contacts that are members of a campaign (ID is in code) but don't have a contact that is a member of the same campaign with a contact.textfield (Client_Options__c) set to 'Kick Me'.

I'm running in to the "The inner and outer selects should not be on the same object type" error and can't figure out a way around this.  This is a query that is run on demand so either a revised query or something I could drop in to Execute Anonymouse would be fantastic!  I appreciate any guidance here!