• VSK98
  • NEWBIE
  • 279 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 234
    Questions
  • 129
    Replies
Hello All,

I'm converting the Json string into map<string,string>, getting the error System.JSONException: Illegal value for primitive: Class.System.JSON.deserialize.

Snippet for response:
 
{"attributes":{"type":"AggregateResult"},"ParentId":"0012v000030DpaDAAS","expr0":701.0}

Apex code:
 
map<string, string> accounts = (map<string, string>) JSON.deserialize(js, map<string, string>.class);

Please share your thoughts...

Regards,
VSK98​​​​​​​
  • June 22, 2020
  • Like
  • 0
Hello All,

I have a requirement like in each account record there is a amount field, i would like to SUM of total amount & store into the ultimate parent.

As of nw, i can able to get ultimate parent using trigger but i dont knw how to traverse from ultimate to child levels.

Regards,
VSK98
 
  • June 22, 2020
  • Like
  • 0
Hello All,

In my object, there is one rollup summary field to calculate the sum of the currency. I have created one normal currency field called Total CURRENCY. I have create the flow and calculating the all rollup summary fields in the child org but auto currency conversion not happening. Can i utilise the same CurrencyRate() in flow.

Note: I can't create another rollup summary field to calculate the  SUM.

Objects: Account vs Account ....

Flow is working but Auto Currency Conversion not happening like Account1 = 100 USD
Account2 = 100 EURO
Account3 = 200 IND

getting total = 400 ....is there any workaround to fix.

Regards,
VSK98
  • June 14, 2020
  • Like
  • 0
Hello All,
 
I'm not able see "All Internal Users"  public group when i searched in public group from list view.. And also I'm nt able to add list view into changeset.

Regards,
VSK98
  • May 30, 2020
  • Like
  • 0
Hello All,

I would like to update the field in contact when the user selected the existing contact during lead conversion using out of box ....

Adv thanks.

Regards,
VSK98
  • May 25, 2020
  • Like
  • 0
Hello All,

Getting the error "The formula expression is invalid: Syntax error. Found ','" on PB when i used the formula expression.

Snippet:
IF([Object__c].amount__c <>  null, [Object__c].amount__c ,0)

Thanks,
VSK98​​​​​​​
  • May 11, 2020
  • Like
  • 0
Hello All,

I have a requirement like below....

I would like to share Account hierarchy (Self Realtionship) records to other users which is not possible in sharing settings...Do we hv any alternate methods to achieve the same.

Account Hierarchy ----> Need to share all child records (multi level childs)

Regards,
VSK98
  • April 22, 2020
  • Like
  • 0
Hello All,

I'm trying to write the dynamic parent to child query but getting the error

Snippet Code:
 
String childF   = 'Name'; 
String childO_1 = 'Opportunity'; 
String childF_1   = 'Name'; 
string childO = 'Contacts';
string parentO = 'Account';
string conid = '0035E00000x067Y';
 

// create dynamic SOQL query string 

String query = 'SELECT id, (select ' +childF+ ' from ' +childO+ ' WHERE id = ' + conid + ')   FROM Account';
system.debug('SOQL query: ' +Database.query(query));

Error:
XCEPTION_THROWN [12]|System.QueryException: expecting a right parentheses, found 'E00000x067Y'

Thanks,
VSK98​​​​​​​
  • April 08, 2020
  • Like
  • 0
Hello All,

Getting the null value in RestRequest.params.get in base class. 

Apex Class Snippet:
 
@RestResource(urlMapping='/getContactdetails/*')
global class RESTServiceDemoClass {
    
    @HttpGet
    global static list<Contact> getContactList() {
        String strAccId = '';
        String strLeadSource = '';
        list<Contact> lstCons;
        RestRequest restReq = RestContext.request;
        RestResponse restRes = RestContext.response;
        // Reading parametrs from URL
        strAccId = restReq.params.get('accountId');
        strLeadSource = restReq.params.get('leadSource');
        if(!String.isBlank(strAccId) && !String.isBlank(strLeadSource)) {
            lstCons = [Select Id, Name, Email FROM Contact WHERE AccountId =:strAccId AND LeadSource =: strLeadSource];
        }
        return lstCons;
    }
}

Test Class:
RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
	    req.requestURI = '/services/apexrest/api/getContactdetails?'; 
		
        req.addParameter('accountId', contact.accountid);
  req.addParameter('leadSource', 'test');
        req.httpMethod = 'GET';
        RestContext.request = req;
        RestContext.response = res;

Thanks.
VSK98​​​​​​​
  • March 30, 2020
  • Like
  • 0
Hello All,

Getting the error when the user clicks on the list view button on Account....

I need to pass  selected records from javascript button to lightning component. So i have created one List View Button.

And also i have created the VF Page / Apex class...below is snippet code
<apex:page standardController="Account" recordSetVar="accs" extensions="VFC_ProcessAccRecords" action="{!redirectToLC}"  lightningStylesheets="true"/>
 
public class VFC_ProcessAccRecords {
      
      public List<Account> selAccLst;
      public String accIds;

      // Constructor
      public VFC_ProcessAccRecords(ApexPages.StandardSetController cntlr){
           selAccLst = cntlr.getSelected(); //get selected records from account list view
           accIds = '';  
           for(Account acc : selAccLst){
               accIds += acc.Id + ','; //build list of ids string concatenated with comma                         
            }
           accIds = accIds.removeEnd(','); 
      } 

      public PageReference redirectToLC(){
      
            String returnUrl = '/lightning/cmp/c__Custom_List_View_Process?c__listofAccounts='+accIds;
            PageReference pgReturnPage = new PageReference(returnUrl);
            pgReturnPage.setRedirect(true);
            return pgReturnPage;
       
          
      }

  }

And also i have created the lightning component

Lightning Component:
 
<aura:component implements="lightning:isUrlAddressable" access="global">
    <aura:attribute name="listofAccounts" type="List" />
    <aura:handler name="init" value="{!this}" action="{!c.onPageReferenceChange}"/>
    <lightning:card title="Account List">
        <aura:iteration items="{!v.listofAccounts}" var="item">
            <p class="slds-p-horizontal_small"> Account Id {!item} </p>
        </aura:iteration>       
    </lightning:card>     
</aura:component>
 
({
    onPageReferenceChange: function(cmp, evt, helper) {
        alert('alert');
        var myPageRef = cmp.get("v.pageReference");
        var accs = myPageRef.state.c__listofAccounts;
        alert(accs.length);
        console.log('listofAccounts',JSON.stringify(accs));
      //  cmp.set("v.listofAccounts",accs);
        //split the account ids by comma and continue logic
    }
})

the values are passing but getting the error "This page isn't available in Salesforce Lightning Experience or mobile app." 

Regards,
VSK98
  • March 17, 2020
  • Like
  • 0
Hello All,

I have written a sample batch to update the field and its working but i'm nt able to cover the code coverage. I'm getting System.QueryException: unexpected token:  '2020-03-10' ...
please find the snippet below.
global class batchAccountUpdateSLA implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext BC) {
      
      Date d = system.today();
        String query = 'SELECT Id,Name FROM Account where After1day__c =:' + d;
        return Database.getQueryLocator(query);
    }
   
    global void execute(Database.BatchableContext BC, List<Account> scope) {
         for(Account a : scope)
         {
             a.SLA__c= 'Gold';            
         }
         update scope;
    }   
    
    global void finish(Database.BatchableContext BC) {
    }
}

Test Class:
 
@isTest
 public class batchAccountUpdateSLA_Test{
 Static testmethod void batchAccountUpdateSLA_TestMethod(){
 
 Date d = system.today().addDays(3);
     Account acc = new Account();
     acc.name = 'Test';
     acc.Fax = '12345';
     insert acc;
      Test.StartTest(); 
      batchAccountUpdateSLA bacth = new batchAccountUpdateSLA ();
      ID batchprocessid = database.Executebatch(bacth ); 
      Test.StopTest();
    }
  }

Regards,
VSK98
  • March 10, 2020
  • Like
  • 0
Hello All,

I'm trying to get the Date (YYYY-MM-dd) format without GMT  in apex code but no luck...some blogs are saying we can achieve thru string but i want in Date

Ex: Date --> 2020-03-06 bt i'm getting 2020-03-06 00:00:00

Regards,
VSK98
  • March 06, 2020
  • Like
  • 0
Hello All,

Getting System.QueryException: unexpected token: '2020-03-05' while running the batch class.
 
Date d = date.today();
String soql = 'SELECT id,date__C, Status  FROM Lead WHERE date__C =:' +
                      d + ' OR 10days__C =:' + d;
Regards,
VSK98
  • March 05, 2020
  • Like
  • 0
Hello All,

I have created the Process builder & updating the few fields based on the rule cretria....Ischanged function is working when cretria like this 
ISCHANGED([Lead].Email ) ) || ([Lead].Email <> null &&  [Lead].SkipPB__c = false )

But when u add one condition like this 
ISCHANGED([Lead].Email ) ) || ([Lead].Email <> null &&  [Lead].SkipPB__c = false ) || ([Lead].Email <> null &&  [Lead].listed__c = true )

the process builder is not firing even the email id is changed ...

please help me with the above 

Regards,
VSK98  
  • March 03, 2020
  • Like
  • 0
Hello All,

I hv created the custom Add Product button, In lightning it launches the classic view instead of the lightning view after a click on the replica Add product button.
 
https://********.salesforce.com/p/opp/SelectSearch?addTo={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}

Please help me with the same.

Regards,
VSK98
  • November 18, 2019
  • Like
  • 0
Hello All,

I am overriding the standard clone button with VF Page. In classic, it's working as expected but in lightning it's updating the same record instead of cloning the record. Please find the snippet code below.
 
<apex:page standardController="Lead" extensions="Lead_overrideCloneController" tabStyle="Lead" action="{!redirect}" lightningStylesheets="True">
    <apex:form >
        <apex:pageBlock rendered="{!okbutton}">
            <apex:pagemessages ></apex:pagemessages>
            <apex:pageBlockButtons location="Bottom">
                <apex:commandButton immediate="TRUE" action="{!okbuttonAction}" value="OK"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
 
public with sharing class Lead_overrideCloneController {
    Public Boolean okbutton{get;set;}
    Id leadRTId;
    Id idProfileId;
    Id LeadId;
    Profile userProfile = new Profile();
    public Lead_overrideCloneController(ApexPages.StandardController controller) {
        
           
    idProfileId = UserInfo.getProfileId();
    userProfile = [Select Id, Name from Profile where Id = :idProfileId];
    LeadId= ApexPages.currentPage().getParameters().get('Id');

       
    }
    public pagereference okbuttonAction(){
      
       return null;
    }
    public pagereference redirect(){
        
        PageReference pr = ApexPages.currentPage();
        
            Map<String, String> params = pr.getParameters();
            system.debug('##### --> Sivparams'+params.keySet());
           
           String stringToAppend = '';
            for(String keyStr : params.keySet()){
                if(keyStr != 'core.apexpages.devmode.url' &&
                    keyStr != 'sfdc.override' &&
                    keyStr != 'save_new' &&
                    keyStr != 'scontrolCaching'){
                    if(stringToAppend != '') {
                        stringToAppend += '&';
                    }   
                    
                    stringToAppend += keyStr + '='+ EncodingUtil.urlEncode(params.get(keyStr),'UTF-8');
                }   
            }
          
            system.debug('##### --> Siv'+'/'+LeadId+'/e?nooverride=1&'+stringToAppend);
            return new PageReference('/'+LeadId+'/e?nooverride=1&'+stringToAppend);
            
        }
       
        
    }

Please share your thoughts....

Regards,
VSK98
  • October 25, 2019
  • Like
  • 0
Hello All,

I have a requirement like this, 

As of now, we are displaying Text(String) and the Biz wants to convert into the Lookup. The Data we getting from third-party DB, not from Salesforce. Is it Possible?

Regards,
VSK98
  • June 03, 2019
  • Like
  • 0
Hello All,

I am trying to insert account record on ONLOAD of the page with dynamic Lightning:recordEditForm but i could n't able to crack it. Could you please guide me where i did mistake.

Snippet:
 
init: function(component, event, helper) {
        // First, create children
        $A.createComponents([
            ["lightning:inputField", { fieldName: "Name", value: "Test"}],
            ["lightning:inputField", { fieldName: "Industry", value: "Test" }]
        ], (components, status, errors) => {
            // Then parent, specifying body of lightning:inputFields
            $A.createComponents(
            [["lightning:recordEditForm", { objectApiName: "Account", body: components }]], 
                            (components, status, errors) => {
         
            component.set("v.recordEdit", components); // i can able to view the fields on UI
            console.log('#####'+JSON.stringify(components));
            component.find("createAccountForm").submit();
             //var payload = event.getParams().response;
       // console.log('#####'+JSON.stringify(payload));
                                
                            });
        });
    }

Regards,
VSK98
  • May 10, 2019
  • Like
  • 0
Hello All,

How to create the dynamic Lightning Data service component when clicking on the button.

Regards,
VSK98
 
  • May 08, 2019
  • Like
  • 0
Hello All,

How to insert the account record in catch block in JS controller without calling Apex.

Adv thanks,

Regards,
VSK98
  • May 08, 2019
  • Like
  • 0
Hi All,

I have Created sample Visual Flow and calling from Custom button. The logic is jsut creating Account Records. And I have a workflow when ever Account is created, updating the field in Account.

So when ever i ran the flow from button after the submitting the flow. I got the above error.
So i deactivated the workflow then the flow works fine. Can any one know why this is happened. Please help me out.

Error :
 
Flow Details
Flow Name: Sample_Account_Create
Type: Flow
Version: 1
Status: Inactive
Flow Interview Details
Interview Label: Sample Account Create 27/7/2016 7:35 PM
Current User: siva kumar (00590000003L0bm)
Start time: 27/7/2016 7:35 PM
Duration: 18 seconds
How the Interview Started
siva kumar (00590000003L0bm) started the flow interview.
SCREEN: Submit_Account_Details
Textbox: Account_Name
Label: Account Name
Value at run time: TestFlowRecord1

Number: Fax
Label: Fax
Value at run time: 554,646

Long Text Area: Description
Label: Description
Value at run time: 

Selected Navigation Button: NEXT
RECORD CREATE: Create_Record
Create one Account record where:
Description = {!Description} ()
Fax = {!Fax} (554,646)
Name = {!Account_Name} (TestFlowRecord1)
Result
Failed to create record.


Regards,
VSK
  • July 27, 2016
  • Like
  • 1
Hi,

i have one SOQL query like 
SELECT id FROM businesshours WHERE Name = 'UK'
Is it possible to get using dynamic apex...........................

Adv Thnx
VSK
  • April 25, 2016
  • Like
  • 1
Hi All,

Is it possible to run the scheduler class every one minute.............Because my req comes like only


Notifications need to send every 1 hr,2 hrs , 3 hr & 4 hrs
The record might be created at every minute in a hour.....
 
  • March 15, 2016
  • Like
  • 1
Hi,

I am new to Angular js.......i have been building new vf page with angular page ..Facing to not getting output 

Here is my Page

<apex:page applyHtmlTag="false" sidebar="false" showHeader="false">
 <apex:form>
  <apex:includescript value= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"/>

 <body>
  <script>
   angular.module('app',[]);
   .controller('Basic Controller', function()){
       this.name ="siva";
   
   }
   this.Hello: = function Hello:(){
   
   return this.name}
  </script>
   
   <div ng-app="app" ng-controller="Basic Controller">
   <p>Type the Your Name: </p>
   <p>Name: <input type="text" ng-model="name" placeholder="Enter your name"/></p>
       Hello: {{name}} 
   </div>
  </body>
   
</apex:form>
</apex:page>

Here am not getting my name as siva in Hello: siva

User-added image
  • October 20, 2015
  • Like
  • 1
Hello All,

I'm trying to write the dynamic parent to child query but getting the error

Snippet Code:
 
String childF   = 'Name'; 
String childO_1 = 'Opportunity'; 
String childF_1   = 'Name'; 
string childO = 'Contacts';
string parentO = 'Account';
string conid = '0035E00000x067Y';
 

// create dynamic SOQL query string 

String query = 'SELECT id, (select ' +childF+ ' from ' +childO+ ' WHERE id = ' + conid + ')   FROM Account';
system.debug('SOQL query: ' +Database.query(query));

Error:
XCEPTION_THROWN [12]|System.QueryException: expecting a right parentheses, found 'E00000x067Y'

Thanks,
VSK98​​​​​​​
  • April 08, 2020
  • Like
  • 0
Hello All,

Getting the error when the user clicks on the list view button on Account....

I need to pass  selected records from javascript button to lightning component. So i have created one List View Button.

And also i have created the VF Page / Apex class...below is snippet code
<apex:page standardController="Account" recordSetVar="accs" extensions="VFC_ProcessAccRecords" action="{!redirectToLC}"  lightningStylesheets="true"/>
 
public class VFC_ProcessAccRecords {
      
      public List<Account> selAccLst;
      public String accIds;

      // Constructor
      public VFC_ProcessAccRecords(ApexPages.StandardSetController cntlr){
           selAccLst = cntlr.getSelected(); //get selected records from account list view
           accIds = '';  
           for(Account acc : selAccLst){
               accIds += acc.Id + ','; //build list of ids string concatenated with comma                         
            }
           accIds = accIds.removeEnd(','); 
      } 

      public PageReference redirectToLC(){
      
            String returnUrl = '/lightning/cmp/c__Custom_List_View_Process?c__listofAccounts='+accIds;
            PageReference pgReturnPage = new PageReference(returnUrl);
            pgReturnPage.setRedirect(true);
            return pgReturnPage;
       
          
      }

  }

And also i have created the lightning component

Lightning Component:
 
<aura:component implements="lightning:isUrlAddressable" access="global">
    <aura:attribute name="listofAccounts" type="List" />
    <aura:handler name="init" value="{!this}" action="{!c.onPageReferenceChange}"/>
    <lightning:card title="Account List">
        <aura:iteration items="{!v.listofAccounts}" var="item">
            <p class="slds-p-horizontal_small"> Account Id {!item} </p>
        </aura:iteration>       
    </lightning:card>     
</aura:component>
 
({
    onPageReferenceChange: function(cmp, evt, helper) {
        alert('alert');
        var myPageRef = cmp.get("v.pageReference");
        var accs = myPageRef.state.c__listofAccounts;
        alert(accs.length);
        console.log('listofAccounts',JSON.stringify(accs));
      //  cmp.set("v.listofAccounts",accs);
        //split the account ids by comma and continue logic
    }
})

the values are passing but getting the error "This page isn't available in Salesforce Lightning Experience or mobile app." 

Regards,
VSK98
  • March 17, 2020
  • Like
  • 0
Hello All,

I have written a sample batch to update the field and its working but i'm nt able to cover the code coverage. I'm getting System.QueryException: unexpected token:  '2020-03-10' ...
please find the snippet below.
global class batchAccountUpdateSLA implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext BC) {
      
      Date d = system.today();
        String query = 'SELECT Id,Name FROM Account where After1day__c =:' + d;
        return Database.getQueryLocator(query);
    }
   
    global void execute(Database.BatchableContext BC, List<Account> scope) {
         for(Account a : scope)
         {
             a.SLA__c= 'Gold';            
         }
         update scope;
    }   
    
    global void finish(Database.BatchableContext BC) {
    }
}

Test Class:
 
@isTest
 public class batchAccountUpdateSLA_Test{
 Static testmethod void batchAccountUpdateSLA_TestMethod(){
 
 Date d = system.today().addDays(3);
     Account acc = new Account();
     acc.name = 'Test';
     acc.Fax = '12345';
     insert acc;
      Test.StartTest(); 
      batchAccountUpdateSLA bacth = new batchAccountUpdateSLA ();
      ID batchprocessid = database.Executebatch(bacth ); 
      Test.StopTest();
    }
  }

Regards,
VSK98
  • March 10, 2020
  • Like
  • 0
Hello All,

I have created the Process builder & updating the few fields based on the rule cretria....Ischanged function is working when cretria like this 
ISCHANGED([Lead].Email ) ) || ([Lead].Email <> null &&  [Lead].SkipPB__c = false )

But when u add one condition like this 
ISCHANGED([Lead].Email ) ) || ([Lead].Email <> null &&  [Lead].SkipPB__c = false ) || ([Lead].Email <> null &&  [Lead].listed__c = true )

the process builder is not firing even the email id is changed ...

please help me with the above 

Regards,
VSK98  
  • March 03, 2020
  • Like
  • 0
Hello All,
How to disable the Help& Training, Support & Global Actions etc using Profiles in lightning?
User-added image
Regards,
VSK98
  • March 18, 2019
  • Like
  • 0
Hello All,

I have created the Profile & disabled all EDIT/READ permission in profile. But the lightning user can label to view the Email Template Object.
User-added imagePlease let me know how to fix the issue.

Adv thanks,
Regards,
VSK98
  • March 18, 2019
  • Like
  • 0
<aura:method name="myMethod" action="{!c.executeMyMethod}">
     	<aura:attribute name="Cname" type="string" default="test"/> 
        <aura:attribute name="city" type="string" /> 
         <aura:attribute name="Assetcnt" type="string" />
         <aura:attribute name="CustomerId" type="string" />
         <aura:attribute name="children" type="list" />
         </aura:method>

Hi All,

I have created the Aura: Method tag, under I declared few attributes with default values. When i am trying to access the attributes with their name getting UNDEFINED values.

Aura: Method
<aura:method name="myMethod" action="{!c.executeMyMethod}">
     	<aura:attribute name="Cname" type="string" default="test"/> 
        <aura:attribute name="city" type="string" /> 
         <aura:attribute name="Assetcnt" type="string" />
         <aura:attribute name="CustomerId" type="string" />
         <aura:attribute name="children" type="list" />
         </aura:method>

JS Controller:
executeMyMethod : function(component, event, helper) {
         console.log('Beforeset: '+ component.get("v.myMethod"));  --- Undefined
          console.log('Beforeset: '+ component.get("v.Cname")); --- Undefined
         console.log('Beforeset: '+ component.get("v.myMethod.Cname")); --- Undefined
}

Regards,
VSK98​​​​​​​

 
  • December 20, 2018
  • Like
  • 0
Hi All,

I am getting the error when I run the test class.
System.JSONException: Unexpected character ('C' (code 67)): was expecting comma to separate OBJECT entries

I have created the mock class, in that I am sending the body as below.
 
res.setBody('{"value": [{'+
        '"groupid": 1,'+
       '"group_name": "Test",'+
        '"sub_customer": "[{\"CustomerId\":\"9488491\",\"CustomerName\":\"Test\",\"Street\":\"Test\",\"City\":\"PENRITH\",\"PostalCode\":\"275\",\"Country\":\"Test\",\"Assetcnt\":\"6\"}]"}]}');

I am getting the error in Apex class
SearchResult obj=(SearchResult)JSON.deserialize(resp.getBody(), SearchResult.class);

Wrapper class :
 
Public class value{
        
        @AuraEnabled
        public Integer groupid {get; set;}
        @AuraEnabled
        public string group_name {get; set;}
        @AuraEnabled
        public String sub_customer {get; set;}
        
        
    }
    
    public class SearchResult {
        @AuraEnabled
        public List<value> value;
        
        public SearchResult(List<value> liList) {
            value = liList.clone();
        }
    } 
    
    Public class Value_out{
        @AuraEnabled
        public string group_name;
        @AuraEnabled
        public string groupid;
        //srini-added for parent level sum of assets
         @AuraEnabled
        public String sumofAssets;
        @AuraEnabled
        public list<sub_customer> children;
    }
    public class sub_customer{
        @AuraEnabled
        public string CustomerName;
        @AuraEnabled
        public string CustomerId;
        @AuraEnabled
        public string Street;
        @AuraEnabled
        public string City;
        @AuraEnabled
        public string PostalCode;
        @AuraEnabled
        public string Country;
        @AuraEnabled
        public string Assetcnt;
    }

Regards,
VSK98​​​​​​​
 
  • December 12, 2018
  • Like
  • 0
Hi All,

How to convert the below response into custom response using JSON
{
	"groupid": null,
	"group_name": null,
	"children": [{
		"Street": "PRINCES HIGHWAY",
		"PostalCode": "2538",
		"CustomerName": "MILTON ULLADULLA HOSPITAL",
		"CustomerId": "94107804",
		"Country": "Australia",
		"City": "MILTON",
		"Assetcnt": "0"
	}, {
		"Street": "COWPER STREET",
		"PostalCode": "2502",
		"CustomerName": "PORT KEMBLA HOSPITAL",
		"CustomerId": "94105686",
		"Country": "Australia",
		"City": "WARRAWONG",
		"Assetcnt": "0"
	}, {
		"Street": "Great Western Highway",
		"PostalCode": "2790",
		"CustomerName": "THE NEW LITHGOW HOSPITAL",
		"CustomerId": "94107702",
		"Country": "Australia",
		"City": "LITHGOW",
		"Assetcnt": "0"
	}, {
		"Street": "Shoalhaven Road",
		"PostalCode": "2540",
		"CustomerName": "SHOALHAVEN DISTRICT MEMORIAL HOSPIT",
		"CustomerId": "9487942",
		"Country": "Australia",
		"City": "NOWRA",
		"Assetcnt": "0"
	}]
	
}

IF Groupid== null then I have to remove those fields and the expected response is below
"children": [{
		"Street": "PRINCES HIGHWAY",
		"PostalCode": "2538",
		"CustomerName": "MILTON ULLADULLA HOSPITAL",
		"CustomerId": "94107804",
		"Country": "Australia",
		"City": "MILTON",
		"Assetcnt": "0"
	}]
	 "children": [{
		"Street": "COWPER STREET",
		"PostalCode": "2502",
		"CustomerName": "PORT KEMBLA HOSPITAL",
		"CustomerId": "94105686",
		"Country": "Australia",
		"City": "WARRAWONG",
		"Assetcnt": "0"
	}]
	"children": [{
		"Street": "Great Western Highway",
		"PostalCode": "2790",
		"CustomerName": "THE NEW LITHGOW HOSPITAL",
		"CustomerId": "94107702",
		"Country": "Australia",
		"City": "LITHGOW",
		"Assetcnt": "0"
	}]
	"children": [{
		"Street": "Shoalhaven Road",
		"PostalCode": "2540",
		"CustomerName": "SHOALHAVEN DISTRICT MEMORIAL HOSPIT",
		"CustomerId": "9487942",
		"Country": "Australia",
		"City": "NOWRA",
		"Assetcnt": "0"
	}]
Regards,
VSK98
 
  • December 08, 2018
  • Like
  • 0
Hi All,

How can we display the nested JSON values in lightning:treegrid. I am getting values from Apex to lightning when I checked the console. 
Please find the attached screenshot.
User-added image
Column names:
component.set('v.tablecolumns', [
                {label: 'Group name', fieldName: 'group_name', type: 'text'},
            	{label: 'GroupId', fieldName: 'groupid', type: 'number'},
            	{label: 'CustomerId ', fieldName: 'Subcustomer.CustomerId ', type: 'text'},
                {label: 'Name', fieldName: 'CustomerName ', type: 'url',
                typeAttributes: {label: { fieldName: 'CustomerName' }, target: '_blank'}},
                {label: 'Street', fieldName: 'Subcustomer__r.Street', type: 'text'},
                {label: 'City', fieldName: 'City', type: 'text'},
        		{label: 'Post Code', fieldName: 'postalcode', type: 'text'},
        		{label: 'Country', fieldName: 'Country', type: 'text'},
       		    {label: 'No of Assets', fieldName: 'Assetcnt', type: 'text'},
            	
            ]);

I have tried with Subcustomer__r & Subcustomer. also but no results.

Regards,
VSK98
  • December 05, 2018
  • Like
  • 0
Hi All,

I am working JSON Parsing which is very new to me. I am getting the response and deserialized by using below method.
Map<String, Object> deSer = (Map<String, Object>) JSON.deserializeUntyped(resp.getbody());
Response Body is below:
{
	value = ({
		group_name =  *******,
		groupid = 1,
		sub_customer = [{
			"CustomerId": "9488490",
			"CustomerName": "*******",
			"Street": "*******,"
			City ":"
			KINGSWOOD ","
			PostalCode ":"
			******* ","
			Country ": Australia",
			"Assetcnt": "0"
		}, {
			"CustomerId": "9488491",
			"CustomerName": "*******",
			"Street": "*******,"
			City ":"
			PENRITH ","
			PostalCode ":"
			******* ","
			Country ": Australia",
			"Assetcnt": "0"
		}, {
			"CustomerId": "94106344",
			"CustomerName": "*******",
			"Street": "*******,"
			City ":"
			KINGSWOOD ","
			PostalCode ":"
			******* ","
			Country ": Australia",
			"Assetcnt": "0"
		}, {
			"CustomerId": "94126502",
			"CustomerName": "*******",
			"Street": "DERBY STREET,"
			City ":"
			KINGSWOOD ","
			PostalCode ":"
			******* ","
			Country ": Australia",
			"Assetcnt": "0"
		}, {
			"CustomerId": "94106486",
			"CustomerName": "*******",
			"Street": "*******,"
			City ":"
			KINGSWOOD ","
			PostalCode ":"
			******* ","
			Country ": Australia",
			"Assetcnt": "0"
		}, {
			"CustomerId": "9488489",
			"CustomerName": "*******",
			"Street": "*******,"
			City ":"
			PENRITH ","
			PostalCode ":"
			******* ","
			Country ": Australia",
			"Assetcnt": "0"
		}]
	})
}

I would like to get a list of Sub_Customers by using below method which is getting NULL Values.
 
List<Object> lstObj = (List<Object>) deSer.get('sub_customer');

Once I get the list<Object> I need to pass to Lightning: Datatable to display as a tree Grid view.

Regards,
VSK98
 
  • December 03, 2018
  • Like
  • 0
Hi All,

I have created one lightning tab & one test App for one profile. I kept default app is the test.  Whenever the user logins the salesforce, it should redirect to Lightning Page(Lightning Tab). I couldn't find any default tab settings in the app.

Please suggest me.........

Regards,
VSK98
  • November 30, 2018
  • Like
  • 0
Hi All,

I am unable to display the records using Lightning:treeGrid. The data has passing from apex controller to JS Controller but data not displayed.
Was anything missed over there?

LightningComponent:
 
<aura:component implements="force:appHostable" 
                controller="Nested_JSONController">
 
    
    <aura:attribute name="gridColumns" type="List" />
    <aura:attribute name="gridData" type="Object" />

    
    <aura:handler name="init" value="{!this}" action="{!c.onLoad}"/>
    
    <lightning:treeGrid columns="{! v.gridColumns }"
        data="{! v.gridData }"
        keyField="Id"
        aura:id="mytree"
    />
        

</aura:component>

JS Controller:
({
    onLoad : function(component, event, helper) {
        var columns = [
            {
                type: 'double',
                fieldName: 'totalPrice',
                label: 'totalPrice'
            },
            {
                type: 'datetime',
                fieldName: 'statementDate',
                label: 'statementDate'
            },
            {
                type: 'double',
                fieldName: 'unitPrice',
                label: 'unitPrice'
            },
            {
                type: 'double',
                fieldName: 'quantity',
                label: 'quantity'
            },
            
        ];
        component.set('v.gridColumns', columns);
        var action = component.get("c.Nested_JSON");
        action.setCallback(this, function(response){
            var state = response.getState();
            if ( state === "SUCCESS" ) {
            alert(state);
                var data = response.getReturnValue();
               console.log(data);
                component.set('v.gridData', data);
            }
        });
        $A.enqueueAction(action);
    }

})

Apex Classes:
 
public class InvoiceWrapper_L {
    public class LineItem {
        @AuraEnabled
        public Double unitPrice {get; set;}
        @AuraEnabled
        public Double quantity {get; set;}
        @AuraEnabled
        public String productName {get; set;}

        public Double getLineItemTotal() {
            return this.unitPrice * this.quantity;
        }
    }

    public class Invoice {
        @AuraEnabled
        public Double totalPrice {get; set;}
        @AuraEnabled
        public DateTime statementDate {get; set;}
        @AuraEnabled
        public String contactnumber {get; set;}
        @AuraEnabled
        public List<LineItem> lineItems {get; set;}
        @AuraEnabled
        public Integer invoiceNumber {get; set;}
    }
    @AuraEnabled
    public List<Invoice> invoiceList {get; set;}
}
 
public class Nested_JSONController {
   
    @AuraEnabled
    public static InvoiceWrapper_L Nested_JSON() {
     
    InvoiceWrapper_L wrapper ;
        Http h = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndPoint('https://docsample.herokuapp.com/jsonSample');
        request.setHeader('Content-type', 'application/json');
        request.setMethod('GET');

        HttpResponse response = h.send(request);

        wrapper = (InvoiceWrapper_L) JSON.deserializeStrict(response.getBody(), InvoiceWrapper_L.class);
        system.debug('@@@@@'+wrapper);
        return wrapper;
    }
}

Regards,
VSK98
  • November 29, 2018
  • Like
  • 0
Hi All,

I am displaying the list of records using datatable but values not displaying correctly under column name. 

Image:
User-added image

Adv Thnx,
Regards,
VSK98
  • November 24, 2018
  • Like
  • 0
Hi All,

I have to build custom logout functionality when the user clicks on the toggle button. 
I have tried with lightning:buttonmenu but when the user clicks on toggle button the username disappears.

Snippet below:
 
<p class="slds-page-header__title slds-m-right_small slds-align-middle slds-truncate"  title="test" style="color:white">TEST
            <span ><div class="slds-float_right"> {!v.userInfo.Name}
      <lightning:buttonMenu aura:id="menu" onselect="{! c.handleSelect }" alternativeText="Show menu">
        <lightning:menuItem value="Logout" label="Logout" />
      </lightning:buttonMenu></div></span></p>
Controller:
handleSelect: function (cmp, event, helper) {
        
       // var selectedMenuItemValue = event.getParam("value");
         window.location.href= 'https://test.salesforce.com'; 
      
    }
Actual Page: Actual Page

Username Disappear:
disappear

Regards,
VSK98
  • November 24, 2018
  • Like
  • 0
Hi All,

How to disable the Wrap or Clip text in Lightning Datatable?

Adv Thanks:)

Regards,
VSK98
  • November 14, 2018
  • Like
  • 0