• Alain Cabon
  • ALL STAR
  • 12631 Points
  • Member since 2016

  • Chatter
    Feed
  • 393
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 2474
    Replies
Hi All,

Here I have a Batch Apex class which uses an API to get some random contacts. This all works perfectly fine and I am happy with it,

I wanted to trigger this with a user input via a LWC. I created BatchCreateContactController to do this.

Calling BatchCreateContactController from the Developer sonsole works, but my LWC won't call it. I suspect it is something to do with the LWC JS file. Unsure.

I am getting an error when I run CLI commands after creating a project: Cannot read property 'getInstance' of undefined

 

I am suddenly unable to do any CLI commands with both existing and new projects. The only thing I can do is create the initial project. Everything else gives me this error.

 

Here's the error in the console:

 

console.ts:137 [Extension Host] {
"status": 1,
"name": "TypeError",
"message": "Cannot read property 'getInstance' of undefined",
"exitCode": 1,
"commandName": "ConfigGetCommand",
"stack": "TypeError: Cannot read property 'getInstance' of undefined\n at ConfigGetCommand.hooksFromLifecycleEvent (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:401:44)\n at ConfigGetCommand.init (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:248:20)\n at async ConfigGetCommand._run (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:92:13)\n at async Config.runCommand (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/config/lib/config.js:172:9)\n at async Main.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/main.js:22:9)\n at async Main._run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/command.js:43:20)\n at async Object.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/dist/cli.js:32:20)\nOuter stack:\n at Function.wrap (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/core/lib/sfdxError.js:151:27)\n at ConfigGetCommand.catch (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:247:46)\n at async ConfigGetCommand._run (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:97:13)\n at async Config.runCommand (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/config/lib/config.js:172:9)\n at async Main.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/main.js:22:9)\n at async Main._run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/command.js:43:20)\n at async Object.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/dist/cli.js:32:20)",
"warnings": []
}

 

Does anyone know how I can fix this?

Hello,

I'm able to query the Metadata API with JSforce and my credentials.

I would like to run it in a cron on a web server.
Is there a way to generate a access key (like on aws) so that I don't need to put my username/password on the server?

Thx
Baptiste
experts ,
I have two date time field values 

submitted date =date time
released date=date time
total time field is formula return type is number .

for total time i have put like below 
released date - submitted date 

now result is showing only on days .
i want result should show days ,hours ,minutes 

can some one guide if we can do ?
like result is showing 27.56 days 
i want it to be 27 days 12 hours and 86 minutes something like this
 
Hi, I'm trying to create an LWC that displays a datatable of records from a custom obect called Match__c. I want to display the record Id, the participant, and volunteer fields in the datatable where the field volunteer job on the Match record equals the record id of the page being viewed. I created an apex controller to pull the data. The table will not display any data even though I have permissions to the object/fields. On load the console displays "DevTools Failed to Load Source Map". Here are some pictures: 

Apex Controller
User-added imageJS
User-added imageHTML
User-added imageComponent
User-added image
Any help would be appreciated. This is my first LWC.
Hello
I'm trying to get the Week Number into a new custom field.  I need to calculate the week number from a standard Field Service Lightning field named "SchedStartTime".  The data type for this field is Date/Time.  I created a custom formula field to capture only the date from the SchedStartTime field named "Scheduled Start Date" with the formula: DATEVALUE(SchedStartTime ).  I then created another custom field named "Week Number" with the formula: MOD (FLOOR (( Scheduled_Start_Date__c - DATE(2019,12,30) + (1/24) ) / 7),53)+1.  However, there are errors when the Scheduled Start is midnight (00:00), the Week Number should update to the next week number but this isn't happening until the Scheduled Start is 01:00.  See example below:

Scheduled Start     Week Number
14/06/2020 23:00          24
14/06/2020 23:30          24
15/06/2020 00:00          24
15/06/2020 00:30          24
15/06/2020 01:00          25

Can anyone provide help please?  Note that our Org has the Default Time Zone(GMT+01:00) British Summer Time (Europe/London).

I have an interesting use case. We are using Salesforce's Embedded Chat service, but it needs to also be able to open by the click of a button located somewhere on the page.

This means it opens in two ways:

1. The standard way (clicking the embedded chat in the bottom right of the screen)

2. A separate button on the page that should open that same embedded chat

 

I already know that using Chat Buttons and Embedded Chat on the same page is not compatible with Salesforce. However, is it possible to lauch the Embedded Chat with a button click? Essentially, we just need two ways to launch the embedded chat: button click on page, and standard way

Hi -

I have a VF page that generates what we call Route Sheets.  Each one takes 1-2 pages and the whole printout is about 55 pages long.  Each Route starts on a new page.  This is all fine.

The challenge is -- I'd like to include the route name on every page so was thinking of placing it in the page footer.  To accomplish this I'd need to change the footer with each iteration through the loop.

Can that be done?  If not, do you have other suggestions?

Thanks,

Steve

 
<apex:page controller="GenerateRouteSheets" deferLastCommandUntilReady="true" renderAs="PDF" applyBodyTag="false" action="{!loadData}">
	<!-- <apex:page controller="GenerateRouteSheets" deferLastCommandUntilReady="true" renderAs="PDF" applyBodyTag="false" > -->
	<head>
		<style>
			@page{
			size: landscape;
			@bottom-right {
			font-family: 'Arial Unicode MS';
			font-size: 13px;
			content:  "Page " counter(page) " of " counter(pages);
			}
			} 
		</style>
	</head>
	<script>
	    var dt = new Date();
	    document.getElementById("datetime").innerHTML = dt.toLocaleString();
	</script>
	<body>
		<apex:pageBlock >
			<apex:repeat value="{!routes}" var="r">
				<div style="page-break-after:always;  ">
                    Route {!r}
                    ~~ SNIP ~~
                </div>
			</apex:repeat>
		</apex:pageBlock>
	</body>
</apex:page>

 
I need to show a picklist in a visualforce with all the related territories of an user. These territories are the user's assigned territories and all the territories under them in the territory hierarchy. For example, with a hierarchy like this one:
Europe
 |- France
 |- Spain <--
   |- Madrid
   |- Catalunya
     |- Barcelona
 |- Italy
A user assigned to Spain should see Madrid, Catalunya and Barcelona as possible options in the picklist. Right now I achieve this using a recursive function, but in a production org with around 1300  territories, I'm hitting CPU and SOQL limits all the time because I need to execute a SOQL query for every sub territory.

Reading Enterprise Territory Management documentation I cannot find any function provided by Salesforce to achieve this and the object itself doesn't have a named relationship between the parent a its sons that could help me reduce the number of queries. I was looking something like this:
SELECT Id, Name, (SELECT Id, Name FROM ChildTerritory2s) FROM Territory2 WHERE DeveloperName = 'Spain'
Hope someone have some workaround for achieving this without using something as demanding as a recursive function that when it hits the limits doesn't show the end of the list. Thanks.
I've got the following code
 
User u =   [SELECT Id 
            FROM User
            Where Email='admin@***.org'];

for(AggregateResult objAgr : [SELECT   RecordType.Name, SUM(DurationHours__c)
                              FROM     Event 
                              WHERE    OwnerId = :u.Id
                              GROUP BY RecordType.Name])
{
    String label = string.valueof(objAgr.get('RecordType.Name'));
    Double total = double.valueof(objAgr.get('expr0'));
    system.debug(label + ' | ' + total);
}

I get an error when running this from an execute anonymous window that says:

System.SObjectException: Invalid field RecordType.Name for AggregateResult

I am able to use this exact same code for a similar query, except instead of grouping by RecordType.Name, I group by ActivityDate. This works perfectly. So how do I get RecordType.Name results?
Hey guys, there is a text field that I want to restrict so it only accepts 10 digit phone numbers separated by commas. 

So far I have this, but it does not specify how many digits the numbers must be.  So it allows any number of digits separated by commas (i.e. 123,12,1234,12345,etc).  But I want to restrict it to comma separated 10-digit numbers (i.e. 4161231234,6470987657,9051231234,etc…).  I know I need a “{10}” somewhere, but can’t seem to figure out where. 

Your help is greatly appreciated.


AND(
NOT(ISBLANK(Text_Field__c)),
NOT(REGEX(Text_Field__c,"^[0-9,.*]+$"))
)
Hello, I need to query a feeditem's parent's custom field.

Here is so far:
  
            Discharge__c discharge=[Select Id, Name, Date_of_Birth__c from Discharge__c where Id = :this.dis.id];
        
        listofNotes = [SELECT ID, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Parent.Name, Body
                      FROM feeditem 
                      WHERE Parent.Name = :discharge.name ];

I need to add another WHERE clause stating that the Parent (discharge record's) date of birth  is = discharge.date_of_birth__c

Is this possible?
Hi,

Can anyone please help how to cover a test class for this code ?
 
public class GD_CartProductsWrapper {

    @AuraEnabled
    public GD_Cart__c cartItem;
    
    @AuraEnabled
    public List<String> uomPicklist;
    
    @AuraEnabled
    public Map<String,GD_Cart__c> orderLinesByUom;
    
    @AuraEnabled
    public Decimal unitPrice;
    
    @AuraEnabled
    public Decimal totalPrice;
    
    public GD_CartProductsWrapper(){
        cartItem = new GD_Cart__c();
        uomPicklist = new List<String>();
        orderLinesByUom = new Map<String,GD_Cart__c>();
        totalPrice = 0;
    }
}

Regards,
Soundar.​​​​​​​
I'm looking for other/ better ways to implent the code below. 

Use Case: 

I have a custom Project__c object which gets created when an Opportunity becomes Closed Won. If the Opportunity has certain Opportunity Products which have the Hours_Contribute_to_Project__c checkbox set to true, when the Project is created, it will tally all the quantities of these respective Opportunity Products to see how many hours were purchased and input the value within the respective Project record. Project and Opportunity have a lookup relationship. 

Code: 
 The following code works but I'm wondering how to make it more efficient without the SOQL query in the FOR loop. Thanks!
public static void CalculateHoursPurchased(List<Project__c> projectList){
    
    for(Project__c a: projectList){
        
        AggregateResult hoursPurchased = [SELECT SUM(Quantity)
                                          FROM OpportunityLineItem
                                          WHERE Hours_Contribute_to_Project__c = TRUE AND Opportunity.Id = :a.Opportunity__c];
        
        Decimal b = (decimal)hoursPurchased.get('expr0');
        a.Hours_Purchased__c = b;
        
    }
    
}

 
I want to create a table that displays some time slots with a checkbox next to it. At the end of the table, there's a submit button. For the table, I used a Schedule__c object and also declared a Map, with the boolean being the default value for the checkbox.
This is the UI:
UI

This is a part of my VF code:
<apex:form id="results">
            <!-- <apex:outputText rendered="{!availableCourses.size == 0}" value="{!$Label.noResults}" /> -->
            <br/>
            <table style="width:100%">
                <thead>
                    <th>{!$Label.timeSlot}</th>
                    <th>{!$Label.courseStatus}</th>
                    <th>chose</th>
                </thead>
                <tbody>
                    <apex:repeat value="{!availableCourses}" var="result">
                        <apex:param value="{!courseOptions}"/>
                        <tr>
                            <td class="courseTime">
                                <apex:outputText value="{!result.Time__c}"></apex:outputText>
                            </td>
                            <td>test</td>
                            <td><apex:inputCheckbox value="{!courseOptions[result]}"/></td>
                        </tr>
                    </apex:repeat>
                </tbody>
            </table>
            <br/>
        </apex:form>
        <apex:form>
            <apex:commandButton value="{!$Label.submit}" action="{!Submit}" styleClass="btn btn-block" style="margin:0px;">

            </apex:commandButton>
        </apex:form>

This is part of my controller:
This is where I assign the default values to the Map, which has no problems at all.
for(ScheduleSetting__c a: availableCourses){
        courseOptions.put(a, false);
}

This is supposed to be my Submit function. It's not done yet because I'm trying to get the new values for the input checkboxes first.
 
public Pagereference Submit() {
    system.debug('aaa');

    for(ScheduleSetting__c key : courseOptions.keySet()){
        system.debug(courseOptions.get(key));
    }
    return null;
}
The problem is that even though I check the inputCheckBox when Submit gets called, the Map values don't change at all. I just want to be able to change the Map Boolean values depending on whether the checkbox is checked or not.
This is what I get in the Logs:
User-added image
 
Considering the inherent problems with OOP (https://medium.com/@cscalfani/goodbye-object-oriented-programming-a59cda4c0e53), and since Salesforce is always on the cutting edge, is there a universe in which Salesforce would move away from OOP and toward Functional Programing?  

I'm a certified Salesforce professional but still relatively new to writing code. I've been working on learning Apex in order to be able to hold my own as a Salesforce Developer......I'd love to be reassured that I'm not wasting my time learning Object-Oriented Programming.  

Admittedly, my grasp of the two different engineering approaches is very limited so I'm speaking as a newbie :)
Hi Can any one help me,
I have a text field in which i am trying to save alpha numeric and i am trying to limit the range between 0100 to 0555 so the values should save between the range and alpha numeric.i worte a formula like this.                 
  AND(
NOT(REGEX(Text__c,"^[a-zA-Z0-9_]*$")),
OR(
VALUE(Text__c) < 0100,
VALUE(Text__c) > 0555 ) )

So here example am giving AC15 value in the field it is working.
if i give the value 0101 it is saving and if i give it as 1111 it is 
also saving which is not correct.REGEX part is working but not the other part  OR Part.
  • March 26, 2020
  • Like
  • 0

Hi, i need to create event on lead for a test apex.

The EndDateTime (or activityDate) of this event need to be past.

I have create a lead and event on this lead but i can't choose a negative EndDateTime.
How can i do ?

It's possible to set a date time on Start Test for launch the test in the futur? Ty

I'm using an admin account and using an org setup as "Dev Hub".  

When creating the scratch org:

sfdx force:org:create -f project-scratch-def.json -a AbcScratchOrg

I receive this error message: 

ERROR running force:org:create:  We couldn't create this sandbox or scratch org because the associated Dev Hub isn't authorized. Authorize the Dev Hub and try again.

I've ensured the org is indeed configured as Dev Hub and that the admin user in visual studio code is set:

Sfdx force:config:set defaultdevhubusername=<devhubusername> --global

User-added image

Any ideas/help on what might be the issue would be much appreciated.
 
Hi - I'm relatively new to Lightning so I'm not sure where to look for this.

I have a community page that I've built with Builder, and it has a component on it, and a language switcher.  Guests can view the page, and switch between English and French.

There's one particular component that I need to hide when the user's language is French.

How can I do that?

I looked at Audiences but I don't see how I can create an audience based on a guest user's selected language.

There's <aura:renderif> but I don't see how I can apply that to the page I built with Builder.

The component I'm trying to hide is a Contact Support form, so it's fairly complicated inside otherwise I could do in HTML/JavaScript.

Is there an easy way to do this?

Thanks!
 -- Steve
I have 2 object , Test_Sceniario have lookup field to Test_scenario as mentioned in this screen shit : 

LookuprelationshipSELECT Name,Id, (SELECT Prerequisite__c FROM Test_case__c) FROM Test_Scenario__c  , this query doesn't work 

Can you tell me why ?

Rgds,
Firas
Hi,
I am trying to apply an XSLT transformation to an XML file and display the output in div element. Below code works in the local development server. However, if I add this component in any page layout in salesforce, it failed with below error.

TypeError: XSLTProcessor constructor: 'new' is required
import { LightningElement } from 'lwc';
import testXml from '@salesforce/resourceUrl/testXml';
import testXslt from '@salesforce/resourceUrl/testXslt';

export default class MyComponent extends LightningElement {

    renderedCallback() {
        const xsltProcessor = new XSLTProcessor();
        xsltProcessor.importStylesheet(testXslt);
        const result = xsltProcessor.transformToFragment(testXml, document);

        this.template.querySelector('.container').appendChild(result);
    }
}
Any suggestion to make it work in salesforce page/record layout.
 

My question is two-fold :

 

I am trying to call a Class with a Trigger upon the editing of a field value. However, that Class also has a callout, and apparently we cannot be executed when there is an uncommitted transaction. 

Here :

You have uncommitted work pending... (https://help.salesforce.com/articleView?id=000328873&type=1&mode=1)

So, I'm wondering if I am able to call this Class using a 'before update' setting in the trigger. 

If I can do that, I would need to put the necessary code into this already existing trigger for the object : 

trigger Trigger_ProgramContactRole on Program_Contact_Role__c (after insert, after update, before insert, before update ,after delete) {
    //Checking for the event type
    if(Trigger.isAfter){
        
        //Checking for the request type
        if(Trigger.isInsert){
            
            // Update Servicer on contact
            ProgramContactRoleTriggerHelper.updateServicerOnPCR(Trigger.new);
            
        }
        
        //Checking for the request type
        if(Trigger.isUpdate){
            
            // call deleteProgramContactRoleRecors
            ProgramContactRoleTriggerHelper.deleteProgramContactRoleRecors(Trigger.new);
            
        }


That would need to call this Class :

public class UpdateContactPCRController {

    @InvocableMethod
    public static String  updateContact(String recordId){        
       
        String contactId = '';       
        
        List<Contact> contactToBeupdate = new List<Contact>();        
        
        if(String.isNotBlank(recordId)){            
            
            List<Program_Contact_Role__c> programContacList = [SELECT Id,Contact__c,Program_Name__c FROM Program_Contact_Role__c WHERE Id =:recordId AND Contact__c != null];
            contactId = programContacList[0].Contact__c;
            
            if(String.isNotBlank(contactId)){
                
                contactToBeupdate = [Select Id,Pardot_Action_Trigger__c,PCR_Register_Button_Link__c,PCR_URL_for_UI__c FROM Contact Where Id =: contactId Limit 1];                
                
                contactToBeupdate[0].Program_Contact_Role_Id__c = recordId;
            }
                        List<Program_Communication_Recipients__c> programCommunicationRecs = [Select Id,Name,
                                  Program_Communication__r.Program__r.Buyer__r.Name,Receipient__c,                
                                              From Program_Communication_Recipients__c Where 
                                                           Program_Communication__r.Program__c =: programContacList[0].Program_Name__c AND 
                                                           Receipient__c =: programContacList[0].Id];                                           
                                
                
                    contactToBeupdate[0].PCR_Welcome_Message__c = String.valueOf(programCommunicationRecs[0].Program_Communication__r.Welcome_Message__c);                                                    

        if(contactToBeupdate.size() > 0){
            update contactToBeupdate;  
        }
        
        return 'Updated Successfully';
    }
}
    //Calling  Http_Utility_Pardot class pardotCreateProspect method for the creation of Prospect record.
    String returnedResponseFromPardot = Http_Utility_Pardot.pardotCreateProspect(new Set<Id> {contactToBeupdate[0].Id});


The Pardot callout which is causing the error is coming from the last two lines of the class. ​​​​​​​

How can this be incorporated into this trigger - and only done when a field is changed ? 

Thank you very much for any help you can give. 

Hi everyone,

I'm trying to convert a text field with a date like "March 23, 2015" into a date field to read 3/23/2015. 

Any help would be much appreciated!
I am trying to write a trigger to update all the accounts with a shared field (Tax ID number) whenever any of the accounts changes. This is what I have, but am getting an error message Unexpected Token 'TIN'. 

trigger UpdateBusinessAgreement on Account (before update) {
    for (Account a : Trigger.new){
        String TIN = a.Tax_ID_Number__c;
        List<Account> matchingAccounts = [SELECT ID, Business_Agreement_Completed__c, Tax_ID_Number__c FROM Account WHERE Tax_ID_Number__c = TIN];
        if (a.Business_Agreement_Completed__c == 'Received - Complete'){
            for (Account Acc : matchingAccounts){
                Acc.Business_Agreement_Completed__c = 'Received - Complete';
                    }
        }
    }
}
Its seem that you have to go around the barn every which way I turn with SF LWC!  I am trying to do a simple condition check but I don't want to check true to a boolean value such as below.  I want to check a data records field value to a hard-coded value in the HTML file.

<template if:true={mydata.data}>

I want to check the value of the of the data to a hardcoded value like...

<template for:each={mydata.data} for:item="d">
     <div key={d.Message__c}>
         <div if:m.Message_Style__c = "Success">
             <strong>{m.Message__c}</strong>
         </div>
     </div>
</template>


I tried...

<div if:true={m.Message_Style__c} = "Success">

and

<div if:true={m.Message_Style__c} == "Success">

and other variations with no luck.

Just seem like there is so much lacking capability to easily do conditional markup in LWC.  I am really new to LWC and not much on javascript or HTML so that could be some of my issue! :)

What I want to do is have the data on a record control the color theme.  So if a user picks from the picklist "Info" it will use the slds-theme_info, or if the record has "Success" selected in the picklist then the data is displayed using the slds-theme_sucess.

Thanks for your help.
Hi All,

Here I have a Batch Apex class which uses an API to get some random contacts. This all works perfectly fine and I am happy with it,

I wanted to trigger this with a user input via a LWC. I created BatchCreateContactController to do this.

Calling BatchCreateContactController from the Developer sonsole works, but my LWC won't call it. I suspect it is something to do with the LWC JS file. Unsure.

I am getting an error when I run CLI commands after creating a project: Cannot read property 'getInstance' of undefined

 

I am suddenly unable to do any CLI commands with both existing and new projects. The only thing I can do is create the initial project. Everything else gives me this error.

 

Here's the error in the console:

 

console.ts:137 [Extension Host] {
"status": 1,
"name": "TypeError",
"message": "Cannot read property 'getInstance' of undefined",
"exitCode": 1,
"commandName": "ConfigGetCommand",
"stack": "TypeError: Cannot read property 'getInstance' of undefined\n at ConfigGetCommand.hooksFromLifecycleEvent (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:401:44)\n at ConfigGetCommand.init (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:248:20)\n at async ConfigGetCommand._run (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:92:13)\n at async Config.runCommand (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/config/lib/config.js:172:9)\n at async Main.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/main.js:22:9)\n at async Main._run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/command.js:43:20)\n at async Object.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/dist/cli.js:32:20)\nOuter stack:\n at Function.wrap (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/core/lib/sfdxError.js:151:27)\n at ConfigGetCommand.catch (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/dist/ToolbeltCommand.js:247:46)\n at async ConfigGetCommand._run (/Users/alaricwimer/.local/share/sfdx/node_modules/salesforce-alm/node_modules/@salesforce/command/lib/sfdxCommand.js:97:13)\n at async Config.runCommand (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/config/lib/config.js:172:9)\n at async Main.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/main.js:22:9)\n at async Main._run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/node_modules/@oclif/command/lib/command.js:43:20)\n at async Object.run (/Users/alaricwimer/.local/share/sfdx/client/7.69.0-c7be45ae22/dist/cli.js:32:20)",
"warnings": []
}

 

Does anyone know how I can fix this?

Hello. 
I want to use Apex trigger and Apex class to add records to the record that was just inserted 

trigger CreatePropSet on Propulsion__c (after insert) {
    PropulsionSet.addPropSet();
}

PropulsionSet consists of the propulsion parts. 

in JavaScript I would create and object that I used as a template, in C/C++ - struct. What shall I use in Apex? Where to keep not changing data? in the same class PropulsionSet? 
 
---------------------js file-----------------------------
import { LightningElement, track } from 'lwc';
import getOppList from '@salesforce/apex/customSearchController.getOppList';
import {ShowToastEvent} from 'lightning/platformShowToastEvent'
export default class CustomSearch extends LightningElement {
    @track opportunity;
    sVal='';
    receivedMessage;
    @track record = [];
    @track columns=[
        {label: 'Name', fieldName: 'Name',type: 'url', 
        typeAttributes: { 
            label: {
                fieldName: 'Name'
            } 
        },
        sortable: true },
          {label: 'Account Name', fieldName: 'AccountId',type: 'url', 
        typeAttributes: { 
            label: {
                fieldName: 'AccountId.Name'
            } 
        }, 
        sortable: true},
        {label: 'Stage Name', fieldName: 'StageName',type: 'picklist'},
        {label: 'Type', fieldName: 'Type',type: 'picklist'},
        {label: 'Amount', fieldName: 'Amount',type: 'currency'},
        {label:'Action',type:'button',typeAttributes: {
            label: 'Send Opp',
            name: 'Send',
            disabled: false,
            value: 'send',
            iconPosition: 'left'
        }
    }
    ];
    // update sVal var when input field value change
    updateSeachKey(event) {
        this.sVal = event.target.value;
    }
 
    // call apex method on button click 
    handleSearch() {
        // if search input value is not blank then call apex method, else display error msg 
        if (this.sVal !== '') {
            getOppList({
                    searchKey: this.sVal
                })
                .then(result => {
                    // set @track opportunities variable with return contact list from server  
                    this.opportunity = result;
                })
                .catch(error => {
                    // display server exception in toast msg 
                    const event = new ShowToastEvent({
                        title: 'Error',
                        variant: 'error',
                        message: error.body.message,
                    });
                    this.dispatchEvent(event);
                    // reset contacts var with null   
                    this.opportunity = null;
                });
        } else {
            // fire toast event if input field is blank
            const event = new ShowToastEvent({
                variant: 'error',
                message: 'Search text missing..',
            });
            this.dispatchEvent(event);
        }
    }
    handleRowAction(event){
        const row = event.detail.row;
        let actionName = event.detail.action.name;
        switch(actionName) {
            case 'Send':
            this.record = row;
            const calloutURI = 'https://herokuapp.com';
            fetch(calloutURI, {
                method: "POST",
                headers: {
                    "Accept": "application/json"
                  },
                  body:  JSON.stringify(record)
            })
            .then((response) => {
                       return response.json(); 
                })
                .then(responseJSON => {
                    console.log(responseJSON);
                    console.log(record);
                })
                .catch(error => {
                    const event = new ShowToastEvent({
                        title: 'Error',
                        variant: 'error',
                        message: error.body.message,
                    });
                    this.dispatchEvent(event);
                });
        }
    }
}
-------------------html file---------------------------
<template>
   <div class="slds-m-around_medium">
     
        <div class="slds-m-bottom_small">
            <lightning-input type="text"
               value={sVal}
               label="Search Opportunity"
               onchange={updateSeachKey}
               ></lightning-input>
         </div>
         
         <lightning-button label="Search"
            onclick={handleSearch}
            variant="brand"></lightning-button>
            
            <lightning-datatable data={opportunity} columns={columns} key-field="id" onrowaction={handleRowAction}>
            </lightning-datatable>
</div>This is the error i am getting and after making changes also it shows the same thing.
</template>
Hi guys,
We just created a library named R.apex, which helps simplify the common tasks in apex code development by adopting a functional style.
It offers tons of utility functions to work with lists, sets, maps and sobjects, making apex code clean and readable. We were suffering from the pain points of writing similar Apex code to complete trivial tasks once and once again, and that is the reason why we want to stop that and start to write reusable code. Here are some examples of what R.apex can do:
 
// Reverse a list
List<Integer> reversedList = R.of(new List<Integer>{ 1, 2, 3 })
    .reverse()
    .toIntegerList();
 
// Fina specific account
List<Account> accountList = ...;
Account acc = (Account)R.of(accountList)
    .find(R.whereEq.apply(new Map<String, Object>{
        'LastName' => 'Wilson',
        'IsDeleted' => false
    }))
    .toSObject();

Hopefully R.apex can help make your Apex code development easier, and you are always welcome to give feedback so that we can improve it.

R.apex is an open source project hosted at https://github.com/Click-to-Cloud/R.apex/.
You can check it out. Feel free to clone it, make changes or submit a PR.

^_^

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.