• Ramakrishna Reddy Gouni
  • NEWBIE
  • 69 Points
  • Member since 2016
  • Senior Salesforce Developer
  • AppShark

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 8
    Likes Given
  • 5
    Questions
  • 55
    Replies
Hello,

 i am getting an Error "Too many SOQL queries: 101".
 
public class WarengruppenZuordnung {
    /********************* Properties used by getRootNodeOfUserTree function - starts **********************/
    // map to hold roles with Id as the key
    private static Map <Id, Warengruppen_Struktur__c> warengruppeMap;
    
    // map to hold child roles with parentRoleId as the key
    private static Map <Id, List<Warengruppen_Struktur__c>> parentWarengruppeMap;
    
    // List holds all subordinates
    private static List<Warengruppen_Struktur__c> allProducts {get; set;}
    
    // Global JSON generator
    private static JSONGenerator gen {get; set;}
    public static String folderId{get;set;}
    public static String folderName{get;set;}
    public static String endpointId{get;set;}
    /********************* Properties used by getRootNodeOfUserTree function - ends **********************/
    
    
    /********************* Properties used by getSObjectTypeById function - starts ********************* */
    // map to hold global describe data
    private static Map<String,Schema.SObjectType> gd;
    
    // map to store objects and their prefixes
    private static Map<String, String> keyPrefixMap;
    
    // to hold set of all sObject prefixes
    private static Set<String> keyPrefixSet;
    /********************* Properties used by getSObjectTypeById function - ends **********************/
    
    public static String redirUrl{get;set;}
    public String contactId {get;set;}
    
    /* // initialize helper data */ 
    static {
        // initialize helper data for getSObjectTypeById function
        Map<String, String> UrlParameterMap = ApexPages.currentPage().getParameters();
        //redirUrl = getRedirUrl();
        gen = JSON.createGenerator(true);
        init1();
        gen = JSON.createGenerator(true);
        // initialize helper data for getRootNodeOfUserTree function
        init2();
    }
    
    /* // init1 starts <to initialise helper data> */
    private static void init1() {
        // get all objects from the org
        gd = Schema.getGlobalDescribe();
        // to store objects and their prefixes
        keyPrefixMap = new Map<String, String>{};
            
            //get the object prefix in IDs
            keyPrefixSet = gd.keySet();
        
        // fill up the prefixes map
        for(String sObj : keyPrefixSet) {
            Schema.DescribeSObjectResult r =  gd.get(sObj).getDescribe();
            String tempName = r.getName();
            String tempPrefix = r.getKeyPrefix();
            keyPrefixMap.put(tempPrefix, tempName);
        }
    }
    /* // init1 ends */
    
    /* // init2 starts <to initialise helper data> */
    private static void init2() {
        
        // Create a blank list
        allProducts = new List<Warengruppen_Struktur__c>();

        for(AggregateResult wsc : [SELECT Name, RecordTypeId, RecordType.DeveloperName FROM Warengruppen_Struktur__c GROUP BY RecordTypeId, RecordType.DeveloperName, Name ORDER BY Name]) {
            if(String.valueOf(wsc.get('DeveloperName')).contains('Ordner')){
                folderId = String.valueOf(wsc.get('RecordTypeId'));
                folderName = String.valueOf(wsc.get('Name'));
            }
            if(String.valueOf(wsc.get('DeveloperName')).contains('Endpunkt')){
                endpointId = String.valueOf(wsc.get('RecordTypeId'));
                
            }
        }
        
        warengruppeMap = new Map<Id, Warengruppen_Struktur__c>([select Id, Name, Parent_Warengruppe__c, RecordTypeId from Warengruppen_Struktur__c order by Name]);
        // populate parent role - child roles map
        parentWarengruppeMap = new Map <Id, List<Warengruppen_Struktur__c>>();        
        for (Warengruppen_Struktur__c r : warengruppeMap.values()) {
            List<Warengruppen_Struktur__c> tempList;
            if (!parentWarengruppeMap.containsKey(r.Parent_Warengruppe__c)){
                tempList = new List<Warengruppen_Struktur__c>();
                tempList.Add(r);
                parentWarengruppeMap.put(r.Parent_Warengruppe__c, tempList);
            }
            else {
                tempList = (List<Warengruppen_Struktur__c>)parentWarengruppeMap.get(r.Parent_Warengruppe__c);
                tempList.add(r);
                parentWarengruppeMap.put(r.Parent_Warengruppe__c, tempList);
            }
        }
    } 
    /* // init2 ends */
    
    /* // public method to get the starting node of the RoleTree along with user list */
    public static RoleNodeWrapper getRootNodeOfUserTree (Id userOrRoleId) {
        return createNode(userOrRoleId);
    }
    
    /* // createNode starts */
    private static RoleNodeWrapper createNode(Id objId) {
        RoleNodeWrapper n = new RoleNodeWrapper();
        Id roleId;
        if (isRole(objId)) {
            roleId = objId;
            if (!(warengruppeMap.get(objId).Parent_Warengruppe__c == null)) {
                List<Warengruppen_Struktur__c> tempFolderList = new List<Warengruppen_Struktur__c>();
                Warengruppen_Struktur__c tempFolder = [Select Id, Name, Parent_Warengruppe__c, RecordTypeId, RecordType.DeveloperName from Warengruppen_Struktur__c where Id =: objId ORDER BY Name];
                tempFolderList.add(tempFolder);
                if(tempFolderList.size()== 1){
                    if(tempFolderList[0].RecordType.DeveloperName.contains('Ordner')){
                        n.hasFolders = false;
                        n.myFolders = tempFolderList;
                        n.isLeafNode = false;
                        allProducts.addAll(n.myFolders);
                    }
                    else{
                        n.hasFolders = false;
                        n.myFolders = tempFolderList;
                        n.isLeafNode = true;
                        allProducts.addAll(n.myFolders);
                    }
                }
            }
        }
        else {
            List<Warengruppen_Struktur__c> tempFolderList = new List<Warengruppen_Struktur__c>();
            Warengruppen_Struktur__c tempFolder = [Select Id, Name, Parent_Warengruppe__c, RecordTypeId from Warengruppen_Struktur__c where Id =: objId ORDER BY Name];
            tempFolderList.add(tempFolder);
            n.myFolders = tempFolderList;
            roleId = tempFolder.Parent_Warengruppe__c;
        }
        n.myRoleId = roleId;
        n.myRoleName = warengruppeMap.get(roleId).Name;
        n.myParentRoleId = warengruppeMap.get(roleId).Parent_Warengruppe__c;
        n.RecordTypeId = warengruppeMap.get(roleId).RecordTypeId;
        if (parentWarengruppeMap.containsKey(roleId)){
            n.hasChildren = true;
            n.isLeafNode = false;
            List<RoleNodeWrapper> lst = new List<RoleNodeWrapper>();
            for (Warengruppen_Struktur__c r : parentWarengruppeMap.get(roleId)) {
                lst.add(createNode(r.Id));
            }           
            n.myChildNodes = lst;
        }
        else {
            n.isLeafNode = true;
            n.hasChildren = false;
            
        }
        return n;
    }
    
    public static List<Warengruppen_Struktur__c> getAllProducts(Id warengruppeId){
        createNode(warengruppeId);
        return allProducts;
    }
    
    public static String getTreeJSON(Id userOrRoleId) {
        gen = JSON.createGenerator(true);
        RoleNodeWrapper node = createNode(userOrRoleId);
        gen.writeStartArray();
        convertNodeToJSON(node);
        gen.writeEndArray();
        return gen.getAsString();
    }
    
    public static String getTreeJSON() {
        gen = JSON.createGenerator(true);
        List<Warengruppen_Struktur__c> wRoots = [Select Id, Name, RecordTypeId From Warengruppen_Struktur__c Where Parent_Warengruppe__c = '' ORDER BY Name];
        gen.writeStartArray();
        for(Warengruppen_Struktur__c ws : wRoots){
            RoleNodeWrapper node = createNode(ws.Id);
            convertNodeToJSON(node);
        }
        gen.writeEndArray();
        return gen.getAsString();
    }
    
    private static void convertNodeToJSON(RoleNodeWrapper objRNW){
        gen.writeStartObject();
        gen.writeStringField('title', objRNW.myRoleName);
        gen.writeStringField('key', objRNW.myRoleId);
        gen.writeStringField('RecordTypeID', String.valueOf(objRNW.RecordTypeId));
        gen.writeBooleanField('unselectable', false);
        gen.writeBooleanField('expand', true);
        gen.writeBooleanField('isFolder', true);
        if (objRNW.hasFolders || objRNW.hasChildren)
        {
            gen.writeFieldName('children');
            gen.writeStartArray();
            if (objRNW.hasFolders)
            {
                for (Warengruppen_Struktur__c u : objRNW.myFolders)
                {
                    gen.writeStartObject();
                    gen.writeStringField('title', u.Name);
                    gen.writeStringField('key', u.Id);
                    gen.writeStringField('RecordTypeID', String.valueOf(objRNW.RecordTypeId));
                    gen.writeBooleanField('isFolder', false);
                    gen.WriteEndObject();
                }
            }
            if (objRNW.hasChildren)
            {
                
                for (RoleNodeWrapper r : objRNW.myChildNodes)
                    
                {
                    convertNodeToJSON(r);
                    
                }
            }
            gen.writeEndArray();
        }
        gen.writeEndObject();
    }
    
    /* // general utility function to get the SObjectType of the Id passed as the argument, to be used in conjunction with */ 
    public static String getSObjectTypeById(Id objectId) {
        String tPrefix = objectId;
        tPrefix = tPrefix.subString(0,3);
        String objectType = keyPrefixMap.get(tPrefix);
        return objectType;
    }
    /* // utility function getSObjectTypeById ends */
    
    /* // check the object type of objId using the utility function getSObjectTypeById and return 'true' if it's of Role type */
    public static Boolean isRole (Id objId) {
        if (getSObjectTypeById(objId) == String.valueOf(Warengruppen_Struktur__c.sObjectType)) {
            return true;
        }
        else if (getSObjectTypeById(objId) != String.valueOf(Warengruppen_Struktur__c.sObjectType)) {
            return false;
        } 
        return false;
    }
    /* // isRole ends */
    
    public class RoleNodeWrapper {
        
        // Role info properties - begin
        public String myRoleName {get; set;}
        
        public Id myRoleId {get; set;}
        public Id RecordTypeId {get; set;}
        public String myParentRoleId {get; set;}
        // Role info properties - end
        
        
        // Node children identifier properties - begin
        public Boolean hasChildren {get; set;}
        
        public Boolean isLeafNode {get; set;}
        
        public Boolean hasFolders {get; set;}
        // Node children identifier properties - end
        
        
        // Node children properties - begin
        public List<Warengruppen_Struktur__c> myFolders {get; set;}
        
        public List<RoleNodeWrapper> myChildNodes {get; set;}
        // Node children properties - end   
        
        public RoleNodeWrapper(){
            hasFolders = false;
            hasChildren = false;
        }
    }
    
    public static String getRedirUrl(){
        Map<String, String> UrlParameterMap = ApexPages.currentPage().getParameters();
        redirUrl = UrlParameterMap.values()[1];
        return redirUrl;        
    }
    
    public String getContactId()
    {
        return Apexpages.currentPage().getParameters().get('id');
        
    }

}

This Error occur in this line
 
Warengruppen_Struktur__c tempFolder = [Select Id, Name, Parent_Warengruppe__c, RecordTypeId, RecordType.DeveloperName from Warengruppen_Struktur__c where Id =: objId ORDER BY Name];
How to change this to get it working?

Any Ideas :(?

Thanks
Peter
Hello to everyone reading this question, i`ve dealed with bug (or i don`t know if this is bug).

I`ve created Lightning quick action with markup:
<aura:component controller="CaseAssignToMeController" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" >
	<!--<aura:attribute name="recordId" type="String" default="{!v.recordId}"/>-->
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/><!--handler on page load to show current week and current user stats-->
    <ui:outputText aura:id="message" value=""></ui:outputText>
</aura:component>


How button looks.

And this button shows as chatter action like post. Does somebody know how to solve this issue? I want this action as standard like 'Change Record Type' or similar.

What logical operator should work in lightning conditions
Hi All, 

my xml input is not parsing due to spaces and un expected new lines. now i need to make it correct. i need to remove white space in tag name. 

example:
expected input : <country>India</country>
actual input : <count
ry>India</country>


 
Hi,
i need to integrate salesforce with sage intacct.  anyone please suggest me api endpoint url. 
any sample code and possibilities 
Hi,
   I created a force.com site, i applied many field permissions to guest user.  now i need to deploy same profile with all field permissions to production. 


Thanks:
Ramakrishna Reddy Gouni
Agent is cover letter printing lightning experience using quick action. 
by using quick action we have to design a cover letter and take print out of it in lightning experience. 

thanks in advance. 
What logical operator should work in lightning conditions
Hi,

In LWC, on the component load, I am fetching the latitude and longitude of the logged in user and trying to display it on the component. I have created two attributes named lat and lng and marked it with @track decorator so that whenever the value of these attributes is changed, the component will rerender automatically. I am setting the value of these attributes in connectedCallback, but the updated value is not getting reflected on the component. Below is the html and js files.
 
<template>
    <div class="slds-box">
        <div class="slds-text-heading--large">Weather Report - {lat} {lng}</div>
    </div>
</template>
 
import { LightningElement, track } from 'lwc';

export default class WeatherAppContainer extends LightningElement {
    @track lat;
    @track lng;
    connectedCallback() {
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(showPosition);
        }
        
        function showPosition(position) {
            console.log("position: ",position);
            console.log("position coords: ",position.coords);
            console.log("position coords lat: ",position.coords.latitude);
            this.lat = position.coords.latitude; 
            this.lng = position.coords.longitude; 
            console.log("lat: ",this.lat);
            console.log("lng: ",this.lng);
        }
    }

}

The console "position coords lat" prints the value correctly, but the next console statment does not get printed. I am guessing that we cannot use this keyword in the connectedCallback. Any pointers how to solve this? Thanks.
I‘ve created a managed package that includes objects with Lightning Record Pages (LRP).

When I attempt to install the managed package in a test environment, I get the error “Small is not a supported form factor" which causes my install to fail.

I’ve traced this error back to the LRP activation.

If I activate a LRP as an Org Default I’m given the option to make it the default for Desktop, Phone, or Desktop and Phone.

I chose Desktop and Phone because why wouldn’t I want users to have a good mobile experience. 

But the Phone / mobile option caused the error.  I verified this by changing the activation to Desktop only and the install worked. 

Interestingly, if I go down the “App, Record Type, and Profile” activation path (some of my objects have different record types with different LRPs) I don’t get an option to choose Phone.  Desktop is the only option.

So, is there a way to activate LRPs for Phone without causing errors? 

If not, any idea why Salesforce give the option of assigning an LRP as the Phone view?   
What logical operator should work in lightning conditions
I am working on one lightning component for a calendar on event object.

On single click in calendar its opening up edit page of event record creation but I just want want to do it on double click instead of single click.
Can anyone help me out in this issue please.
My code is below.
Component:
<aura:component controller="LightningCalender" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
	 <ltng:require styles="{!$Resource.Calender     + '/fullcalendar-3.9.0/fullcalendar.css'}"
                  scripts="{!join(',',
                           $Resource.Calender  + '/fullcalendar-3.9.0/lib/jquery.min.js',
                           $Resource.Calender  + '/fullcalendar-3.9.0/lib/moment.min.js',
                           $Resource.Calender  + '/fullcalendar-3.9.0/fullcalendar.js'
                           )}"
                  afterScriptsLoaded="{!c.afterScriptsLoaded}" />
    
    <ltng:require styles="/resource/calender/fullcalendar-3.9.0/fullcalendar.css"/>
    
    <aura:attribute name='Objectlist' type='Object[]'/>
    <aura:attribute name="buttonstate" type="Boolean" default="false"/>
    
     <lightning:buttonStateful
        labelWhenOff="List View"
        labelWhenOn="Grid View"
        
        state="{!v.buttonstate}" onclick="{!c.handleClick }"/>
     
        <div id="calendar" class="slds-card">
      

    </div>
    <div id="listcalendar" class="slds-card"/>
</aura:component>

.js
({
	 afterScriptsLoaded: function(cmp,evt,helper){
         
         helper.fetchCalenderEvents(cmp);
        
    },
    
     handleClick : function(component, event, helper){ 
      
         var buttonstate = component.get("v.buttonstate");
         component.set("v.buttonstate",!buttonstate);
         if(!buttonstate){
          $("#listcalendar").show();
         $("#calendar").hide();
         $('#listcalendar').fullCalendar({
        	defaultView: 'listWeek',
             listDayFormat : true,
             events : component.get("v.Objectlist")
		});
        
         }
         else{
              $("#calendar").show();
           $("#listcalendar").hide();   
             helper.fetchCalenderEvents(component);
         }
        
    },

})

Helper.js
({
	loadDataToCalendar :function(component,data){  
        //Find Current date for default date
        var d = new Date();
        var month = d.getMonth()+1;
        var day = d.getDate();
        var currentDate = d.getFullYear() + '/' +
            (month<10 ? '0' : '') + month + '/' +
            (day<10 ? '0' : '') + day;
         
        var self = this;
        $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,basicWeek,basicDay'
            },
            selectable : true,
            defaultDate: currentDate,
            editable: true,
            eventLimit: true,
            events:data,
            dragScroll : true,
             droppable: true,
            weekNumbers : true,
  eventDrop: function(event, delta, revertFunc) {

    alert(event.title + " was dropped on " + event.start.format());

    if (!confirm("Are you sure about this change?")) {
      revertFunc();
    }
      else{
          var eventid = event.id;
          var eventdate = event.start.format();
          self.editEvent(component,eventid,eventdate);
      }

  },
            eventClick: function(event, jsEvent, view) {
           console.log(event.id);
              var editRecordEvent = $A.get("e.force:editRecord");
              editRecordEvent.setParams({
              "recordId": event.id
           });
           editRecordEvent.fire();
          },
            dayClick :function(date, jsEvent, view) {
              console.log(date.format());
                var datelist = date.format().toString().split('-');
             console.log(datelist[0]);
                console.log(parseInt(datelist[1])-1);
              var datetime = new Date(datelist[0],parseInt(datelist[1])-1,parseInt(datelist[2])+1,0,0,0,0);
            console.log(datetime);
             var createRecordEvent = $A.get("e.force:createRecord");
    createRecordEvent.setParams({
        "entityApiName": "Event",
        "defaultFieldValues": {
        'StartDateTime' :  datetime
        
    }
    });
    createRecordEvent.fire();
          },
            
            eventMouseover : function(event, jsEvent, view) {
            
          }
    });
    },
       
    
    formatFullCalendarData : function(component,events) {
        var josnDataArray = [];
        for(var i = 0;i < events.length;i++){
            var startdate = $A.localizationService.formatDate(events[i].StartDateTime);
            var enddate = $A.localizationService.formatDate(events[i].EndDateTime);
            josnDataArray.push({
                'title':events[i].Subject,
                'start':startdate,
                'end':enddate,
                'id':events[i].Id
            });
        }
      console.log('josnDataArray'+josnDataArray);
        return josnDataArray;
    },
     
    fetchCalenderEvents : function(component) {
         var action=component.get("c.getAllEvents");
       
         action.setCallback(this, function (response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var data= response.getReturnValue();
               console.log(JSON.stringify(data));
                 var josnArr = this.formatFullCalendarData(component,response.getReturnValue());
                this.loadDataToCalendar(component,josnArr);
                component.set("v.Objectlist",josnArr);
           
            } else if (state === "ERROR") {
                                 
            }
        });
        
        $A.enqueueAction(action);
       
    }, 
    
    editEvent : function(component,eventid,eventdate){
         var action=component.get("c.updateEvent");
console.log(eventdate);
         action.setParams({ eventid : eventid ,
                           eventdate : eventdate});

         action.setCallback(this, function (response) {
            var state = response.getState();
            if (state === "SUCCESS") {
            console.log('updated');
           
            } else if (state === "ERROR") {
                                 
            }
        });
        
        $A.enqueueAction(action);

    }
})


 
Hi Friends 
I want to create a custom button in lead object in lightning component
when click on the custom button create a contact record 
but i dont want to open any component page or alert or model box 
just create a contact record these process done in lightning only



 
I need to display data in three sections in a lightning page and the middle section has three sub-sections and this needs to be access from Salesforce1 as well. It looks similar to this. User-added image
Hi everyone,
I am trying to search Account records using Lightning Component but functionality is not working. Please help me to find out where I did wrong.

Component:
<aura:component controller="AccountListController" implements="force:appHostable">
    <aura:attribute name="acList" type="Account[]" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:handler event="c:SearchKeyChange" action="{!c.searchKeyChange}"/>
    <div class="slds-grid">
        <div class="slds-col slds-align-bottom" style="margin-top:10px">
            <c:SearchResultComponent />
        </div>
    </div>
    <table class="slds-table slds-table_bordered slds-table_striped slds-table_cell-buffer slds-table_fixed-layout">
        <thead>
            <tr class="slds-text-heading_label">
                <th scope="col"><div class="slds-truncate" title="Id">Id</div></th>
                <th scope="col"><div class="slds-truncate" title="Name">Name</div></th>
                <th scope="col"><div class="slds-truncate" title="Type">Type</div></th>
                <th scope="col"><div class="slds-truncate" title="AccountNumber">Account Number</div></th>
                <th scope="col"><div class="slds-truncate" title="Industry">Industry</div></th>
            </tr>
        </thead>
        <tbody>
            <!-- Use the Apex model and controller to fetch server side data -->
            <aura:iteration items="{!v.acList}" var="ac">
                <tr>
                    <th scope="row">
                        <div class="slds-truncate" title="{!ac.Id}">
                            <a href="{! '#/sObject/' + ac.Id + '/view'}">{!ac.Id}</a>
                        </div>
                    </th>
                    <td><div class="slds-truncate" title="{!ac.Name}">{!ac.Name}</div></td>
                    <td><div class="slds-truncate" title="{!ac.Type}">{!ac.Type}</div></td>
                    <td><div class="slds-truncate" title="{!ac.AccountNumber}">{!ac.AccountNumber}</div></td>
                    <td><div class="slds-truncate" title="{!ac.Industry}">{!ac.Industry}</div></td>
                </tr>
            </aura:iteration>
        </tbody>
    </table>
</aura:component>
Js Controller:
({
	doInit : function(component, event, helper) {
		helper.getAccountList(component); 
	},
    searchKeyChange : function(component, event) {
        var searchKey = event.getParam("searchKey");
        //console.log('@@@@@@@search Value====',searchValue);
        var accList = component.get("v.acList");
        var action =  component.get('c.findByName');
        //console.log('action Value====',action);
        action.setParam({
            "searchKey" : searchKey,
            "accList" : accList
        });
        
        action.setCallback(this, function(result){
            component.set('v.acList', result.getReturnValue());
        });
        $A.enqueueAction(action);
    },
})
Helper Js:
({
    getAccountList : function(component) {
        var action = component.get('c.getAccounts');
        action.setCallback(this,function(result){
            component.set('v.acList', result.getReturnValue());
        });
        $A.enqueueAction(action);
    },
})
Server side Controller:
public class AccountListController {
    
    @AuraEnabled 
    public static list<Account> getAccounts(){
        return[select id, name , Type, Industry, AccountNumber from Account ORDER BY createdDate ASC];
    }
    
    @AuraEnabled
    public static list<Account> findByName(String searchKey, Account[] accList){
        Set<Id> recordIds = new Map<Id, Account>(getAccounts()).keySet();
        System.debug('recordIds@@@@@@'+' '+recordIds);
        System.debug('ACCOUNT LIST' + accList);
        String searchName = searchKey + '%';
        return[ SELECT id, Name, Industry, Type, AccountNumber FROM Account WHERE (Name LIKE : searchName OR AccountNumber LIKE :searchName OR Type LIKE :searchName OR Industry LIKE :searchName) AND Id IN:recordIds];
    }
}

Search Result comp:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
	<div>
        <input type="text" class="form-control" placeholder="Search Account.." onkeyup="{!c.searchKeyChange}"/>
    </div>
</aura:component>

Js controller:
({
    searchKeyChange : function(component, event, helper) {
        var appevt = $A.get("e.c:SearchKeyChange");
        appevt.setParam({
            "searchKey" : event.target.value
        });
        appevt.fire();
    },
    
})


 
  • July 02, 2019
  • Like
  • 0
I've developped a screen searchResults Lightning web component which display liste of customers.
When I selected one customer and save it in salesforce(Account). I want to display it in tab and close searchResult screen.

To display created account, I've used NavigationMixin.Navigate
To close searchResult screen I've created Aura Component which contains my LWC to be able to use WorkspaceAPI and closeTab...

But when tab screen is closed the focus is positioned on the precedent tab not on created account tab.

How to positione focus on createdAccountTab?
thx for help

Code 

ParentAuraComponent.cmp

<aura:component implements="flexipage:availableForAllPageTypes" access="global">    
   
 <lightning:workspaceAPI aura:id="workspace"/> 
<div><c:searchClientCustomerByPhoneResults oncloseclicked="{!c.handleFilterChange}"/></div>    

</aura:component>



ParentAuraComonent.js

({
    handleFilterChange: function(component, event) {
var accountToDisplay = event.getParam('accountToDisplay');
var workspaceAPI = component.find("workspace"); 

workspaceAPI.getFocusedTabInfo().then(function(response) {
  
var focusedTabId = response.tabId;    
workspaceAPI.closeTab({tabId: focusedTabId});

 }).catch(function(error) { 
    console.log(error);

}
);


searchScreen.js(LWC)

saveRow() {

    saveAccountInSF({identifiant: this.identifiant}).then(result => {
                        
            if (result.length === 1) {  
                this.accountId = result[0].Id;                                                               
                /*Appel methode pour la consulation client */                                      
                this.navigateToRecordViewPage(); 
                closeTab();    
            } 
        }).catch(error => {
            this.error = error;                
        });
}        

        
closeTab(){
        var close = true;
        var accountToDisplay = this.accountId;
        //var urlToDisplay = this.url;
        const closeclickedevt = new CustomEvent('closeclicked', {
            detail: { close, accountToDisplay},
        });

         // Fire the custom event
        this.dispatchEvent(closeclickedevt);        
   }     
        
        
        
navigateToRecordViewPage() {
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: this.accountId,
                objectApiName: 'Account',
                actionName: 'view'
            }
        });
    }
I have one requirement: to make one of the multi select picklist fields as searchable. Meaning as I type the first letter, drop down with that value should be shown. How can that be done. I know it is not possible in Salesforce out of box. Can it be done through lightning components.

Thanks
I have a VF page which creates a new note (related list on event)when we click ' new note' custom button. once the records is created it redirects it back to event page showing certain fields of content note.I want to develop same functionality as mobile(lightning) compatible.Kindly suggest how to proceed.
  • July 02, 2019
  • Like
  • 0
Hi folks ,

I need to send email invoice to particular contacts of a account when I click a quick action button on Account page , it can be one contact or multiple, users will have the ability to select contact . Also having ability to add any extra e-mails id and since its a invoice email an attachment is also to be added which will be queried from attachment object basically  . I was thinking of using flows for this functionality but haven't been able to make sure if this is possible using flows . Can you please help with this ......

Thanks
Hi All,

I have a Custom button which uses Visualforce page with custom controller. Custom controller's save function does some calculations and redirects to Origin record page where my custon button is placed.
VF PAGE:

<apex:page standardController="ABC__c"  extensions="CustomController" action="{!save}">

</apex:page>
 
Custom controller:

public class CustomController {
    
// Constructor and other intializations

    public PageReference save()
    {
        try{
        
           // performing some calculations
            
            //return reference. 
            String returnUrl = URL.getSalesforceBaseUrl().toExternalForm() +'/' + EncodingUtil.URLENCODE(ApexPages.currentPage().getParameters().get(retURL),'UTF-8');        
            return new Pagereference(returnUrl);
			
        }catch(System.DMLException e){
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,e.getDmlMessage(0))); 
            return null;
        }
            
    } 
}




This is working as expected in Salesforce classic. But in Lightening experience the return page is opening in new tab and showing origin page in classic version.  I want to redirect the page to my Origin record page where my custon button is placed in Lightening experience and in the same tab.
Can anyone please help me to achieve this? Thanks in advace.
We wanted to use the Quick Text that is currently available on few built in components, in our Custom lightning component. Is there any way to achieve this? If not, is it in their road map to provide it as an independent component in the component library?
We have a VisualForce page that needs to be displayed on our website through an iframe. The problem is that both Mozilla and Chrome are displaying error message, saying that the connection is not secured. 

"Your connection is not secure
The owner of xyz.force.com has configured their website improperly. To protect your information from being stolen, Firefox has not connected to this website."

I checked the configuration of our site in Salesforce. It looks like HTTPS is enabled. We have a self-signed certificate, but that's it. 

We're using Salesforce Classic and for the moment there's no project to use tools like Canvas or Lightning out...  
Any suggestions? 
Thanks.  
Hi Team,

As we can not create lookup on queues, i have created picklist field named as assignment group where i have given all queues name.
Now i need to change case owner on case based on picklist value selection. like if assignment group is Tech support, i need to assign Tech support queue to case owner field.

Could you please suggest me how to achieve this?
Regards,
Snehal
We are currently looking to onboard different ad management functionalities to our existing Salesforce installation, with a focus on inventory management (print, digital, and out-of-home), sponsorship management in a booking calendar, integration to DSP and DFP, and better line item and granular revenue management.
 
We are looking to build or adapt an integrated inventory management system wherein we can input the data manually as well with integration with other applications

I am trying to use a button inside a lightning component to open a global action. Is this possible?
 

Ultimately the behavior I am looking for is the slide up from bottom left that a global action has. I cant find anything in the docs that has this feature. I keep running into quickAction api and the utility Api.

 

<aura:component implements="force:appHostable, flexipage:availableForAllPageTypes, flexipage:availableForRecordHome, force:hasRecordId" access="global">

  <lightning:quickActionAPI aura:id="quickActionAPI" />

      <lightning:button label="Select Update Case Action" onclick="{!c.fireGlobal}" />


</aura:component>

// Controller
fireGlobal: function (cmp, event, helper) {
    var actionAPI = cmp.find("quickActionAPI");
   // New Contact is a global action
    var args = { actionName: "NewContact" };
    actionAPI.invokeAction(args);
}
I‘ve created a managed package that includes objects with Lightning Record Pages (LRP).

When I attempt to install the managed package in a test environment, I get the error “Small is not a supported form factor" which causes my install to fail.

I’ve traced this error back to the LRP activation.

If I activate a LRP as an Org Default I’m given the option to make it the default for Desktop, Phone, or Desktop and Phone.

I chose Desktop and Phone because why wouldn’t I want users to have a good mobile experience. 

But the Phone / mobile option caused the error.  I verified this by changing the activation to Desktop only and the install worked. 

Interestingly, if I go down the “App, Record Type, and Profile” activation path (some of my objects have different record types with different LRPs) I don’t get an option to choose Phone.  Desktop is the only option.

So, is there a way to activate LRPs for Phone without causing errors? 

If not, any idea why Salesforce give the option of assigning an LRP as the Phone view?   
User cannot upload consent file with large size.
The org file size limit is 6000 000 bytes(6MB).
When user try to upload file with size 3 - 5.7 MB (in allowed limit), the error is displayed  --> Received exception event aura:systemError from server
IF file within 2MB is uploaded, there is no error. This seems to be happening since Spring 19 release.
Any ideas why?
I have a piece of code in my lightning component as follows

pCodeShortDesc = pCodeShortDesc.subtring(0,28);

this return a string like "Nebuent    Inh 300 mg"

I want to remove the two extra white spaces in the above.

Please let me know urgent how to do.

thanks
sheila
We are currently looking to onboard different ad management functionalities to our existing Salesforce installation, with a focus on inventory management (print, digital, and out-of-home), sponsorship management in a booking calendar, integration to DSP and DFP, and better line item and granular revenue management.
 
We are looking to build or adapt an integrated inventory management system wherein we can input the data manually as well with integration with other applications
Hi All,

I am having 2 Lightning Component. 
Lightning Component - A  having Button.
If I am clicking on the button in Lightning Component - A. Lightning Component - B should refresh. 

Do you have any sample codes please post below.
Hello,
We are looking for a Full Stack Salesforce Developer. This is an opportunity to drive the end-to-end build on new Salesforce applications at an industry-leading organization. Check out the link for more information: http://bit.ly/2CRfJbY
  • March 19, 2018
  • Like
  • 1
When swal() is called in a Lightning Component and error is thrown: Uncaught (in promise) TypeError: W.attributes.hasOwnProperty is not a function
Hi,

I want to create a submenu using the lightning component.using existing ui:menu component we can create menu but i need to create submenu of menuitem. Can anyone help me how can i achieve it??
Thanks in advance..