• Dogan Turkcan 9
  • NEWBIE
  • 37 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies
Running into a strange issue -- I have developed several lightning components that are displayed in Lightning App Builder. I added a second one that has all the same "implements=" as the other ones, but for some reason is not showing as an option in App Builder. Given the fact that other components are showing up - any ideas/thoughts on things to check? Here is my aura:component line:
 
<aura:component controller="SecureSiteController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global">

 
I installed the package as described in url https://developer.salesforce.com/page/Lightning_Open_CTI.

When i try to login nothing changes on the phone panel.

When i test the login page it receives the following error on Chrome.
Log In
This page has an error. You might just need to refresh it. Action failed: c$ctiLoginPanel$controller$handleLogin [Failed to execute 'postMessage' on 'Window': Invalid target origin '' in a call to 'postMessage'.] Failing descriptor: {c$ctiLoginPanel$controller$handleLogin}

When i try it on firefox it receives the following error.

This page has an error. You might just need to refresh it. Action failed: c$ctiLoginPanel$controller$handleLogin [An invalid or illegal string was specified] Failing descriptor: {c$ctiLoginPanel$controller$handleLogin}

User-added imageUser-added imageUser-added image
Running into a strange issue -- I have developed several lightning components that are displayed in Lightning App Builder. I added a second one that has all the same "implements=" as the other ones, but for some reason is not showing as an option in App Builder. Given the fact that other components are showing up - any ideas/thoughts on things to check? Here is my aura:component line:
 
<aura:component controller="SecureSiteController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global">

 
I am trying to convert a Custom JS button in classic into Lightning action. it is a button on account object. The logic in classic looks something like this:

var a= account.id;
var b = account.type;
var c = account.recordType;

if(a != "" && b == //somevalue && c== somevalue){
//do something;
}
else{
//do something;
}

If I want to convert this logic into lightning whats the best way to do it. As I am using account attributes to decide on the logic that I am going to excute I need access to few account record's details.
Approach I used:

Component Code :

<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" controller="ApexController">
    <aura:handler name="init" value="{!this}" action="{!c.JsHandler}" />
    <aura:attribute name="recordId" type="Id" />
  <aura:attribute name="acc" type="Account"
         default="{ 'sobjectType': 'Account',
                           'Name': '',
                         'Type': '',
                           'RecordType.Name':''     
                       }"/>
</aura:component>

Handler:

var action =  component.get("c.getData");
        action.setParams({"accountId": component.get("v.recordId")});
        action.setCallback(this, function(response){
            component.set("v.acc",response.getReturnValue());
            var acctType = component.get("v.acc.Type");
            var RecordType = component.get("v.acc.RecordType.Name");
            var acctName = component.get("v.acc.Name");
            var acctId = component.get("v.acc.Id");
          // same logic as in the above classic JS button and decide what to do.

Apex Controller:
public class GetNeededData {
    @AuraEnabled
    public static account getData(Id accountId){
        return [select Name,Type,RecordType.name from Account where Id = :accountId];
    }
}

I have a few questions in this implementation:
1) Is this the best possible way to do this or Are there any patterns that I am missing?
2) To access the data returned from the controller, should I declare an account attribute "acc" in the component and use it in the handler to access data from controller OR can I directly create an account record in handler and assign the returned result to it. If yes , how.
3) And if I want to create a case in one of the if else logic , Should I first create a Case attribute in the component and then assign different values in handler and then push that data to controller and Insert the data in controller or Can I use Ajax Toolkit's sobject.connection.create to push the data directly to SF insetad of using a controller.

Thanks in Advance.

Nihar.

 


 
Is there a way for one component to reference the functions in another without embedding?

If I have to embed the component, how do I reference there parent function from a  child component and vice versa?
Our notes & attchemnet are accessible through files(ie ContentDocumentLink replacement of attachment object), As we can not access/get attachment through lightning experience.
reference: https://help.salesforce.com/apex/HTViewSolution?urlname=Attachments-are-not-returned-in-Lightning-Experience-search&language=en_US
I want to display the attachment(image file) on lightning component, How can I display it?
I tried following code :
<apex:image url="/servlet/servlet.FileDownload—file=06941000000SKtyAAG" width="50" height="50" />  
 <apex:image url="/servlet/servlet.FileDownload?file={!attchmentId}"/>

 
In Lightning Experience, when I'm on a record and select "Activity", I get only "New Task" and "New Event".  How can I get Email and Log Call on there, like they're supposed to be?