• Sumitk
  • NEWBIE
  • 40 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 7
    Replies
checked="{!IF(isWebAppActive == false,"checked","")}"

I am using this code to check/uncheck checkbox on VFpage but it is giving me this error.

Element type "input" must be followed by either attribute specifications, ">" or "/>".

How can I check/uncheck checkbox on VF page?

 

  • November 12, 2020
  • Like
  • 0
User-added image
I want to create a list view like this image for mobile devices. I tried this using grid in the code. 
<div class="slds-grid slds-wrap pd-5">
                    <div class="slds-col slds-size_3-of-4">
                        <div class="slds-col">
                            Amazing enterprise
                        </div>
                        <div class="slds-col">
                            Amazing enterprise
                        </div>
                        <div class="slds-col">
                            Amazing enterprise
                        </div>
                    </div>
                    <div class="slds-col slds-size_1-of-4 slds-float_right slds-grid_align-center">
                        0.25
                    </div>
                </div>
But unable to achieve it. Is this possible using grid? Or should I use a table instead? I also want to avoid scrolling in smaller devices.
  • October 28, 2020
  • Like
  • 0
Created a visualforce page containing a canvas app then checked "Available for Lightning Experience, Lightning Communities, and the mobile app".
<apex:page >
 
    <apex:canvasApp namespacePrefix="" developerName="klientsumit" parameters="{showPage:'timesheet'}"/>
 
</apex:page>
But still it is not available in mobile navigation menu item list.
User-added image
I cannot understand what I am missing. Please help.
 
  • October 07, 2020
  • Like
  • 0
I created a connected app with canvas app signed request enabled. This canvas app is used in multiple visualforce pages. I have a nodeapp which receives the signed request. Now I want to identify which visualforce page the signed request came. How would I do that? 
  • October 05, 2020
  • Like
  • 0
I created a canvas app that also runs on Salesforce android app. How can my canvas app detect if its running on Salesforce android/ios app or not?
  • September 28, 2020
  • Like
  • 0
I have a canvas app that has its own header and side navigation bar for mobile devices. When I open the canvas app from Salesforce mobile app then I am getting two headers and navigation bars as shown here.
User-added image
I want to hide Salesforce navigation bar when I open my canvas app. Or is there any another solution. Please Help.
  • September 28, 2020
  • Like
  • 0
import { LightningElement, api } from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { loadStyle, loadScript } from 'lightning/platformResourceLoader';

import { createRecord, updateRecord, deleteRecord } from 'lightning/uiRecordApi';

// Static resources
import GanttFiles from '@salesforce/resourceUrl/gantt616E';

import getTasks from '@salesforce/apex/GanttCmpController.getTasks';

import {dummyData} from './dummyLoadData';

function unwrap(fromSF){
    const data = fromSF.tasks.map(a => ({
        id: a.Id,
        text: a.Name,
        start_date: a.CreatedDate,
        duration: a.Krow__Due_Date__c
    }));
    
    return { data };
}

export default class GanttCmp extends LightningElement {
    static delegatesFocus = true;

    @api height =  800;
    ganttInitialized = false;
    loadAllProjects = false;
    
    gantt;
    root;

    renderedCallback() {
        console.log('call---------->>> renderedCallback  ');
        if (this.ganttInitialized) {
            return;
        }
        this.ganttInitialized = true;

        Promise.all([
            loadScript(this, GanttFiles + '/codebase/dhtmlxgantt.js'),
            loadScript(this,'./ganttCommons'),
            loadStyle(this, GanttFiles + '/codebase/dhtmlxgantt.css'),
            loadStyle(this, GanttFiles + '/codebase/skins/dhtmlxgantt_material.css')
        ]).then(() => {
            this.initializeUI();
        }).catch((error,a,b,c,d) => {
            console.error(error);
            this.dispatchEvent(
                new ShowToastEvent({
                    title: 'Error loading Gantt',
                    message: error.message,
                    variant: 'error',
                }),
            );
        });
    }

    initializeUI(){
        console.log('call---------->>> initializeUI  ');
        this.root = this.template.querySelector('.thegantt');
        this.root.style.height = this.height + "px";

        gantt = window.Gantt.getGanttInstance();
        gantt.templates.parse_date = date => new Date(date);
        gantt.templates.format_date = date => date.toISOString();
        gantt.init(this.root);

        gantt.parse(dummyData);

        gantt.createDataProcessor({
            task: {
                create: function(data) {
                    console.log('data====>>> ',JSON.stringify(data));
                    const insert = { apiName: "Krow__Task__c", fields:{
                        Name : data.text
                       
                    }};
                    return createRecord(insert).then(res => {
                        return { tid: 1, ...res };
                    });
                },
                update: function(data, id) {
                    const update = { fields:{
                        Id: id,
                        Name : data.text
                    }};
                    return updateRecord(update).then(() => ({}));
                },
                delete: function(id) {
                    return deleteRecord(id).then(() => ({}));
                }
             }
        }).init(gantt);
    }
}

User-added imageWhen I added loadScript(this,'./ganttCommons') then caught exception without error object. I can understand what is the error. Please explain.
  • September 25, 2020
  • Like
  • 0
In LWC we write HTML template to add event handler like this.
<template>
    <input type="text" value={myValue} onchange={handleChange} />
</template>
but I want to write this code just like in vanilla HTML like
<template>
    <input type="text" value={myValue} onchange=handleChange() />
</template>
My final HTML generated should be the same.
 
  • September 21, 2020
  • Like
  • 0
User-added imageI need to make multiple request apex method in order to fetch data in bulk on Visualforce page. So I made ajax request in for loop. Chrome enforces a maximum of six TCP connections per host. If I am requesting twelve items at once, the first six will begin and the last half will be queued. How can I resolve this problem. Does LWC fixes this issue?
  • September 15, 2020
  • Like
  • 0
I need to make a lot of Ajax request in my VFPage so I made Ajax request in a for loop. But in network tab in chrome it looks like only 4 Ajax requests can be made at a time and rest of the request are queued. How can I increase that or is there another way to achieve the same.
  • September 14, 2020
  • Like
  • 0
Is there any trailhead or tutorial to create or optimize Salesforce app that can work on large datasets and complex database operations? Currently when we do a lot of SOQL operations the response time gets worse. Please help
  • September 14, 2020
  • Like
  • 0
I have deployed the source of LWC component using sfdx force:source:push command and I need to open my LWC component in Developer Console defined like 
export default class GanttView extends LightningElement
How can I edit it using Developer Console?
  • September 11, 2020
  • Like
  • 0
I accidently pushed a github lwc repository using sfdx force:source:push command. I need to undo everything.I tried force:source:deploy:cancel but its too late now. Please help.
  • September 10, 2020
  • Like
  • 0
I need to approve bulk records so that I can set status of records as submitted. I used jsForce to approve records but it can only submit 1 record at a time.
Is there any other library or native APIs that can do the same?
  • August 19, 2020
  • Like
  • 0
I need to create monthly report of my data for my each and every user.  So there could be lots of records if there are lots of user. These records are normally created by a batch process running weekly as an example that runs for hours to calculate all the monthly utilization records for each user.
.
I do not want to compromise with performance of my application especially on peak hours. 

So should I continue with the batch process or do the same in real time using triggers? Or is there any other better way to achieve the same? 
  • August 13, 2020
  • Like
  • 0
Looks like there is problem with space. I am unable to resolve it. There are 590 error in this code. Please advise.
@RestResource(urlMapping='/Testings') 
global without sharing class chromeExtensionAPI {
    
    @HttpGet
    global static String doGet() {
        System.debug('---GET--');
        wrapperClass wc = new wrapperClass();
        wc.name= UserInfo.getName();
        wc.email =UserInfo.getUserEmail();
        return JSON.serialize(wc);
    }
    @HTTPPost
    global static string getDataFromApp(){
        responseDataWrapper rw = new responseDataWrapper();
        rw.success =false;
        system.debug('----POST-----');        
        system.debug( RestContext.request.params);
        system.debug( RestContext.request.params.get('op_type'));
        system.debug( RestContext.request.params.get('username'));
        system.debug( RestContext.request.params.get('task_id'));
        String op_type = RestContext.request.params.get('op_type');
        String username = RestContext.request.params.get('username');       
        String task_id = RestContext.request.params.get('task_id');
        String newstatus = RestContext.request.params.get('op_status');   
        String sort_field = RestContext.request.params.get('sort_field'); 
        String sort_order = RestContext.request.params.get('sort_order'); 
        String searchkey = RestContext.request.params.get('searchkey') != null ? RestContext.request.params.get('searchkey') : '' ; 
        if(op_type != null && username != null){
            switch on (op_type){
                when 'gettask' {
                    System.debug('gettask');
                    rw.success = true;
                    List<TaskWrapper> lsttask = getusertasks(sort_field,sort_order,searchkey);
                    if(lsttask.size() > 0){                        
                        rw.taskData = lsttask;
                    }else{
                       rw.errormsg = 'No Task Found for User : '+username;
                    }
                }
                when 'updatestatus' {
                    System.debug('updatetask');
                    if(task_id != null && newstatus != null ){
                        String responString = updateusertasks(task_id, newstatus);
                        rw.success = true;
                        rw.errormsg = responString;
                        if(!responString.startsWith('Error:')){
                            rw.updatesuccess = true;
                            List<TaskWrapper> lsttask = getusertasks(sort_field,sort_order,'');
                            if(lsttask.size() > 0){
                                rw.taskData = lsttask;
                            }else{
                               rw.errormsg = 'No Task Found for User : '+username;
                            }
                        }
                    }else{
                       rw.errormsg = 'No Task Detail found for Task ID : '+task_id+' AND Status :'+newstatus ;
                    }                    
                }                                            
                when else {
                    System.debug('none of the above');
                    rw.errormsg = 'User operation is not found.';
                }                        
            }
        }else{
            rw.errormsg = 'Error: Missing require Data op_type:'+op_type+' username: '+username;
        }
        System.debug('>>>>>>rw');
        System.debug(rw);
        rw.picklistValues = getStatuslist();
        return JSON.serialize(rw);
    }

    global static  List<TaskWrapper>  getusertasks (String sortCase,String sort_order ,string searchkey) {
        list<TaskWrapper> lstTaskWrapper = new list<TaskWrapper>();
        String query = 'SELECT Id,Name,Project__c,Project__r.Name,Account__c,Account__r.Name,Start_Date__c,Due_Date__c,Status__c FROM Task__c where OwnerId= \''+UserInfo.getUserID()+'\' AND Due_Date__c != null AND Start_Date__c != null AND Status__c != \'Completed\' And (Project__c = null OR  (Project__r.Public_Project_Template__c = false AND Project__r.Project_Template__c = false and Project__r.Archived__c = false and Project__r.Project_Status__c != \'Canceled\' AND complete__c = false)) ';            
        if(searchkey != ''){
            query +=' AND Name like \'%'+searchkey+'%\'';
        }
        switch on sortCase {
            when 'taskname' {
                query +=' ORDER BY Name ';                              
            }
            when 'projectname'{
                query +=' ORDER BY Project__r.Name ';
            }
            when 'accountname'{
                query +=' ORDER BY Account__r.Name ';
            }
            when 'startdate' {
                query +=' ORDER BY Start_Date__c ';
            }
            when 'duedate'{
                query +=' ORDER BY Due_Date__c ';
            }
            when 'taskstatus'{
                query +=' ORDER BY Status__c ';
            }                                           
            when else {
                query +=' ORDER BY Name '; 
                System.debug('sortCase'+sortCase);
            }
        }
        if(sort_order == 'asc'){
           query += ' ASC NULLS LAST';
        }else{
           query += ' DESC NULLS LAST';
        }        
        query +=' limit 50';     
        system.debug('Query');
        system.debug(query);
        list<Task__c> listTask = Database.query(query);
        if(listTask != null){
            for(Task__c taskTeamp : listTask ){
                TaskWrapper tWrapper = new TaskWrapper();
                tWrapper.taskId = taskTeamp.Id;
                tWrapper.taskName = taskTeamp.Name;
                tWrapper.projectId = taskTeamp.Project__c;
                tWrapper.accountId = taskTeamp.Account__c;
                tWrapper.projectName = taskTeamp.Project__r.Name;
                tWrapper.accountName= taskTeamp.Account__r.Name;
                tWrapper.taskStartDate = String.valueOf(taskTeamp.Start_Date__c.format());
                tWrapper.taskDueDate = String.valueOf(taskTeamp.Due_Date__c.format());
                tWrapper.taskStatus = taskTeamp.Status__c;
                lstTaskWrapper.add(tWrapper);
            }
        }
        return lstTaskWrapper;
    }    
   
    global static  String  updateusertasks (String taskId ,String newstatus){
        String resultString = 'Error';
        String query = 'SELECT Id,Name,Project__r.Name,Start_Date__c,Due_Date__c,Status__c FROM Task__c where id= \''+taskId+'\' AND complete__c = false ';             
        Task__c singleTask = Database.query(query);
        singleTask.Status__c = newstatus;
        try{
            update singleTask;
            resultString = 'Task updated successfully.';
        }
        catch(DmlException e){
            resultString = 'Error: In Updateing Task :'+e.getMessage();
        }       
        return resultString;
    }
    
    
    global static map<String,String> getStatuslist(){
     map<String,String> options = new map<String,String>();
            
       Schema.DescribeFieldResult fieldResult = Task__c.Status__c.getDescribe();
       List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
            
       for( Schema.PicklistEntry f : ple){
          options.put(f.getLabel(), f.getValue());
       }       
       return options;
    }
    
    global class wrapperClass {
        String name;
        String email;
        String username;
    }

    global class responseDataWrapper {
        list<TaskWrapper> taskData;
        map<String,String> picklistValues;
        Boolean success;
        Boolean updatesuccess;
        String errormsg;
    }
    
    global class TaskWrapper {
        String taskId;
        String taskName;
        String projectName;
        String accountName;
        String projectId;
        String accountId;
        String taskStartDate;
        String taskDueDate;
        String taskStatus;
        
    }          
}

User-added image
User-added imagewhy am I getting this error?
If we use multiple SOQL query in Apex controller then is there any way to execute them in a asynchronous/multi-threaded fashion ?
    <apex:canvasApp developerName="klientsumit"  namespacePrefix="" canvasId="klientsumit"
         width="100%" scrolling="no"  onCanvasAppLoad="fixWidth()"
         />
    <script type="text/javascript"src="https://org62.my.salesforce.com/canvas/sdk/js/30.0/controller.js">
             
        function fixWidth(){
            window.addEventListener("message", function(event) {
                // Handle message
                console.log('inside event');
                console.log(event.data);
            }, false);
             
// Target a specific canvas app
Sfdc.canvas.controller.publish({name : 'mynamespace.myevent',
                                payload : {}, 
                                target : {canvas : 'klientsumit'}});
             
// Subscribe to a single event.
Sfdc.canvas.controller.subscribe({name : 'mynamespace.myevent', 
                                  onData : function (e) {
                                      console.log('inside subscribe ondata');
                                      console.log(e);
                                  }});
        
// Target a specific canvas app
Sfdc.canvas.controller.publish({name : 'mynamespace.myevent',
                                payload : {}, 
                                target : {canvas : 'klientsumit'}});
             
             if(document.referrer.indexOf(".lightning.force.com") > 0 ) {
                //document.querySelector('.sfdcBody').style.margin='0px';
                document.querySelector('.sfdcBody').style.padding='0px';
                document.querySelector('a[name="skiplink"]').style.display='none';
               }else{
                document.querySelector('.noSidebarCell').style.padding='0px';                
               }
        }
        function resizeApp(){
            try{
                var target = {canvas : "klientsumit"};
                if(document.referrer.indexOf(".lightning.force.com") > 0 ) {
                    var heightOfApp = (screen.height - 90 - 40 - 142)+"px";
                    Sfdc.canvas.parent.resize( {height : heightOfApp}, target);
                } else{
                    if(document.getElementById('AppBodyHeader') && document.getElementsByClassName('bPageFooter').length > 0){
                        var heightOfApp = (screen.height - document.getElementById('AppBodyHeader').offsetHeight - document.getElementsByClassName('bPageFooter')[0].offsetHeight - 142)+"px";
                        Sfdc.canvas.parent.resize( {height : heightOfApp}, target);
                    }
                }
            }catch(e){
                console.log(e);
                var target1 = {canvas : "krowapp__klientsumit"};
                if(document.referrer.indexOf(".lightning.force.com") > 0 ) {
                    var heightOfApp = (screen.height - 90 - 40 - 142)+"px";
                    Sfdc.canvas.parent.resize( {height : heightOfApp}, target1);
                } else{
                    if(document.getElementById('AppBodyHeader') && document.getElementsByClassName('bPageFooter').length > 0){
                        var heightOfApp = (screen.height - document.getElementById('AppBodyHeader').offsetHeight - document.getElementsByClassName('bPageFooter')[0].offsetHeight - 142)+"px";
                        Sfdc.canvas.parent.resize( {height : heightOfApp}, target1);
                    }
                }
            }
            
        }
        
    </script>
User-added image
I want to create a list view like this image for mobile devices. I tried this using grid in the code. 
<div class="slds-grid slds-wrap pd-5">
                    <div class="slds-col slds-size_3-of-4">
                        <div class="slds-col">
                            Amazing enterprise
                        </div>
                        <div class="slds-col">
                            Amazing enterprise
                        </div>
                        <div class="slds-col">
                            Amazing enterprise
                        </div>
                    </div>
                    <div class="slds-col slds-size_1-of-4 slds-float_right slds-grid_align-center">
                        0.25
                    </div>
                </div>
But unable to achieve it. Is this possible using grid? Or should I use a table instead? I also want to avoid scrolling in smaller devices.
  • October 28, 2020
  • Like
  • 0
In LWC we write HTML template to add event handler like this.
<template>
    <input type="text" value={myValue} onchange={handleChange} />
</template>
but I want to write this code just like in vanilla HTML like
<template>
    <input type="text" value={myValue} onchange=handleChange() />
</template>
My final HTML generated should be the same.
 
  • September 21, 2020
  • Like
  • 0
User-added imagewhy am I getting this error?
I want to display user profile picture in my nodejs connected app. It is working on chrome due to some sort of caching but its not working on safari for iphone/ipad and even when I use web container for android and ios.
I have a node application deployed on heroku that authenticates with salesforce using oauth2 webflow using connected app. I want to create a tab in salesforce that directly lands to the homepage of node app after authenticating with the logged in salesforce user. Initially I created a web tab but due to content security policy I was unable to load the page. Then I tried creating a canvas app but it also causes mixed content problem as we are redirected to http instead of https during oauth2 webflow. Is there any other way to achieve this?