• Aratz Guerra
  • NEWBIE
  • 25 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
Hi, this is my Lightning component code:
 
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global">
    
    <!-- Define Attribute-->
    <aura:attribute name="newQuote" type="Object"/>
    <aura:attribute name="simpleNewQuote" type="Object" default="{'sobjectType':'SBQQ__Quote__c', 'SBQQ__EndDate__c':2018-01-01}"/>
    <aura:attribute name="newQuoteError" type="String"/>    
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    <force:recordData aura:id="QuoteRecordCreator" 
                      layoutType="FULL"
                      targetRecord="{!v.newQuote}"
                      targetFields="{!v.simpleNewQuote}"
                      targetError="{!v.newQuoteError}" />
                      
    <div class="slds-modal__header">
        <h2 class="slds-text-heading--medium">New Quote</h2>
    </div>

    <!-- Display the new quote form -->
    <div class="slds-form_stacked">
        
        <lightning:input aura:id="QuoteField" type="date" name="Notes" label="Offer end date"
                         value="{!v.simpleNewQuote.SBQQ__EndDate__c}"/>
        <lightning:textarea aura:id="QuoteField" name="Notes" label="Additional notes"
                         value="{!v.simpleNewQuote.SBQQ__Notes__c}"/>

        
        <lightning:button label="Create Quote" onclick="{!c.handleSaveQuote}"
                   variant="brand" class="slds-m-top_medium"/>
   </div>

</aura:component>

But when I select a Date, the following error appears:

Uncaught Error in $A.getCallback() [Cannot read property 'SBQQ__EndDate__c' of null]
throws at https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:31064:9. Caused by: Error in $A.getCallback() [Cannot read property 'SBQQ__EndDate__c' of null]
AttributeSet.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:22401:12
componentConstructor.Component.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:16854:37
PropertyReferenceValue.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:15155:41
AttributeSet.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:22402:17
componentConstructor.Component.set()@https://hum.lightning.force.com/auraFW/javascript/1bO4dJePbDnoI-_VdhdsEQ/aura_proddebug.js:16854:37
Object.onNodeValueChange()@https://hum.lightning.force.com/components/lightning/input.js:319:27
Object.eval [as input]()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:218:33
runSyntheticEvent()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:128:27
HTMLInputElement.eventListener()@https://hum.lightning.force.com/libraries/lightning/domLibrary/dom.js:131:24


Can anyone tell me how to solve it please?
Hi, I need to capture and show in the page any error that could happens. I have this component:
 
<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global">
    
    <!-- Define Attribute-->
    <aura:attribute name="newQuote" type="Object"/>
    <aura:attribute name="simpleNewQuote" type="Object"/>
    <aura:attribute name="newQuoteError" type="String"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    <force:recordData aura:id="QuoteRecordCreator" 
                      layoutType="FULL"
                      targetRecord="{!v.newQuote}"
                      targetFields="{!v.simpleNewQuote}"
                      targetError="{!v.newQuoteError}" />

</aura:component>

and the controller:
 
handleSaveQuote: function(component, event, helper) {
            component.set("v.simpleNewQuote.SBQQ__Opportunity2__c", component.get("v.recordId"));
            component.set("v.simpleNewQuote.SBQQ__LineItemsGrouped__c", true);
            component.set("v.simpleNewQuote.SBQQ__Primary__c", true);
            component.find("QuoteRecordCreator").saveRecord(function(saveResult) {
                if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
                    // record is saved successfully
                    var resultsToast = $A.get("e.force:showToast");
                    resultsToast.setParams({
                        "type": 'success',    
                        "title": "Saved",
                        "message": "The new quote has been created."
                    });
                    resultsToast.fire();
                    helper.navigateTo(component, saveResult.recordId);


                } else if (saveResult.state === "INCOMPLETE") {
                    // handle the incomplete state
                    console.log("User is offline, device doesn't support drafts.");
                } else if (saveResult.state === "ERROR") {
                    // handle the error state
                    var resultsToast = $A.get("e.force:showToast");
                    resultsToast.setParams({
                        "type": 'error',    
                        "title": "Not Saved",
                        "message": "The new quote has an error."
                    });
                    resultsToast.fire();
                    helper.navigateTo(component, saveResult.recordId);
                    console.log('Problem saving contact, error: ' + JSON.stringify(saveResult.error));
                } else {
                    console.log('Unknown problem, state: ' + saveResult.state + ', error: ' + JSON.stringify(saveResult.error));
                }
            });
    }
if saveResult.state === "ERROR"  I need to show a message (like in the SUCCESS case) but it can be generic message, I must capture the error.

Could anyone help me please?
 
Hello,

I have a List of Objects, for example:

myList = (Object1, Object2 , Object3, Object4)

where:
Object1.Name = 'NameA',
Object2.Name = 'NameB',
Object3.Name = 'NameA' and
Object4.Name='NameC'

I have to create a List of Names without repeated Names, and also I need a List that counts the number of the elements, in this example:

NonRepeatedNamesList = ('NameA','NameB','NameC');
CounterList = (2,1,1);

Can anybody help me please?




 
Hello, I have this query:

SELECT b.Outstanding_Amount__c
FROM Billing__C b, Contract c
WHERE b.Contract_Number__C = c.ContractNumber
AND  c.AccountId =: cuenta.Id 

(cuenta.Id is the value that I pass)

But i need to do it in SOQL, could anybody help me pease?