• VSK98
  • NEWBIE
  • 279 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 5
    Likes Received
  • 0
    Likes Given
  • 246
    Questions
  • 136
    Replies
Team - I have a very simple requirement when the lead owner gets changed, the system should send out an email to New Lead Owner.
ISCHANGED(OwnerId)

Using the above formula in the Workflow & Flow, the emails get triggered whenever the system admin did the changes but whenever the Non-System admin does the same changes the email is not triggered.

Thanks,
VSK98
 
  • March 07, 2023
  • Like
  • 0
Team - I have installed Slack on Salesforce successfully but when I tried to install the Salesforce App on Slack getting the below error. Unable to identify the root cause which is something I missed out on in Salesforce. 
We can't connect Salesforce to SlackRegards,
VSK98
  • February 20, 2023
  • Like
  • 0
Hi Guys,

I have a requirement to convert the sign language to voice in Salesforce lightning. Can we do it with any API's ????

Regards,
VSK98
  • September 07, 2022
  • Like
  • 0
Hello All,

Getting the error 
The requested resource does not exist

while creating the leads on UI....Appreciate your help

Regards,
VSK98
  • July 20, 2021
  • Like
  • 0
Hello Guy's,

Is it possible to send out an email to receipient on every 5th case closure.

Appreciate your inputs on the same......

Regars,
VSK98

 
  • July 14, 2021
  • Like
  • 0
Hello All,

I was trying to retrieve the records with using the below dynamic soql query in batch class but getting the errors.

Snippet :
Datetime dt = Datetime.now();
      Datetime dt1 = system.now().addMinutes(59).addSeconds(59);

string SOQL = 'Select Id,status,ManagerId__c,Account,Account1__c,Account2__c,Account3__c, Reminder1__c' +
                        ',Reminder2__c FROM Vehicle__C WHERE status = \" +
						String.escapeSingleQuotes('Submitted') + '\' AND Secondary_Status__c = \" + String.escapeSingleQuotes('Pending') + '\" +
						'AND ((Reminder1__c >=' + dt+ 'AND Reminder1__c <= '+ dt1 +')  OR (Reminder2__c >= '+ dt + 'AND Reminder2__c <=' + dt1 +'))';

Regards,
VSK98​​​​​​​
  • March 17, 2021
  • Like
  • 0
Hello All,

I have written the below snippet code to auto-populate the template when the type is problem.

Snippet:
global class EmailPublisherForCaseType implements QuickAction.QuickActionDefaultsHandler {
    // Empty constructor
    global EmailPublisherForCaseType() {
    }
    
    // The main interface method
    global void onInitDefaults(QuickAction.QuickActionDefaults[] defaults) {
    QuickAction.SendEmailQuickActionDefaults sendEmailDefaults = (QuickAction.SendEmailQuickActionDefaults)defaults.get(0);
    EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject(); 
    
    Case c = [SELECT CaseNumber, Type FROM Case WHERE Id=:sendEmailDefaults.getContextId()];    
    
    // If case type is “Problem,” insert the “First Response” email template
    if (c.CaseNumber != null && c.Type.equals('Problem')) { 
        sendEmailDefaults.setTemplateId('Insert Email Template ID Here');   // Set the template Id corresponding to First Response
        sendEmailDefaults.setInsertTemplateBody(true);
        sendEmailDefaults.setIgnoreTemplateSubject(false);
    }
}

}
Thanks,
VSk98
 
  • December 22, 2020
  • Like
  • 0
Hello All,

I was trying to restructure the static query into a dynamic query but I have been facing few issues...
Snippet Code below:
for(user u : [select id,name,managerId from user where managerId = :UserInfo.getUserId() OR ID =: UserInfo.getUserId()]){
            userMap.put(u.id,u);
            system.debug('userMap '+userMap);
        } 

uid =  userMap.keySet();
   
    String condition = ''+uid;
   condition = condition.removeStart('{');
   condition = condition.removeEnd('}');
   precondition = condition.split( ',' );
        for(string str : precondition){
            str = '\'' + str.trim() + '\'' ;
            fnlcondition.add(str);
        }
    String parentO   = 'Account'; 
    String childO_1   = 'Name'; 
    String childO_2 = 'StageName';
    String childO_3 = 'closeDate';
    String childO_4 = 'Amount';
    String childO_5 = 'Salesstage';
    
    String childATM_1 = 'user.name';
    String childATM_2 = 'TeamMemberRole';
    String childATM_3 = 'AccountId';   
    String childO = 'Opportunity';
    String child1 = 'Accountteammember';
    
    if(childO  == 'Opportunity')
    { childO = 'Opportunities';
    } 
    if(child1  == 'Accountteammember'){ 
     child1 = 'Accountteammembers'; 
    } 
    
    // create dynamic SOQL query string 
    
     String query = 'SELECT id,Name,Type,(select id,' +childO_1+ ',' +childO_2+ ',' +childO_3+ ',' +childO_4+ ',' +childO_5+' from ' +childO+ ') ,(select id,'+childATM_1+',' +childATM_2+ ',' +childATM_3+ ' from '+child1+ ' where UserId IN '+ fnlcondition+ ') FROM ' +parentO +' where ID IN (select ' +childATM_3+ ' from '+' Accountteammember where userID ='+fnlcondition+ ')';
    // query and store  results in variable p 
    system.debug('######'+query);
    
    
    
    
    SObject[] p = Database.query(query);
    
    for(Integer i = 0; i < p.size(); i++){ 
    
    system.debug('Parent result from SOQL query: ' +p[i]);
    
     
    
    //this can  be handled dynamically   
    if(p.get(i).getSObjects(childO) <> null){       
    
    system.debug('Child result(s) from SOQL query: ' +p.get(i).getSObjects(childO));      
    
    }
    if(p.get(i).getSObjects(childO_1) <> null){      
    system.debug('Child result(s) from SOQL query: ' +p.get(i).getSObjects(childO_1));      
    
        
    
    }   
    
    }

Please help me with the same..

Regards,
VSk98
 
  • December 15, 2020
  • Like
  • 0
Hello All,

How to calculate the 5 business date since the record created date in the formula field.

Adv thanks

Regards,
VSk98 
  • November 03, 2020
  • Like
  • 0
Hello Team,

I hv created a login flow, that was embedded into VF Page and it is working as expected. While writing the test class getting the error to cover the SessionManagement Methods.

ERROR:
System.NoAccessException: Invalid Page Redirection: The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance.

Test Class:
@isTest
public class popupcontroller_Test {

 
    static testmethod void loginflow(){
    List<User> lstusers = new list<User>();
    lstusers = Utility.createUser('Business Admin', 1, 'ab'); 
    system.debug('lstusers######'+lstusers);
        string retURL;
        Test.starttest();
         PageReference pageRef = Page.login;
         Test.setCurrentPage(pageRef); 
        popupcontroller popupControllerClass = new popupcontroller();
        popupControllerClass.openPopup();
        popupControllerClass.Cancel(); 
        popupControllerClass.updateRecord();
        
        lstusers[0].Skip_Login_Flow__c = true;
        update lstusers;
        pageref.getParameters().put('retURL', 'home/home.jsp');
        Auth.SessionManagement.finishLoginFlow(retURL);
        popupControllerClass.openPopup();
        popupControllerClass.CurrentRecord();
        Test.stoptest();
    }
}

Base Class:
 
String retURL = apexpages.currentpage().getparameters().get('retURL');
 
            return Auth.SessionManagement.finishLoginFlow(retURL);

Thanks.
VSK98​​​​​​​​​​​​​​
 
  • September 08, 2020
  • Like
  • 0
Hello All,

I'm trying to pass the dynamic url into Auth.SessionManagement.finishLoginFlow as i'm getting the error. Please find the snippet code below.

Apex:
public class VisualFlow {

public PageReference getFinishPage() {
 
// Get the query string of the current request.
System.debug('Query: ' + URL.getCurrentRequestUrl().getQuery());
string retUrl = URL.getCurrentRequestUrl().getQuery();
if(retURL == 'retURL=%2Fhome%2Fhome.jsp'){

    return Auth.SessionManagement.finishLoginFlow('/home/home.jsp');
}

else
{
    retURL = retURL.removeStart('retURL=');
    system.debug('retURL####'+retURL);  
return Auth.SessionManagement.finishLoginFlow(retUrl); ------- Getting error
}
}

}

Error:
System.NoAccessException: Invalid Page Redirection: The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance.

I was hiting the url like this "https://*****.my.salesforce.com/001/o" 

please share your thoughts....
Thanks,
​​​​​​​VSK98
  • August 31, 2020
  • Like
  • 0
Hello All,

I hv created a flow & embedded into Login flow, after flow finished I can see "Your flow Finished" screen & then routed to Home page....Is there any workaround to disappear that message.

Regards,
VSK98
  • August 27, 2020
  • Like
  • 0
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
Hi All,
I have created the formula field for calculating the hours between two datetime fields ........But it not showing exact hrs......My Piece of code
 
TEXT(DATEVALUE (Closed) - DATEVALUE (Open)- 0.2916)
 
IF(
Floor(DATEVALUE (closed)-DATEVALUE (open))*24)>9
(Floor((DATEVALUE (closed)-DATEVALUE (open))*24)),
"0"& TEXT(Floor((DATEVALUE (closed)-DATEVALUE (open))*24))
)

I tried both .......bt i couldn't get it


Pls suggest me

ADV THNXS
VSK98
  • October 13, 2016
  • Like
  • 1
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
Team - I have a very simple requirement when the lead owner gets changed, the system should send out an email to New Lead Owner.
ISCHANGED(OwnerId)

Using the above formula in the Workflow & Flow, the emails get triggered whenever the system admin did the changes but whenever the Non-System admin does the same changes the email is not triggered.

Thanks,
VSK98
 
  • March 07, 2023
  • Like
  • 0
Team - I have installed Slack on Salesforce successfully but when I tried to install the Salesforce App on Slack getting the below error. Unable to identify the root cause which is something I missed out on in Salesforce. 
We can't connect Salesforce to SlackRegards,
VSK98
  • February 20, 2023
  • Like
  • 0
Hello All,

I was trying to retrieve the records with using the below dynamic soql query in batch class but getting the errors.

Snippet :
Datetime dt = Datetime.now();
      Datetime dt1 = system.now().addMinutes(59).addSeconds(59);

string SOQL = 'Select Id,status,ManagerId__c,Account,Account1__c,Account2__c,Account3__c, Reminder1__c' +
                        ',Reminder2__c FROM Vehicle__C WHERE status = \" +
						String.escapeSingleQuotes('Submitted') + '\' AND Secondary_Status__c = \" + String.escapeSingleQuotes('Pending') + '\" +
						'AND ((Reminder1__c >=' + dt+ 'AND Reminder1__c <= '+ dt1 +')  OR (Reminder2__c >= '+ dt + 'AND Reminder2__c <=' + dt1 +'))';

Regards,
VSK98​​​​​​​
  • March 17, 2021
  • Like
  • 0
Hello Team,

I hv created a login flow, that was embedded into VF Page and it is working as expected. While writing the test class getting the error to cover the SessionManagement Methods.

ERROR:
System.NoAccessException: Invalid Page Redirection: The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your salesforce.com Administrator for assistance.

Test Class:
@isTest
public class popupcontroller_Test {

 
    static testmethod void loginflow(){
    List<User> lstusers = new list<User>();
    lstusers = Utility.createUser('Business Admin', 1, 'ab'); 
    system.debug('lstusers######'+lstusers);
        string retURL;
        Test.starttest();
         PageReference pageRef = Page.login;
         Test.setCurrentPage(pageRef); 
        popupcontroller popupControllerClass = new popupcontroller();
        popupControllerClass.openPopup();
        popupControllerClass.Cancel(); 
        popupControllerClass.updateRecord();
        
        lstusers[0].Skip_Login_Flow__c = true;
        update lstusers;
        pageref.getParameters().put('retURL', 'home/home.jsp');
        Auth.SessionManagement.finishLoginFlow(retURL);
        popupControllerClass.openPopup();
        popupControllerClass.CurrentRecord();
        Test.stoptest();
    }
}

Base Class:
 
String retURL = apexpages.currentpage().getparameters().get('retURL');
 
            return Auth.SessionManagement.finishLoginFlow(retURL);

Thanks.
VSK98​​​​​​​​​​​​​​
 
  • September 08, 2020
  • Like
  • 0
Hello All,

I hv created a flow & embedded into Login flow, after flow finished I can see "Your flow Finished" screen & then routed to Home page....Is there any workaround to disappear that message.

Regards,
VSK98
  • August 27, 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 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
I am trying to implement an intermidiary page which will display after login but before landing on the home page. I am using visualforce login flow for that. I tried the example provided in salesforce help page

https://dreamevent.secure.force.com/articleView?id=security_login_flow_visualforce.htm&type=0

However when I login with the user, it shows the following error and the user is stuck here itself. I do not understand what wrong I am doing:

User-added image

Here are the code snippets:
VF Page
<apex:page showHeader="false" controller="VFLoginFlowController">
  <h1>You are in VF Login Flow</h1>
  <apex:form >
    <apex:commandButton action="{!FinishLoginFlowHome}" value="Finish and Go to Home"/>
    <apex:commandButton action="{!FinishLoginFlowStartUrl}" value="Finish and Go to StartUrl"/>
  </apex:form>
</apex:page>

Controller
public class VFLoginFlowController {

    public PageReference FinishLoginFlowStartUrl() {
        //do stuff
        
        //finish the login flow and send you to the startUrl (account page in this case)
        return Auth.SessionManagement.finishLoginFlow('/001');
    }


    public PageReference FinishLoginFlowHome() {
        //do stuff
        
        //finish the login flow and send you the default homepage
        return Auth.SessionManagement.finishLoginFlow();
    }
}

 
<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