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

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 10
    Likes Given
  • 5
    Questions
  • 63
    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,

As I am unable to complete the code coverage in batch apex.
global class countContactRecordsBatch implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext bc) {
        string query='select id,Census_Date__c from hed__Term__c where Census_Date__c=LAST_N_DAYS:1';
        system.debug('query' +query) ;
        return Database.getQueryLocator(query); 
    }
    
    global void execute(Database.BatchableContext bc, List<hed__Term__c> scope){
        
        list<hed__Term__c> termList=[select id from hed__Term__c where Census_Date__c=LAST_N_DAYS:1];
        list<hed__Course_Offering__c> moduleOfferingList=[select hed__Term__r.id,(select hed__Contact__r.id,hed__Program_Enrollment__r.Program__r.id  from hed__Course_Enrollment__r) from hed__Course_Offering__c where hed__Term__r.id IN:termList];
        Map<string,set<string>> termProgramContacts=new Map<string,set<string>>();
        for(hed__Course_Offering__c co:moduleOfferingList) {
            system.debug('Term Id-'+co.hed__Term__r.id);   
            
            for(hed__Course_Enrollment__c ce:co.hed__Course_Enrollment__r){
                string mapKey = co.hed__Term__r.id+'-'+ce.hed__Program_Enrollment__r.Program__r.id;
                if(ce.hed__Program_Enrollment__r.Program__r.id!=null){
                    if(termProgramContacts.containsKey(mapKey)){
                        set<string> existingValue = termProgramContacts.get(mapKey);
                        existingValue.add(ce.hed__Contact__r.id);
                        termProgramContacts.put(mapKey, existingValue);
                    }                       
                    else{
                        set<string> newValue = new set<string>();   
                        newValue.add(ce.hed__Contact__r.id);
                        termProgramContacts.put(mapKey,newValue);
                    }
                }
            }
        }
            
            system.debug('Program Contact- '+termProgramContacts);
            list<hed__Term__c> termProgramList=new list<hed__Term__c>();
            list <Program_Session__c> programSessionList = new list <Program_Session__c>();
            termProgramList=[select id,(select id,Program__r.id from Program_Sessions__r) from hed__Term__c where id IN:termList];
            Map<string,integer> updateCount = new Map<string,integer>();
            for(hed__Term__c termProgram:termProgramList){
                for(Program_Session__c ps:termProgram.Program_Sessions__r){
                    string tpKey = termProgram.id+'-'+ps.Program__r.id;
                    if(termProgramContacts.containsKey(tpKey)){
                        integer contactCount = termProgramContacts.get(tpKey).size();
                        integer existingCount = 0;
                        if(updateCount.containsKey(ps.id)){
                            existingCount = updateCount.get(ps.id);                         
                        }
                        updateCount.put(ps.id,contactCount+existingCount);//progran term id and count
                        system.debug('updateCount'+updateCount.values().size());
                    }
                    ps.Total_enrolments_actual__c=updateCount.get(ps.Id);
                    programSessionList.add(ps);
                    system.debug('Total_enrolments_actual__c' +ps.Total_enrolments_actual__c);                    
                    system.debug('termProgramList ' +termProgramList);            
                }
            }
            if(programSessionList!=null && !programSessionList.isEmpty()){
                update programSessionList;
                
                
            }
        
    }
            global void finish(Database.BatchableContext BC){
                
            }

       
    //code end
    
   
}
===
Test class
=====

@isTest
public class countContactRecordsBatchTest {
    
    static testMethod void contactRecords(){
        
        list<Program_Session__c> psList=new list<Program_Session__c>();
        list<Account> acc=new list<Account>();
        list<hed__Term__c> termList=new list<hed__Term__c>();//term 
        list<Program__c> programList=new list<Program__c>();
        list<hed__Course_Offering__c> mcList=new list<hed__Course_Offering__c>();
        list<hed__Course__c> courseList=new list<hed__Course__c>();
        list<hed__Program_Enrollment__c> prEnrollmentList=new list<hed__Program_Enrollment__c>();
        list<Contact> consList=new list<contact>();
        
        
        Account a=new account();
        a.Name='Test Account';
        acc.add(a);
        
        insert acc;
        
        hed__Term__c te=new hed__Term__c();
        te.Name='test term';
        te.hed__Account__c=acc[0].id;
        te.Census_Date__c=date.today();
        termList.add(te);
        insert termList;//Term
        
        Program__c pc=new Program__c();
        pc.Name='test program ';
        programList.add(pc);//Program ..
        
        
        //insert module offering
        hed__Course_Offering__c mc=new hed__Course_Offering__c();
        hed__Course__c cou=new hed__Course__c();
        cou.name='test course';
        cou.hed__Account__c=acc[0].Id;
        courseList.add(cou);
        insert courseList;
        
        mc.Name='Test Module Offering';
        mc.hed__Course__c=courseList[0].id;
        mc.hed__Term__c=termList[0].id;
        mcList.add(mc);
        
        
        //Insert contact
        contact con=new contact();
        con.lastName='test contact Name';
        consList.add(con);    
        
        
        //program Enrollment
        hed__Program_Enrollment__c pe=new hed__Program_Enrollment__c();
        pe.Program__c=programList[0].id;
        pe.hed__Contact__c=consList[0].id;
        prEnrollmentList.add(pe);
        
        
        Program_Session__c ps=new Program_Session__c();
        ps.Term__c=termList[0].id;
        //     ps.Program__c=programList[0].id;
        ps.Program__c=programList[0].id;
        //ps.Total_enrolments_actual__c=1;
        psList.add(ps);
        database.insert (psList,false);
        
        list<Program_Session__c> prs=[select id ,Term__r.id,Program__r.id,Total_enrolments_actual__c from Program_Session__c];
        for(Program_Session__c pccc:prs){
            pccc.Total_enrolments_actual__c=10;
        }
        
        test.startTest();
        
        database.SaveResult []sr=database.update(prs,false);
        countContactRecordsBatch obj=new countContactRecordsBatch();
        database.executeBatch(obj);
        test.stopTest();
    }
    
}

As I am getting 44% code coverage on it.
Any suggestions.

Thanks
Hay, 
Im new to "SOQL". And I had to interdgete website with salsforce. 
I need to get data in one query like that.
"select id,name, (select id,name,student__c,(SELECT Id,Name FROM student__r) from Sponsorships__r) from contact WHERE RecordTypeId='0126A000000MAV6QAO'"


My question is, in this query "student__c" related to the "Account" object. I need to get that account detail and after again inside I need to get that account related "Contact" table data.

another way to explain
1. need to get "contact" data  RecordTypeId='0126A000000MAV6QAO'
2. with that I need to get "SponsorshipNEW__c" related data. Re.ship.name ="Sponsorships__r"
3. and "SponsorshipNEW__c" object have an Id "student__c" this is Related to the "Account" object. I need to get that account Object also.
4. Next to that particular Account have the "Contact" table Id. I need to get that too.
Please give me is that posible to do. 
Need to get as an outer join query
 
For me if I go to settings it is showing like below how to create a namespace there is no edit 

Please check below image help me how I can create it 
User-added image
There is no Edit option that is what is showing for me in my org account
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);

    }
})


 
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.
In Aura, we can do
$A.get('e.force:refreshView').fire();
to cause standard components to update.

How can we do an equivalent in LWC because sfdx refuses to publish .js code with $A in it saying the usage is disallowed in LWC?

For now i tricked it with 
eval("$A.get('e.force:refreshView').fire();");
but that is obviously less than ideal....
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.  
Hello,

I am using lightning:datatble to display some list i have a requirement to use filters like start date end date and 2 picklist values ,user can choose any combination to update the list can any one suggest better design ?
Hi everyone,

Does anyone know the different badges that can be achieved by contributing to this forum (newbie, smartie, etc) and how many points match each level?

Regards,
Fred
 
Hay, 
Im new to "SOQL". And I had to interdgete website with salsforce. 
I need to get data in one query like that.
"select id,name, (select id,name,student__c,(SELECT Id,Name FROM student__r) from Sponsorships__r) from contact WHERE RecordTypeId='0126A000000MAV6QAO'"


My question is, in this query "student__c" related to the "Account" object. I need to get that account detail and after again inside I need to get that account related "Contact" table data.

another way to explain
1. need to get "contact" data  RecordTypeId='0126A000000MAV6QAO'
2. with that I need to get "SponsorshipNEW__c" related data. Re.ship.name ="Sponsorships__r"
3. and "SponsorshipNEW__c" object have an Id "student__c" this is Related to the "Account" object. I need to get that account Object also.
4. Next to that particular Account have the "Contact" table Id. I need to get that too.
Please give me is that posible to do. 
Need to get as an outer join query
 
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?
Hello,

I am using lightning:datatble to display some list i have a requirement to use filters like start date end date and 2 picklist values ,user can choose any combination to update the list can any one suggest better design ?
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..