• Frederick H Lane
  • NEWBIE
  • 75 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 29
    Replies
In the CLI, I am getting the rror message "The "path" argument must be of type string. Received type undefined"
My path is;
C:Local Disc/Users/User/LWCSession/force-app
I've created my project(LWCSessions), authorised my Dev Org, created my Scatch Org and now want to build a component HelloAimitTraineesUser-added imageUser-added image. So, I created one but, it only creates .cmp  and .auradoc  folders as per the screenshot. I notices when I created the Lightning component, taht the folder mapping automatically maps to an Aura sub-folder which is, what I suspect is causing the problem. But how do a change the mapping to, for example, LWCSessions -> force-app -> main - default -> lwc?
Also, if I simply create 2 folders for .html and .js, is that sufficient?
Hello ,I was trying to push lightning web component from VS Code.I am using command "SFDX: Push Source to Default Scratch Org" ,but everytime i am getting error ,sfdx force:source:push PROJECT PATH  ERROR N/A Not available for deploy for this API version. 
Any suggestion will be highly appretiated .
Thanks in Advance
I have the following error message;

"We couldn't find an attribute boat of type Boat__c on the AddBoatReview component."

My code is;
BoatReviews.cmp
view sourceprint?
01BoatReviews.cmp
02 
03<aura:componentimplements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId"access="global"
04                controller="BoatReviews">
05     
06     <aura:attribute name="boat" type="Boat__c" access="public"/>
07    <aura:handler name="change" value="{!v.boat}" action="{!c.refresh}"/>
08    <aura:attribute name="boatReviews" type="BoatReview__c[]" access="private"/>
09    <!-- set up the aura:method for refresh -->
10    <aura:method name="refresh" action="{!c.doInit}" access="public"
11                 description="BoatDetailsController.js invokes refresh whenever boat is updated">
12    </aura:method>
13      
14    <ui:scrollerWrapper class="scrollerSize">
15        <!--Scrollable content here -->
16        <aura:if isTrue="{!v.boatReviews.length==0}">
17            <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto"padding="around-small">  
18                <ui:outputText value="No Reviews Available" />
19            </lightning:layoutItem>
20        </aura:if>
21        <div class="slds-feed">
22            <ul class="slds-feed__list">
23                <aura:iteration items="{!v.boatReviews}" var="boatReview">
24                    <li class="slds-feed__item">
25                        <div class="slds-media__body">
26                       <div class="slds-grid slds-has-flexi-truncate">
27                            <a href="javascript:void(0)" onclick="{!c.onUserInfoClick}"
28          data-userid="{!boatReview.CreatedBy.Id}">
29          {!boatReview.CreatedBy.Name}
30      </a>
31                        &nbsp; &mdash; &nbsp; {!boatReview.CreatedBy.CompanyName}
32   </div>
33                         <p><lightning:formattedDateTime value="{!boatReview.CreatedDate}"
34                                   year="numeric" month="short" day="numeric" 
35                                   hour="2-digit" minute="2-digit" hour12="true"/></p>
36                        </div>
37                    </li>
38                </aura:iteration>
39            </ul>
40        </div>
41    </ui:scrollerWrapper>
42     
43     
44</aura:component>
 
01BoatReviewsController.js
02({
03    refresh : function(component,event,helper){
04        console.log("refresh called")
05        this.doInit;
06    },
07    doInit : function(component,event,helper){
08        console.log("BRCjs: doInit");
09        helper.onInit(component, event);
10    },
11    onUserInfoClick : function(component,event,helper){
12        var userId = event.currentTarget.getAttribute("data-userid");
13        var navEvt = $A.get("e.force:navigateToSObject");
14        navEvt.setParams({
15            "recordId" : userId,
16        });
17        navEvt.fire()
18 
19    },
20})
 
01BoatReviewsHelper.js
02({
03    onInit : function(component, event){
04                var boat = component.get("v.boat");
05                console.log("BRHjs:onInit started: boatId is " + boat.Id);
06                var action = component.get("c.getAll");
07                action.setParams({"boatId" : boat.Id});
08                console.log("boatId: " + boat.Id);
09 
10                //add the callback behavior for when the response is received
11                action.setCallback(this,function(response){
12                    var state = response.getState();
13                    if (state === "SUCCESS"){
14                        component.set("v.boatReviews", response.getReturnValue());
15                        console.log("APEX success");
16                        }
17                        else {
18                        console.log("Failed with state: " + state);
19                        }
20                });
21                //send action off to be executed in APEX
22                $A.enqueueAction(action);
23    },
24})
 
1BoatSelected.evt
2<aura:event type="APPLICATION" description="BoatSelected fired from BoatTileController's onBoatClick handler">
3    <aura:attribute name="boat" type="Boat__c"/>
4</aura:event>
 
I'm getting an error; " 
The BoatSearchResults controller must have an onBoatSelect function that stores the boatId in the component’s selectedBoatId attribute."
Here's my code;
BoatSelect.evt
<aura:event type="COMPONENT" description="fires when a user clicks a boat on BoatSearchResults.cmp">
    <aura:attribute name="BoatId" type="Id"/>
</aura:event>
BoatTile.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >

              <aura:attribute name="boat" type="Boat__c" />

    <aura:attribute name="selected" type="Boolean" default="false" />



    <aura:registerEvent name="BoatSelect" type="c:BoatSelect"/>

   

    <lightning:button name="{!v.boat.Id}" class="{!v.selected? 'tile selected' : 'tile'}"
                       onclick="{!c.onBoatClick}" >
        <div style="{! 'background-image:url(\'' + v.boat.Picture__c + '\'); '}" class="innertile">
          <div class="lower-third">
           <h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
          </div>
        </div>
    </lightning:button>
</aura:component>
BoatTile.css
.THIS {
}

.THIS.tile {
    position:relative;
    display: inline-block;
    width: 100%;
    height: 220px;
    padding: 1px !important;
}

.THIS .innertile {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 100%;
}

.THIS .lower-third {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: #FFFFFF;
    background-color: rgba(0, 0, 0, .4);
    padding: 6px 8px;
}

.THIS.selected {
    border: 3px solid rgb(0, 112, 210);
}

BoatSearchResults.aspx
public with sharing class BoatSearchResults  {
    @AuraEnabled
     public static List <Boat__c> getBoats(String boatTypeId) {
      if(boatTypeId != '')  {
             return [SELECT id, BoatType__c, picture__c, name,contact__r.Name
                    FROM Boat__c
                    WHERE BoatType__c =:boatTypeId];
      } else {
          return [SELECT id, BoatType__c, picture__c, name,contact__r.Name
                    FROM Boat__c];
      }
         }
         }

BoatSearchResults.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes"
                access="global" controller="BoatSearchResults">
    <aura:handler name="init" action="{!c.doSearch}" value="{!this}"/>
    <aura:attribute name="boatTypeId" type="String" />
    <aura:attribute name="boats" type="Boat__c[]" />
    <aura:handler name="BoatSelect" event="c:BoatSelect" action="{!c.onBoatSelect}"/>
     <aura:attribute name="selectedBoatId" type="Id"/>

    <lightning:layout multipleRows="true" >

        <aura:iteration items="{!v.boats}" var="boat">
            <lightning:layoutItem  padding="around-small">
                <c:BoatTile boat="{!boat}"
                            selected="{!boat.Id == v.selectedBoatId ? 'true' : 'false' }"/>
            </lightning:layoutItem>
        </aura:iteration>

        <aura:if isTrue="{!v.boats.length==0}">
            <lightning:layoutItem class="slds-align_absolute-center" flexibility="auto" padding="around-small">
                <ui:outputText value="No boats found" />
            </lightning:layoutItem>
        </aura:if>

    </lightning:layout>
</aura:component>

BoatTileController.js
({
    onBoatClick : function(component, event, helper) {
        var cmpEvent = component.getEvent("BoatSelect");
        var boatId = event.getSource().get("v.name");
        cmpEvent.setParams({
            "boatId" : boatId
        });
        cmpEvent.fire();
    }
})

BoatSearchResultsController.js
({
 doSearch : function(component, event, helper) {
  alert(component.get("v.boatTypeId")); //<---here I am getting undefined
        helper.onSearch(component); //calling helper method
 },
     search: function(component, event, helper){
        var params = event.getParam('arguments');
        alert(params.boatTypeId); //<---getting proper value
        alert(component.set("v.boatTypeId", params.boatTypeId)); //<---here I am getting undefined
        var a = component.get('c.doSearch');
        $A.enqueueAction(a);
    }
})

BoatSearchResultsHelper.js
({
    onSearch : function(component, event) {
        var boatTypId = component.get("v.boatTypeId");
        alert(boatTypId); //<---here I am getting undefined
        console.log("boatTypId--> " + boatTypId);
        var action = component.get("c.getBoats");
        action.setParams({boatTypeId:boatTypId});

        //add the callback behavior for when the response is received
        action.setCallback(this, function(response){
            var state = response.getState();
            console.log("state " + state);
            if(state === "SUCCESS"){
                var res = response.getReturnValue();
                component.set("v.boats", res);
                //console.log("v.boats ->"+ JSON.stringify(res));
            }
            else{
                console.log("Failed with state: " + state);
            }
        });

        //send action off to be executed
        $A.enqueueAction(action);
    },
})
BoatSearchResultsHelper.js
({
    onSearch : function(component) {
        var action = component.get("c.getBoats");
        action.setParam({"boatTypeId":""});
        action.setCallback(this, function(response){
        var status = response.getState();
            if(status === "SUCCESS"){
             if(! $A.util.isEmpty(response.getReturnValue())){
                    component.set("v.boatTypeId",response.getReturnValue());
                } else {
                     component.set("v.recordError","No boats found");
                }
            }
        });
        $A.enqueueAction(action);
    }
})
 
I am still a little unsure what I'm doing despite passing Step 2 of the challenge.
Because, when I created my Lightning Page, only the Boat Search and BoatSearchFrom apps are visible to select. And then when I select them, I get an error message on the page as per screenshot.
The overall process I followed was;
Create or populate the FriendswithBoats.app, BoatSearchForm.cmp, BpatSearchResults.cmp, BoatSearch.cmp. Create a Lightning Page ' Friends With Boats' and drop these components in. Create a tab from the new page and finally, create a Lightning App called FriendswithBoats.app. Noting also, that the BoatSearchForm.cmp requires a dropdown menu(Boat Type), Search box and 'New' button.
But! I'm confused about the bundles which were automatically created through the unmanaged installed package. Should there not have been included; BoatSearchApp.app, BoatSearchFormApp.app and BoatSearchResultsApp.app for each of the bundles. Because, I had to create those. However, i noticed that, in the FriendswithBoats.app, the BoatSearch component is wrapped in there?

FriendswithBoats.app
<aura:application extends="force:slds" >
    <lightning:layout >
    <div class="slds-grid slds-gutters">
          <div class="slds-col slds-size_2-of-3">
            <c:BoatSearch/>
          </div>
          <div class="slds-col slds-size_1-of-3">
            <span></span>
          </div>
    </div>
      </lightning:layout>
</aura:application>

BoatSearchFormApp.app
<aura:application >
    <c.BoatSearchForm />
</aura:application>

BoatSearchResultsApp.app
<aura:application >
    <c:BoatSearchResults />
</aura:application>

BoatSearchApp.app
<aura:application >
    <c:BoatSearch />
</aura:application>

User-added image
I can't get my SOAP UI to accept the logon.
I've followed the instructions as;
You generate the wsdl for the playgorund.
Copy the username from the settings. i.e fredericklanesquash@curious-goat-486834.com
Requested a new security token from this playgorund
So, it won't accept therefore, I get no session ID

My Request1 Session URL is;  https://login.salesforce.com/services/Soap/c/43.0
My script is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>fredericklanesquash@curious-goat-486834.com</urn:username>
         <urn:password>PasswordxxxxSecurityTokenxxxxx</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

Error is;
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>sf:INVALID_LOGIN</faultcode>
         <faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring>
         <detail>
            <sf:LoginFault xsi:type="sf:LoginFault">
               <sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode>
               <sf:exceptionMessage>Invalid username, password, security token; or user locked out.</sf:exceptionMessage>
            </sf:LoginFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>
I'm getting the following error;
"Challenge Not yet complete... here's what's wrong: 
Inserting a new Maintenance Request of type 'Routine Maintenance' and then closing it did not create of a new Maintenance Request based upon the original record correctly. The challenge is expecting to find the closed Maintenance Request plus an 'New' Maintenance Request of type 'Routine Maintenance' with the same Vehicle as the closed one."
I have had a look at the forum links you provided in a previous post but it's not resolving.

I have added 'Routine Maintenance' and 'Repair' in Case field Type. (Why should this be needed and this type is inconsistent with the other picklist types e.g Electrical, Structural etc)
I also include a filed 'Old Case' to store the Case ID once closed. The challenge is to automate through writing the trigger and the helkper class right? No test class is required at this stage?
Here is my code;
___________________________________________________________
trigger MaintenanceRequest on Case (before update, after update) {  
    List<case>ClosedCaseList = [SELECT Id, subject,Reason, Vehicle__c, vehicle__r.Name, equipment__c,type 
                                FROM Case WHERE Id IN :Trigger.New 
                                AND (status = 'closed' AND (type = 'Repair' OR type = 'Routine Maintenance'))];   
    Map<Id, Case>CasesToConsider = new Map<Id, Case>();
    for(Case c: ClosedCaseList){
        Boolean alreadyClosed = Trigger.oldMap.get(c.Id).Status.equals('Closed') ;
        if(!alreadyClosed)
        {
            CasesToConsider.put(c.id, c);
        }
    }
    
    List<Work_Part__c> allWorkParts = [SELECT ID, Equipment__c, Maintenance_Request__c, 
                Quantity__c, Equipment__r.Maintenance_Cycle__c FROM Work_Part__c 
                WHERE Maintenance_Request__c in: CasesToConsider.keySet()];
    
    MaintenanceRequestHelper.updateWorkOrders(CasesToConsider, allWorkParts);       
}

___________________________________________________________
public class MaintenanceRequestHelper {
    
    public static void updateWorkOrders(List<Case> maintenanceRequests){

        Set<Case> targetRequests = new Set<Case>();
        for (Case mr : maintenanceRequests)
            if (('Repair' == mr.Type || 'Routine Maintenance' == mr.Type) && 'Closed' == mr.Status)
                targetRequests.add(mr);

        List<AggregateResult> results = [
            SELECT Maintenance_Request__c, MIN(Equipment__r.Maintenance_Cycle__c)
            FROM Work_Part__c
            WHERE Maintenance_Request__c IN :targetRequests
            GROUP BY Maintenance_Request__c
        ];

        Map<Id, Integer> requestToMinCycle = new Map<Id, Integer>();
        for (AggregateResult ar : results)
            requestToMinCycle.put(
                (Id)ar.get('Maintenance_Request__c'),
                ((Double)ar.get('expr0')).intValue()
            );

        List<Case> workOrders = new List<Case>();
        for (Case t : targetRequests)
            if (('Repair' == t.Type || 'Routine Maintenance' == t.Type) && 'Closed' == t.Status)
                workOrders.add(new Case(
                    Vehicle__c=t.Vehicle__c,
                    Type='Routine Maintenance',
                    Subject=t.Subject,
                    Status='New',
                    Date_Reported__c=Date.today(),
                    Date_Due__c=Date.today().addDays(requestToMinCycle.get(t.Id))
                ));
        
        if (!workOrders.isEmpty())
            insert workOrders;
    } 
}
Error: Step not yet complete... here's what's wrong:
There was an issue processing your verification. Please refresh the page and try again.User-added image
I am using dev org (not any trailhead ground).
Please let me know howto fix this.

Thanks
My error message on this challenge is; "Challenge Not yet complete... here's what's wrong: 
Could not find at least 500 Account records with the Name like 'Bulk Company'."

My steps are;
1. Import the account records and save in csv format
2. Logged into workbench and linked to my dev org
3. In REST explorer I uploaded the job
     HTTP method POST
    URI textbox:  /services/data/v41.0/jobs/ingest  (also tried API version 42)
    Request header text;
Content-Type: application/json; charset=UTF-8
Accept: application/json
    Request body text; 
{
"operation" : "insert",
"object" : "Account",
"contentType" : "CSV",
"lineEnding" : "CRLF"
}
4. Execute
5. Note the job ID
6. Add the data to the job;
 HTTP method PUT
    URI textbox:  /services/data/v41.0/jobs/ingest/7500O00000Bo5AUQAZ/batches
    Request header text;
Content-Type: text/csv
Accept: application/json
    Request body text; 
"Name" "Sample Bulk API Account 1"
"Sample Bulk API Account 2"
"Sample Bulk API Account 3"
"Sample Bulk API Account 4"
    etc until 500
7. Execute
8. Close the job
 HTTP method PATCH
    URI textbox:  /services/data/v41.0/jobs/ingest/7500O00000Bo5AUQAZ
    Request header text;
Content-Type: application/json; charset=UTF-8
Accept: application/json
Body text;
{
"state" : "UploadComplete"
}
9. Execute

Check the challenge
 



 
can anyone help me solving the Second step for Lightning Component Framework Specialist super badge.. I struck in that badge.
I'm trying to complete the Handle Record Changes and Errors module but can't seem to get past the following challenge error:
Challenge Not yet complete... here's what's wrong: 
The 'accEdit' Lightning Component JS Controller does not appear to be setting 'v.recordSaveError' with an error message.

.I've tried many different combinations of sets and am not having much luck.

I've tried several different component.set methods such as this one:
component.set('v.recordSaveError','Error: ' + saveResult.state + ', message: ' + JSON.stringify(saveResult.error));

Any ideas what this module is looking for as a valid solution?

I do see recordSaveError display after being set due to an error.

Thanks.
 
Hi,
I'm attempting the following module, where you need to install an unmanaged package.
https://trailhead.salesforce.com/modules/lightning_app_builder/units/lightning_app_builder_custom_comps 
I have followed the following help article's steps exactly
https://force.desk.com/customer/portal/articles/2710899-installing-a-package-or-app-to-complete-a-trailhead-challenge?b_id=13478

However, the unmanaged package is still being installed to my overall Salesforce instance, NOT to my "Trailhead Playground".

Given the challenge checks against the Playground, it is impossible currently to complete the challenge.
Is this a common problem & if so how do I solve it?
Thanks,
Matt