• vfdshn htrgutf
  • -2 Points
  • Member since 2021

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 3
I'm new to aura components and I cannot figure out when I try to fire a component inside a callback function inside $A.getCallback() according to the documentation I get the error $A.getCallback() [Cannot read property 'setParam' of null]. I'm trying to fire the component inside a strophe.js hanlder function which is a callback function and only takes a single parameter.

<aura:component description="Login panel for users to log into their CTI systems."  implements="c:panel">
    <ltng:require scripts="{!$Resource.Strophe}"/>
    <ltng:require scripts="{!$Resource.xml2json}"/>
    <!-- <ltng:require scripts="{!$Resource.jQuery}"/> -->

    <div class="slds-modal__container">
        <div class="logo">
            <img src="/staticresources/demoAdapterLogo.png" align="center"></img>
        <div class="slds-form-element slds-p-bottom--medium">
            <label class="slds-form-element__label" for="text-input-01">Username</label>
            <div class="slds-form-element__control">
                <ui:inputText class="slds-input" aura:id="username"/>
        <div class="slds-form-element slds-p-bottom--medium">
            <label class="slds-form-element__label" for="text-input-01">Password</label>
            <div class="slds-form-element__control">
                <ui:inputSecret class="slds-input" aura:id="password"/>
        <div class="slds-form-element slds-p-bottom--medium">
            <label class="slds-form-element__label" for="text-input-01">Extension</label>
            <div class="slds-form-element__control">
                <ui:inputNumber class="slds-input" aura:id="extension"/>
        <button class="slds-button slds-button--brand" aura:id="submitButton" onclick="{!c.handleLogin}">Log In</button>
<aura:component description="panel that is shown on dialing, incoming or transferring calls before being connected that displays basic contact info for the call." implements="c:panel">
    <aura:attribute name="state" type="String" />
    <aura:attribute name="label" type="String" />
    <aura:attribute name="recordName" type="String" />
    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="account" type="Object" />
    <aura:attribute name="title" type="String" />
    <aura:attribute name="phone" type="String" />
    <aura:attribute name="presence" type="String" description="Could be Available, Busy or Unavailable"/>
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <div class="slds-panel">
        <!--  Top section: Information about the contact, including an avatar -->
        <div class="slds-panel__section">
            <div class="avatar slds-align--absolute-center">
                <div class="slds-avatar slds-avatar--circle slds-avatar--large">
                    <img src="/resource/slds/assets/images/avatar1.jpg" alt="Contact" />
            <div class="name slds-text-heading--large slds-text-color--weak slds-text-align--center">{!v.recordName}</div>
            <div class="slds-text-heading--x-small slds-text-color--weak slds-text-align--center companyDetails">{!v.account.Name}</div>
            <div class="slds-text-heading--x-small slds-text-color--weak slds-text-align--center companyDetails">{!v.title}</div>
            <div class="incoming slds-text-heading--x-small slds-text-color--weak slds-text-align--center">{!v.state}&nbsp;<ui:outputphone value="{!v.phone}" />...</div>
            <div class="slds-text-heading--x-small slds-text-color--weak slds-text-align--center"> <c:ticker /> </div>
       <!--  Bottom section: End button on Dialing; Decline and Accept buttons on Incoming or Transferring -->
        <div class="bottom-panel slds-panel__section slds-align-bottom slds-grid">
            <aura:if isTrue="{! v.state == 'Dialing'}">
                <button class="slds-size--1-of-1 slds-button slds-button--destructive" onclick="{!c.end}">End</button>
                <aura:set attribute="else">
                    <button class="slds-size--1-of-2 slds-button slds-button--destructive" onclick="{!c.decline}">Decline</button>
                    <button class="slds-size--1-of-2 slds-button slds-button--brand" onclick="{!c.accept}">Accept</button>

<aura:interface description="Demo Adapter Panel Interface, where every implementation is able to fire the events below.," >
    <aura:registerEvent name="renderPanel" type="c:renderPanel"/>
    <aura:registerEvent name="editPanel" type="c:editPanel"/>
    <aura:registerEvent name="getSettings" type="c:getSettings"/>

<aura:event type="COMPONENT" description="Event fired to trigger panel rendering/transitioning.">
    <aura:attribute name="type" type="String" required="true" description="The type of panel component to create, e.g. c:ctiLoginPanel."/>
    <aura:attribute name="toast" type="Object" description="A toast to display on rendering. JS object consists of type (normal, success, warning, error) and a message"/>
    <aura:attribute name="attributes" type="Object" description="A map of attributes to send to the component."/>

handleLogin: function(cmp, event, helper) {
    connection.connect('xyz.com', password, onConnect);

    var onConnect = setTimeout(() => {
        // works here 
        // cmp.getEvent('renderPanel').setParams({
        //     type : 'c:callInitiatedPanel',
        //     attributes : {
        //         'state' : 'Incoming',
        //         'recordName' : 'hammad',
        //         'phone' : 'phone',
        //         'title' : 'title',
        //         'account' : 'account',
        //         'recordId' : 'rid',
        //         'presence' : 'presence'
        //     }
        // }).fire()
        connection.send($pres({ to: PUBSUB_JID }).tree());
        connection.addHandler(function (msg) {
            var x2js = new X2JS();
            try {
                var text = msg['firstElementChild']['firstElementChild']['textContent'];
                var obj = x2js.xml_str2json(text);
                console.log("On Message : ", obj);
                    $A.getCallback(function () {
                            type: 'c:callInitiatedPanel',
                            attributes: {
                                'state': 'Incoming',
                                'recordName': 'abc',
                                'phone': 'phone',
                                'title': 'title',
                                'account': 'account',
                                'recordId': 'rid',
                                'presence': 'presence'
                    }), 1000
            } catch (e) {
                console.log("Error: ", e)
            return true;
        }, null, 'message', null, null, null);
    }, 1000)

Hi, I am having trouble with tasks 2 through 4. Can someoone please help?

1. Add fields to the Custom Object to capture the following information on the page layout for each pet. :
Cat, Dog or Bird
Coat Length
Vaccination Date (Make this field read-only to all Profiles except for Veterinarian)
Personality Description
2. Add a field to the “Pet” Object called Pet Owner that relates the records to the Contact object.
3. Add a field to Contact that automatically presents the total number of pets the Contact owns.
4. Add three fields to Contact that automatically presents the total number of Cats, Dogs and Birds respectively.

Is there a way to get a list of Account records (parent) with no child records associated (Opportunity)  via SOQL?

I am trying to avoid doinf this in Apex, like getting the AccountId values from Opportunity and then query accounts where id not in this list.


Is it possible to get this list through SQOL?

Here is my query (I need only the accounts that have no associated Opportunity records):


SELECT a.Id, a.Name, (Select id from Opportunities) from Account a order by a.Name