• Anoop Bhaskaran 5
  • NEWBIE
  • 40 Points
  • Member since 2015

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Hi, Everyone 

Im working on this badge Lightning Data Service Basics, In the last unit i am getting an error when a check the challenge ("Challenge Not yet complete... here's what's wrong: The 'accEdit' Lightning Component does not appear to be checking if 'v.recordSaveError' is true."), i have done the code according to the trailhead, and it is working.
Any idea, what am i doing wrong?

Component 
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId"> <!--inherit recordId attribute-->

<aura:attribute name="record" type="Object" />
<aura:attribute name="accountRecord" type="Object" />
<aura:attribute name="recordSaveError" type="String" default="" />

<force:recordData aura:id="recordEditor"
    layoutType="FULL"
    recordId="{!v.recordId}"
    fields="Name"
    targetError="{!v.recordSaveError}"
    targetRecord="{!v.record}"
    targetFields="{!v.accountRecord}"
    mode="EDIT" />

    <!-- Display an editing form -->
    <div class="Record Details">
        <lightning:card iconName="action:edit" title="Edit Account">
            <div class="slds-p-horizontal--small">
                <lightning:input label="Account Name" value="{!v.accountRecord.Name}"/>
                <br/>
                <lightning:button label="Save Account" variant="brand" onclick="{!c.handleSaveRecord}" />
            </div>
        </lightning:card>
    </div>
  
 <!-- Display error message -->
    <aura:if isTrue="{!not(empty(v.recordSaveError))}">
        <div class="recordSaveError">
           {!v.recordSaveError}
        </div>
    </aura:if>
</aura:component>

---------------------------
controller.js

({
    handleSaveRecord: function(component, event, helper) {
        component.find("recordEditor").saveRecord($A.getCallback(function(saveResult) {
            if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                console.log("Save completed successfully.");
            } else if (saveResult.state === "INCOMPLETE") {
                console.log("User is offline, device doesn't support drafts.");
            } else if (saveResult.state === "ERROR") {
              
            var errMsg = "";
                // saveResult.error is an array of errors,
                // so collect all errors into one message
                for (var i = 0; i < saveResult.error.length; i++) {
                    errMsg += saveResult.error[i].message + "\n";
                }
                console.log('ERROR---'+errMsg)
                component.set("v.recordSaveError", errMsg);

            } else {
                component.set("v.recordSaveError", "");
            }
        }));}
})




 
Need to create a community and I was going the through the Ssalesforce document on community setup and manage communties. Confused on selecting community template. I don't see any big difference btween Customer Service, Partner Central and Customer Account Portal. 
I need a community which should be accessable for both Customers(Case, Assests, Account) and Partners (Cases, assests, opportunity )

Any advise ?

 
Hi All, How can I deploy one community page to production.

I create a new page in community I just need to deploy this page alone


Anoop



 
I was able to connect AWS API Gateway using named credentails from my SFDC instance and invoke and API sucessfully. Grant type is client_credentials and AWS informed me that they have token expiry for 1 hr and  need to refresh it using refresh token and which need to handle from Salesforce. I am not sure how it works this with Named Credentails. Appreciated your help.
  • May 25, 2022
  • Like
  • 0
Hi All, How can I deploy one community page to production.

I create a new page in community I just need to deploy this page alone


Anoop



 
Hi, Everyone 

Im working on this badge Lightning Data Service Basics, In the last unit i am getting an error when a check the challenge ("Challenge Not yet complete... here's what's wrong: The 'accEdit' Lightning Component does not appear to be checking if 'v.recordSaveError' is true."), i have done the code according to the trailhead, and it is working.
Any idea, what am i doing wrong?

Component 
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId"> <!--inherit recordId attribute-->

<aura:attribute name="record" type="Object" />
<aura:attribute name="accountRecord" type="Object" />
<aura:attribute name="recordSaveError" type="String" default="" />

<force:recordData aura:id="recordEditor"
    layoutType="FULL"
    recordId="{!v.recordId}"
    fields="Name"
    targetError="{!v.recordSaveError}"
    targetRecord="{!v.record}"
    targetFields="{!v.accountRecord}"
    mode="EDIT" />

    <!-- Display an editing form -->
    <div class="Record Details">
        <lightning:card iconName="action:edit" title="Edit Account">
            <div class="slds-p-horizontal--small">
                <lightning:input label="Account Name" value="{!v.accountRecord.Name}"/>
                <br/>
                <lightning:button label="Save Account" variant="brand" onclick="{!c.handleSaveRecord}" />
            </div>
        </lightning:card>
    </div>
  
 <!-- Display error message -->
    <aura:if isTrue="{!not(empty(v.recordSaveError))}">
        <div class="recordSaveError">
           {!v.recordSaveError}
        </div>
    </aura:if>
</aura:component>

---------------------------
controller.js

({
    handleSaveRecord: function(component, event, helper) {
        component.find("recordEditor").saveRecord($A.getCallback(function(saveResult) {
            if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                console.log("Save completed successfully.");
            } else if (saveResult.state === "INCOMPLETE") {
                console.log("User is offline, device doesn't support drafts.");
            } else if (saveResult.state === "ERROR") {
              
            var errMsg = "";
                // saveResult.error is an array of errors,
                // so collect all errors into one message
                for (var i = 0; i < saveResult.error.length; i++) {
                    errMsg += saveResult.error[i].message + "\n";
                }
                console.log('ERROR---'+errMsg)
                component.set("v.recordSaveError", errMsg);

            } else {
                component.set("v.recordSaveError", "");
            }
        }));}
})




 
I am getting below error
User-added image

but my application has 
User-added image

May I know why am not able to pass this challenge ?