• Subbu Karuppiah
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Comity Designs

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I am getting the following error in step 7. 
User-added image

Here is the corresponding code:
    <aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="boatReview" type="BoatReview__c" access="private"/>
    <aura:attribute name="boatReviewRecord" type="BoatReview__c" />
    <aura:attribute name="recordError" type="String" access="private"/>

<force:recordData aura:id="service"
                      fields="Id,Name,Comment__c,Boat__c"
                      targetRecord="{!v.boatReviewRecord}"
                      targetFields="{!v.boatReview}"
                      targetError="{!v.recordError}"
                      recordUpdated="{!c.onRecordUpdated}"
                      />
        
    <div class="slds-p-around_x-small">        
        <div class="slds-form slds-form_stacked">
            <div class="slds-form-element">
                <lightning:input label="Title" name="reviewTitle" value="{!v.boatReview.Name}" />
            </div>
            <div class="slds-form-element">
                <label class="slds-form-element__label" for="input-id-02">Description</label>
                <lightning:inputRichText title="Description" value="{!v.boatReview.Comment__c}" disabledCategories="FORMAT_FONT"/>
            </div>
            <div class="slds-form-element">
                <div class="slds-align_absolute-center">
                    <lightning:button label="Submit" onclick='{!c.onSave}' iconName="utility:save"/>
                </div>
            </div>
        </div>    
    </div>
Can someone point me what I am doing wrong here? 

Regards,
Subbu

 
I am getting the following error in step 7. 
User-added image

Here is the corresponding code:
    <aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="boatReview" type="BoatReview__c" access="private"/>
    <aura:attribute name="boatReviewRecord" type="BoatReview__c" />
    <aura:attribute name="recordError" type="String" access="private"/>

<force:recordData aura:id="service"
                      fields="Id,Name,Comment__c,Boat__c"
                      targetRecord="{!v.boatReviewRecord}"
                      targetFields="{!v.boatReview}"
                      targetError="{!v.recordError}"
                      recordUpdated="{!c.onRecordUpdated}"
                      />
        
    <div class="slds-p-around_x-small">        
        <div class="slds-form slds-form_stacked">
            <div class="slds-form-element">
                <lightning:input label="Title" name="reviewTitle" value="{!v.boatReview.Name}" />
            </div>
            <div class="slds-form-element">
                <label class="slds-form-element__label" for="input-id-02">Description</label>
                <lightning:inputRichText title="Description" value="{!v.boatReview.Comment__c}" disabledCategories="FORMAT_FONT"/>
            </div>
            <div class="slds-form-element">
                <div class="slds-align_absolute-center">
                    <lightning:button label="Submit" onclick='{!c.onSave}' iconName="utility:save"/>
                </div>
            </div>
        </div>    
    </div>
Can someone point me what I am doing wrong here? 

Regards,
Subbu

 
All, I am a bit stuck to complete the challenge of the Apply Service Layer Principles in Apex trail.
I have created what has been requested and tested it successfully but I keep getting the following error: 

Challenge Not yet complete... here's what's wrong: 
The Apex service does not appear to be closing cases correctly with the specified reason.

Any idea on how to debug and findout what is wrong?

Below you can see my code:

Class CaseService:

public class CaseService 
{
    public static void closeCases(Set<ID> cases, String closeReason)
    {
        System.debug('SKA - ' + cases);
        System.debug('SKA - ' + closeReason);
        List<Case> caseToUpdate = new List<Case>();
        for (Id caseId : cases)
        {
            Case c = new Case(Id = caseId);
            c.Reason = closeReason;
            c.Status = 'Closed'; 
            
            caseToUpdate.add(c);
        }
     
        update caseToUpdate;
        
    }
}

Class CaseCloseResource:

@RestResource(urlMapping='/case/*/close')
global class CaseCloseResource 
{
    @httpPost
    global static void closeCase(String closeReason)
    {
        System.debug('SKA - HTTPPOST - ' + closeReason + ' - ' + RestContext.request.requestURI);
         // Parse context
        RestRequest req = RestContext.request;
        String[] uriParts = req.requestURI.split('/');
        Id caseId = uriParts[2];
        // Call the service
        CaseService.closeCases(new Set<ID> { caseId }, closeReason);  
        
    }
}