• Mike Arthur
  • NEWBIE
  • 229 Points
  • Member since 2014

  • Chatter
    Feed
  • 5
    Best Answers
  • 4
    Likes Received
  • 2
    Likes Given
  • 19
    Questions
  • 66
    Replies
When I try to run sfdx the same way I have for about 4 years, I get this error message:

'"C:\Users\Desja\AppData\Local\sfdx\client\bin\..\7.209.6-8ba3197\bin\sfdx.cmd"' is not recognized as an internal or external command, operable program or batch file.

>>> Why is it trying to run sfdx from that folder? It's not in that folder!

In this folder: C:\Users\Desja\AppData\Local\sfdx\client I have two sub-folders, "bin" and "7.209.6-8ba3197", the 2nd of which appears to have been created on 9/5/23 (just 2 days ago). The "bin" folder contains 2 files: sf.cmd and sfdx.cmd, while the "7.209.6-8ba3197" folder contains a "bin" folder, which contains a single file named "node.exe"

CLI has become a very valuable tool for me as I support 19 nearly identical orgs for the chapters of a national non-profit that works for the homeless. I have no idea why it has stopped working so mysteriously.

I have been through several existing messages on here that all seem to point to the PATH environment variable. The correct folder is present in my path, but the error message indicates it's trying to run sfdx from that other folder named 7.209.6-8ba3197\bin -- why?

Thank you for any clues to help resolve this.
I am trying to solve the Trailhead Platform Developer 1 (PD1) maintenance module I am facing the following error please help me to solve it. "The correct Safe Navigation logic was not found. Your Apex code should use the Safe Navigation operator to check for null values for Account Name. Please review line 18 of the original code and recheck your code for the Safe Navigation operator."..?
@RestResource(urlMapping='/apexSecurityRest')
global with sharing class ApexSecurityRest {
    @HttpGet
    global static Contact doGet() {
        Id recordId = RestContext.request.params.get('id');
        Contact result;
        if (recordId == null) {
           throw new FunctionalException('Id parameter is required');
        }
        if (Schema.SObjectType.Contact.isAccessible()
          && Schema.SObjectType.Contact.fields.Name.isAccessible()
          && Schema.SObjectType.Contact.fields.Top_Secret__c.isAccessible()
        ) {
          List<Contact> results = [SELECT id, Name, Title, Top_Secret__c, Account.Name FROM Contact WHERE Id = :recordId];
          if (!results.isEmpty()) {
             result = results[0];
             if (Schema.sObjectType.Contact.fields.Description.isUpdateable()){
                 result.Description = result.Account.Name;
                 }
             }
           } else {
             throw new SecurityException('You don\'t have access to all contact fields required to use this API');
           }
           return result;
      }
      public class FunctionalException extends Exception{}
      public class SecurityException extends Exception{}
}

 
I'm currently working on the Trailhead unit Set Up Jest Test Framework (https://trailhead.salesforce.com/content/learn/modules/test-lightning-web-components/set-up-jest-testing-framework?trail_id=build-lightning-web-components)

I am in the directory with my project and I'd like to install Jest into the project.

However, Sfdx seems unable to find npm even though it is clearly installed:
 
D:\tutorials\SFDC2020\Summer20>npm --version
6.14.5

D:\tutorials\SFDC2020\Summer20>sfdx force:lightning:lwc:test:setup
ERROR running force:lightning:lwc:test:setup:  npm command not found. Verify npm is properly installed and try again.

What is wrong and how can I fix it?


 

I'm trying to insert an account record if it's not a duplicate. I'm referencing the findDuplicates method documentation found here: link (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Datacloud_FindDuplicates.htm#apex_Datacloud_FindDuplicates_methods

Account acct = new Account();
acct.Name = 'Acme';
acct.BillingStreet = '123 Fake St';
acct.BillingCity = 'Springfield';
acct.BillingState = 'VT';
acct.BillingCountry = 'US';
        
List<Account> acctList = new List<Account>();
acctList.add(acct); 

if (Datacloud.FindDuplicates.findDuplicates(acctList).size() ​== 0) {
// If the new account doesn't have duplicates, insert it.
    insert(acct);
}
Here is my code:
trigger clientImportTrigger on Client_Import__c (before insert) {
    List<Account> accountsToInsert = new List<Account>();
    Id personAccRecTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('PersonAccount').getRecordTypeId();
    
    for (Client_Import__c A : trigger.new){
//create personAccount
        List<Account> dupeTestPersonAcc = new List<Account>();
        string pAddress = (A.addressLine1__c + ', '+ A.addressLine2__c);
                
        Account newPersonAcc = new Account();
        	newPersonAcc.FirstName = A.firstName__c;
            newPersonAcc.LastName = A.lastName__c;
            newPersonAcc.PersonEmail= A.email__c;
            newPersonAcc.Phone = A.phone__c;
            newPersonAcc.Phone_Type__c = A.phoneType__c;
            newPersonAcc.PersonMailingStreet = pAddress;        	
            newPersonAcc.PersonMailingcity = A.City__c;
            newPersonAcc.PersonMailingState = A.State__c;
            newPersonAcc.PersonMailingPostalCode = A.Zip__c;
            newPersonAcc.PersonMailingCountry = A.Country__c;
            newPersonAcc.Language_Preference__c = A.Language__c;
        	newPersonAcc.RecordTypeId = personAccRecTypeId;
        	dupeTestPersonAcc.add(newPersonAcc); 
        	//accountsToInsert.add(newPersonAcc);
        
        //if the new person account doesn't have duplicates, put it in the list to be inserted later with the rest
        System.debug(Datacloud.FindDuplicates.findDuplicates(dupeTestPersonAcc).size());
        if (Datacloud.FindDuplicates.findDuplicates(dupeTestPersonAcc).size() == 0){
        	accountsToInsert.add(newPersonAcc);
        	
        }
    }
    insert(accountsToInsert);
}

​​​​​​The problem I'm having is the findDuplicates(sObject).size() is always equal to 1, instead of 0 when I run the test class that just inserts a single record. Bascially, I can't figure out how to create the "if statement" so that a record is inserted if no duplicate is found. Any help is appreciated.
Hi,

I've been learning Lightning Components on Trailhead. I'm currently doing the project for the Lightning Superbadge and have been running into the following error when I try to reload the page for the standalone app:
 
Unable to find action 'getBoatTypes' on the controller of c:BoatSearchForm
Failing descriptor: {c:BoatSearchForm}

I've googled around and have found a lot of examples of this error where people hadn't added the @AuraEnabled annotation to their server-side controller, so the client-side controller couldn't find the method.

But, I have added that annotation and am still getting the message. It's driving me up the wall. I haven't had this issue on any other controllers I've created, and I even have another method in the same server-side controller that is being referenced by the client with no issues.

Here's my client-side controller:
({
    handleInit: function(component, event, helper) {
        // Check environment can create record
        var canCreateRecord = $A.get('e.force:createRecord');
        component.set('v.canCreateRecord', !!canCreateRecord);
        
        // Get boat types to populate boat type dropdown
        var getBoatTypesAction = component.get('c.getBoatTypes');
        getBoatTypesAction.setCallback(this, function(response) {
            var state = response.getState();
            if(state === 'SUCCESS') {
                component.set('v.boatTypes', response.getReturnValue());
            } else {
                console.log('Failed with state:', state);
            }
        });
        $A.enqueueAction(getBoatTypesAction);
    },
    
	createNewBoat : function(component, boatType) {
        var boatType = component.get('v.boatType');
        
		var createAction = component.get('c.createBoat');
        createAction.setParams({
            "type": boatType
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if(state === "SUCCESS") {
                console.log('SUCCESS');
            } else {
                console.log(state);
            }
        });
        $A.enqueueAction(createAction);
	}
})

and my server-side controller:
public class BoatSearchApexController {
    
    @AuraEnabled
    public static void createBoat(String type) {
        Boat__c boat = new Boat__c();
        if(type != null) {
            BoatType__c boatType = new BoatType__c(Name=type);
            insert boatType;
            boat.BoatType__c = boatType.Id;
        }
        insert boat;
    }
    
    @AuraEnabled
    public static List<BoatType__c> getBoatTypes() {
        return [Select Id, Name From BoatType__c];
    }
}

​​​​​​​

Hi all, I am so close to finishing this process automation badge but am stuck in one area in Step 7.

I've built out my process builder as follows

User-added image
User-added image
User-added image

And my date formula as follows
 

Case(MOD(Date__c-DATE(1900,1,7),7),0,"Sunday",1,"Monday",2,"Tuesday",3,"Wednesday",4,"Thursday",5, "Friday",6,"Saturday", "")
 



Challenge Not yet complete... here's what's wrong:  The Robot Setup Day of the Week formula does not seem to be working properly. The Day of the Week should not fall on Saturday or Sunday. 

It works nicely but doesn't seem to pass, what could be up.
 

Hi All,

While setting up the CLIQ, its giving me the error below, I don't know which path to set to make it working

User-added image

thanks in advance
Abhi

Hi,

I'm having a problem with .setParams, I've tried to put it in an app that is similar to the Account List explained in the trailhead(https://developer.salesforce.com/trailhead/en/project/slds-lightning-components-workshop/slds-lc-6). The objective is to pass, from an input field, two dates to the apex controller for filter the select of the objects and show them when the buttom "Cerca" is pressed. So I tried with the aura:attribute and the action.setParams to pass the values in the controller but I've always get the same error. I think that the problem is .setParams because when I remove it the app works fine.
The error is this:

Something has gone wrong. Error during init [TypeError: Cannot read property 'apply' of undefined] . Please try again.

This is the code:

App:
 

<aura:application >
    <ltng:require styles="/resource/SLDS/assets/styles/salesforce-lightning-design-system.css"  />
    <div class="slds" style="margin-top:10px;margin-left:10px;">
       <c:AccountList DataDa="2016-01-01"  DataA="2016-01-31"/>
    </div>
</aura:application>
 


Component:
 

aura:component controller="LightningConsoleTitoliController">
   <aura:attribute name="titoli" type="List" />
       <aura:attribute type="Date" name="DataA" access="global"/>
    <aura:attribute type="Date" name="DataDa" access="global"/>
   <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<table class="slds-table slds-table--bordered slds-table--striped">
      <thead>
        <tr>
           <--Other Code -->
<ui:inputDate aura:id='DataDa' label='Data Da' value='{!v.DataDa}' displayDatePicker="true" updateOn='click'/>
           <ui:inputDate aura:id='DataA' label='Data A' value='{!v.DataA}' displayDatePicker="true" updateOn='click'/> 
           <ui:inputText aura:id='Agente' label='Agente' value='{!v.Agente}'/>
            <ui:button press='{!c.doInit}' aura:id='bottone' label='Cerca' />
        </tr>
      </thead>

<-- Other code -->

Controller:
({
   doInit: function(component, event, helper) {      
      //Fetch the expense list from the Apex controller   
      helper.getAccountList(component);
   }
})

Helper:
({
   //Fetch the accounts from the Apex controller
  getAccountList: function(component) {
      var action = component.get("c.getTitoli");
      action.setParams({
          DataA : component.get("v.DataA")
          DataDa : component.get("v.DataDa")
})
<-- Callback code -->

Apex Controller:
public class LightningConsoleTitoliController {
    
    @AuraEnabled
    public static list<Titolo__c> getTitoli(Date DataDa, Date DataA){
        return [Select id, Data_Scadenza__c, CreatedDate, Importo_Provvigionale__c,DataA__c,DataDa__c,
                Data_Scadenza_Inizio__c, Data_Scadenza_Fine__c from Titolo__c where Data_SCadenza__c >= :DataDa and Data_Scadenza__c <= :DataA];
    }

}

 

I've been working with developing a stand-alone app in lightning. In trying to adhere to the look and feel I'm following the html layed out in https://www.lightningdesignsystem.com/components/tabs. Sorry if this is a newb question how do I manipulate the class of the <a> being clicked to .slds-active and it's corresponding <div> to .slds-show , and then remove any other existing <a> with the .slds-active and change the <div> to .sld.slds-hide?  I've seen something similiar with javascript on a visualforce page but I wanted to follow the component design structure. Surely someone has done this as it seems pretty standard navigation. Currently my component has

<div class="slds-tabs--default">
 <ul class="slds-tabs--default__nav" role="tablist">
   <li class="slds-tabs--default__item slds-text-heading--label slds-active" title="Item One" role="presentation">
   <a class="slds-tabs--default__link" href="#void" role="tab" tabindex="0" aria-selected="true" aria-controls="tab-default-1" data-data="tab-default-1__item"  onclick="{!c.selectTab}" id="tab-default-1__item">New Checklists</a>
        </li>
  <li class="slds-tabs--default__item slds-text-heading--label" title="Item Two" role="presentation">
            <a class="slds-tabs--default__link" href="#void" role="tab" tabindex="-1" aria-selected="false" aria-controls="tab-default-2" data-data="tab-default-2__item" onclick="{!c.selectTab}" id="tab-default-2__item">Existing Checklist</a>
        </li>
      </ul>
      <div id="tab-default-1" class="slds-tabs--default__content slds-show" role="tabpanel" aria-labelledby="tab-default-1__item">
        <h2>Item One Content</h2>
      </div>
      <div id="tab-default-2" class="slds-tabs--default__content slds-hide" role="tabpanel" aria-labelledby="tab-default-2__item">
        <h2>Item Two Content</h2>
      </div>

    </div>
I have the onClick="{!c.selectTab}" which goes to my js controller. Below
selectTab : function(component, event, helper){
    	var activeTab;
        activeTab = event.target.getAttribute("id");
        //var result = component.find("tab-default-1__item");
        //alert(result);
  
    },

I see the event.target.getAttribute gives me the value of the onclick id. I can get the value and can then tell which tab was clicked, but then how do I 

1. Change the class value of that Id?
2. Change the class value of other id's?

I've been trying to use various javascript  functions like find but nothing seems to be working. Can someone point me to which functions I should be using to find id(DOMS) on a component and which functions can be used to set vairous attributes?  I didn't find anything in the lightning dev guide but will keep looking. Any help is appreciated.
 

I and some other colleagues received this notification via email to all our System Administrators:

"You have one or more certificates in your Salesforce org California College Guidance Initiative [org ID here] that will expire soon. Please review the list below and visit Certificate and Key Management from Setup to make an update.
 
   - SelfSignedCert_20Nov2013_203932, Self-Signed, expires on 11/20/2015. Warning: This certificate will expire in 30 day(s)"

Does anyone have any tips as to how I can check if letting this expire impacts us or not? Has anyone else seen this?

Hi Team, 

 

How can we get the lat and long of a current address automatically by using apex code.

 

Do we have any standard methods to retrieve those valuse.

 

Thanks,

Anil

I have Account object, Policy custom object and Receipt custom object. The relationships between these are:

 

Account 1:N Policy

Policy 1:N Receipt

 

I have a formula field called 'Account' on Receipt which displays the Name field of the Account related to the Policy in question. Somehow the following formula field:

MyApp__Policy__r.MyApp__.Name

is only working for regular Accounts not Personal Accounts.

I could edit the formula to something like:

 

IF(MyApp__Policy__r.MyApp__Account__r.IsPersonAccount, 
 MyApp__Policy__r.MyApp__Account__r.LastName & ' ' &  MyApp__Policy__r.MyApp__Account__r.FirstName, 
MyApp__Policy__r.MyApp__Account__r.Name)

But it seems to be a lame solution. Anybody knows the reason why this formula doesn't work for Personal Accounts?

Hi

 

I wrote a visualforce page and what I thought was a cool chunk of javascript which, when executed, copies values in the page from some inputfields to others (without updating the record—user can still save or cancel). It works fine except in the case of two fields which are a controller/dependent picklist pair. Boiled right down, the problem code is here:

 

document.getElementById(DestContPListID).value = document.getElementById(SourceContPListID).value;
document.getElementById(DestDepdPListID).value = document.getElementById(SourceDepdPListID).value;

 

The first line populates the controller picklist correctly but despite the second line the dependent picklist does not gain a value (most of the time). The reason seems to be that after I set the Controller picklist value (eg Tea) the dependent picklist does not show the possible values (eg English Breakfast, Earl Grey, Oolong, etc) and even when the code attempts to set it to one of these allowed values the field remains blank.

 

Note, I have tried manually setting the Controller Picklist to the desired value first (ie Tea) and then the dependent displays the possible values. If I run the script afterwards, it works fine. I assume I need something like this:

 

document.getElementById(DestContPListID).value = document.getElementById(SourceContPListID).value;
document.getElementById(SourceContPListID).systemMethodWhichKicksTheStandardControllerIntoActionToUpdateElementsOnPage;
...

 Or may be not. 

 

BTW, I am using "pure" javascript. Haven't venture into using the AJAX Toolkit yet but willing to try if it is the solution here.

 

Thanks for any help.

 

Regards

MellowRen

 

Hi,

I am accessing custom setting values in my apex code and its working fine. When I am calling it through test class then No values gets in from Custom Setting. It always blank in test class. Can somebody help me to understand why custom settings values are not accessible in test class.

 

Thanks,

Vinod Kumar

I'm trying to use ISPICKVAL to conditionally render part of my visualforce page. I want to show a pageBlockSectionItem if the value of Asset_Type__c is "Publications". Here is my code:

 

<apex:inputField required="true" value="{!Digital_Asset__c.Asset_Type__c}" />
<apex:pageBlockSectionItem rendered="{!ISPICKVAL(Asset_Type__c, 'Publications')}"><apex:inputField required="true" value="{!Digital_Asset__c.Publication_Title__c}" /></apex:pageBlockSectionItem>

 

 

The error I'm getting is:

Error: Unknown property 'Digital_Asset__cStandardController.Asset_Type__c' 

 

I've also tried using {!ISPICKVAL(Digital_Asset__c.Asset_Type__c, 'Publications')} in the rendered block, but then I get: Error: Incorrect parameter for function 'ISPICKVAL()'. Expected Picklist, received Text.

 

What am I missing here?

Hi,

 

I have my accounts related on a way that one parent Account is pointed by its daughters with the field ParentId.

 

I need to do a trigger that when the parent account is modified in the field Recovery_actions__C(is a checkfield), this change has to go to the daughters accounts.

 

This is my trigger:

 

trigger UpdateCierrePorRecobro on Account (beforeupdate) {

 

Set<Id> addAccountsActivate = newSet<Id>();

Set<Id> addAccountsDeactivate = newSet<Id>();

 

//Aislo los id's

 

for(integer i=0;i<Trigger.new.size();i++){

//If the value has changed add to the list

if ((Trigger.new[i].Recovery_Actions__c!=Trigger.old[i].Recovery_Actions__c)) { 

if (trigger.new[i].recovery_actions__c){//changed to true

addAccountsActivate.add(Trigger.new[i].id);

}

else{//changed to false

addAccountsDeactivate.add(Trigger.new[i].id);

}

}

}

if(addAccountsActivate.size()>0){

 

//create a list of ids with the daughter ids of the main account

//????????????????????????????????????????

List<id> listaToTrue=newList<id>();

listaParaActivar.add([select id fromAccountwhereParentId in:addAccountsActivate]);

//????????????????????????????????????????????

 

Accountacc;

 

//and update the value

for(integer j=0;j<listaToTrue.size();j++){

acc.id=listaParaActivar[j];

acc.Reacovery_Actions__c=1;

updateacc;

}

}

 

}

 

 

---------------------------------------

 

I have the problem in the part where I query in order to get the ids of the daughter accounts, I dont know how to get that list of ids.

 

Anyone could help here?

 

Thanks,

Antonio

Hi,

 

   I am working on one workflow which sends out some notfication email to user depending on some data from opportunity.

 

   One of the triggering rule is ...the Opportunity Amount > 15000 USD.

   Since the currency in the opportunity varies, it could be USD or maybe not.

   How can i conver the Opportunity Amount in other currency into USD by using formula?...