• Raghu Sharma 6
  • NEWBIE
  • 55 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 18
    Replies
I need to verify whether a batch (actually inbound email handler) has been run each day and if the batch is not run for a particular day, I need to send an email notification.

Is there any config way, I can set some flag before the anticipated time of batch run and reset the flag in batch.
After batch run anticipated time, I want to verify flag and if flag is not reset (which means batch did not run), I need to send an email
Is it possible to set the flag using workflow? Is it possible to verify flag and send email using workflow?
So, basically I'm trying to see if workflow can be run like a scheduled batch job for this simple task?
 
When should we go for APEX REST API instead of standard REST API? What is the best practice?
Standard Salesforce REST API:
When we provide access to external system (thru connected app), will the profile security assigned to the integration user controls the security? Like if the profile does not access to a field, when external system tries to access this field, will it be allowed?
How do we restrict external system to access certain objects only?
a. What is the equivalent of apex:inputHidden in lightning components?

b. I'm planning to implement TypeAhead/Predictive search to show the results from database/api calls. Any inputs/sample code on the approach to be followed?

 
I have built a lightning component with list of cities in a table and also showing map with all the cities plotted on map. I want to zoom into map based on user clicking/hovering on a particular value in table

How to capture the event when user is clicking or hovering over data in table in lightning component?
In which scenarios should we put the logic in apex controller vs java script controller

For eg: For making salesforce SOQL/DML statements, we can put the logic apex controller. Similarly, where should be put the logic for REST API calls? When should we use apex controller? Whar are the best practices
I want to add a button to clone the existing record. What is the easy and best approach to add code to my below code to make it work? Do we need controller extension to achieve this?
 
<apex:page StandardController="Account">
  
  hello {!$User.LastName}
  
  <apex:form >  
      <apex:pageBlock >
          <apex:pageBlockSection >
              <apex:inputfield value="{!account.name}"/>
              <apex:inputfield value="{!account.AccountNumber}"/>              
          </apex:pageBlockSection>
          <apex:pageblockButtons >
               <apex:commandButton rendered="{!IF($CurrentPage.parameters.id !=null,true,false)}" action="{!save}" value="Save Account"/>
               <apex:commandButton rendered="{!IF($CurrentPage.parameters.id ==null,true,false)}" action="{!save}" value="Save Account"/>
          </apex:pageblockButtons>
      </apex:pageBlock>
  </apex:form>
  
</apex:page>

 
I need to create a VF Page for Account for creating, viewing and editing records. What is the best approach to handle the fields for opening them for edit and view only mode? Can we use the same VF page to handle all the scenarios? How to code controller logic to handle multiple scnearios(save, edit and view)?
I'm calling external Rest API and recieving the output in the form of JSON. What is the best/easiest way to process this output in Apex?

I see that DOM (Document Object Model) approach only works with XML. Is there any standard function to convert JSON to XML?

Also see that there is a direct way of processing JSON as shown in below URL:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_jsonparser.htm

Any sample code to process JSON output will be greatly helpful
I'm calling external Rest API and recieving the output in the form of JSON. What is the best/easiest way to process this output in Apex?

I see that DOM (Document Object Model) approach only works with XML. Is there any standard function to convert JSON to XML?

Also see that there is a direct way of processing JSON as shown in below URL:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_jsonparser.htm

Any sample code to process JSON output will be greatly helpful
 
How do you test the functionality related to enterprise/partner WSDLs provided to other systems? As we need to imitate as if the updates/inserts are coming from other system, what tools do you use for testing?

We are currently using SoapUI for testing this. I want to understand better/newer ideas/approaches in this regard.
I need to create a list button on 'contact related list' under Account object. I want to write a java script to check whether the account billing state is 'CA'. I want to execute further logic (apex page/apex class) only if the condition matches. But when I tried this below logic, it didnt work.and I see that Account id is not being displyed when I tried to display it. What is missing here? how to get the account id on this button logic?
 
{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")} 

var AcctId = '{!Contact.Account}';
var Bill_State = sforce.connection.query("Select State__c From Account WHERE Id = '{!Contact.Account}'");
var rec = Bill_State.getArray("records");

if(rec[0].State__c == 'CA') 
{
alert("This is CA.");
//will replace later with logic to call vf page/apex class
}
else
{
alert("This is not CA");
}

 
I have created a custom button on account to delete current account record when some conditions are met. When I click on custom button, it calls Apex Page which in turn calls Controller extension to delete the record. I have written below test class to test it. code is working good when I try to delete the record from VF page but when I try the same in test class, record is not getting deleted. System.assertequals is failing as isdeleted is returning 'false'. What am I missing here?
My VFPage:
<apex:page StandardController="Account" Extensions="MyCtrlextn" action="{!FunctiontoDelete}">
         <apex:PageMessages />
</apex:page>

My Apex Class:
public class MyCtrlExtn
{
   private ApexPages.standardcontroller stdCtrl;

   public MyCtrlExtn(ApexPages.Standardcontroller std)
   {
      stdCtrl=std;
   }

   public PageReference FunctionToDelete()
   {
     Account Acc =(Account) stdctrl.getRecord();
      return stdCtrl.delete();
   }
}
My Test Class:

@isTest
private class testClass {    
        static Account testAcc  = new Account ();          
        testAcc.Name = 'TestAccount';
        insert testAcc;
     
  static testMethod void testDel() {
         Test.startTest();
         Test.setCurrentPage(Page.MyVFPage);
        ApexPages.StandardController sc = new ApexPages.StandardController(testAcc);
        MyCtrlExtn TE = new MyCtrlExtn(sc);
        Pagereference pr = TE.FunctionToDelete();
        Account DelAcc = [select id,isdeleted from Account where id =: testAcc.id All rows];
        System.Assertequals(DelAcc.isdeleted, true);
        Test.stopTest();
    }
   
}


 
I have created a custom button on account to delete current account record when some conditions are met. When I click on custom button, it calls Apex Page which in turn calls Controller extension to delete the record. I have written below test class to test it. What logic needs to put in system.assertequals to confirm that record is deleted.

@isTest
private class testClass {    
    static Account testAcc  = new Account ();          
        testAcc.Name = 'TestAccount';
         insert testAcc;
     static testMethod void testDel() {
         Test.startTest();
         Test.setCurrentPage(Page.MyVFPage);
        ApexPages.StandardController sc = new ApexPages.StandardController(testAcc);
        MyCtrlExtension TE = new MyCtrlExtension(sc);
        Pagereference pr = TE.FunctionToDeleteRecord();
        System.assertEquals(?, ?);
        Test.stopTest();
    }
   
}
I'm planning to do bulk load using data loader (enabling 'USE Bulk API' in settings). As data loader parallely runs multiple batches at a time, how can we handle hierarchies (for eg, account hierarchy) for the object? I mean to say, if the parent account is not loaded yet, child account will fail saying parent is not found. How can we handle this situation?

 
I need to import Accounts and Contacts from external system. I have defined external ids on both contact and accounts. I have to load accounts with external id first and then load each contact with external id of account with which it needs to establish relationship. Is this how it works? It did not work for me. Please help.

Eg: I have loaded account 'Oil Corporation' with external id as 'AAAA' 
After account is successfully loaded, I have loaded two contacts 'PersonA' and 'PersonB' with exteral id as 'AAAA' and they got successfully loaded but are not connected to account. I did specify that the relationship to be used on exernal id 
In which scenarios should we put the logic in apex controller vs java script controller

For eg: For making salesforce SOQL/DML statements, we can put the logic apex controller. Similarly, where should be put the logic for REST API calls? When should we use apex controller? Whar are the best practices
I need to verify whether a batch (actually inbound email handler) has been run each day and if the batch is not run for a particular day, I need to send an email notification.

Is there any config way, I can set some flag before the anticipated time of batch run and reset the flag in batch.
After batch run anticipated time, I want to verify flag and if flag is not reset (which means batch did not run), I need to send an email
Is it possible to set the flag using workflow? Is it possible to verify flag and send email using workflow?
So, basically I'm trying to see if workflow can be run like a scheduled batch job for this simple task?
 
a. What is the equivalent of apex:inputHidden in lightning components?

b. I'm planning to implement TypeAhead/Predictive search to show the results from database/api calls. Any inputs/sample code on the approach to be followed?

 
In which scenarios should we put the logic in apex controller vs java script controller

For eg: For making salesforce SOQL/DML statements, we can put the logic apex controller. Similarly, where should be put the logic for REST API calls? When should we use apex controller? Whar are the best practices
I need to create a VF Page for Account for creating, viewing and editing records. What is the best approach to handle the fields for opening them for edit and view only mode? Can we use the same VF page to handle all the scenarios? How to code controller logic to handle multiple scnearios(save, edit and view)?
I'm calling external Rest API and recieving the output in the form of JSON. What is the best/easiest way to process this output in Apex?

I see that DOM (Document Object Model) approach only works with XML. Is there any standard function to convert JSON to XML?

Also see that there is a direct way of processing JSON as shown in below URL:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_json_jsonparser.htm

Any sample code to process JSON output will be greatly helpful
I have created a custom button on account to delete current account record when some conditions are met. When I click on custom button, it calls Apex Page which in turn calls Controller extension to delete the record. I have written below test class to test it. code is working good when I try to delete the record from VF page but when I try the same in test class, record is not getting deleted. System.assertequals is failing as isdeleted is returning 'false'. What am I missing here?
My VFPage:
<apex:page StandardController="Account" Extensions="MyCtrlextn" action="{!FunctiontoDelete}">
         <apex:PageMessages />
</apex:page>

My Apex Class:
public class MyCtrlExtn
{
   private ApexPages.standardcontroller stdCtrl;

   public MyCtrlExtn(ApexPages.Standardcontroller std)
   {
      stdCtrl=std;
   }

   public PageReference FunctionToDelete()
   {
     Account Acc =(Account) stdctrl.getRecord();
      return stdCtrl.delete();
   }
}
My Test Class:

@isTest
private class testClass {    
        static Account testAcc  = new Account ();          
        testAcc.Name = 'TestAccount';
        insert testAcc;
     
  static testMethod void testDel() {
         Test.startTest();
         Test.setCurrentPage(Page.MyVFPage);
        ApexPages.StandardController sc = new ApexPages.StandardController(testAcc);
        MyCtrlExtn TE = new MyCtrlExtn(sc);
        Pagereference pr = TE.FunctionToDelete();
        Account DelAcc = [select id,isdeleted from Account where id =: testAcc.id All rows];
        System.Assertequals(DelAcc.isdeleted, true);
        Test.stopTest();
    }
   
}


 
I have created a custom button on account to delete current account record when some conditions are met. When I click on custom button, it calls Apex Page which in turn calls Controller extension to delete the record. I have written below test class to test it. What logic needs to put in system.assertequals to confirm that record is deleted.

@isTest
private class testClass {    
    static Account testAcc  = new Account ();          
        testAcc.Name = 'TestAccount';
         insert testAcc;
     static testMethod void testDel() {
         Test.startTest();
         Test.setCurrentPage(Page.MyVFPage);
        ApexPages.StandardController sc = new ApexPages.StandardController(testAcc);
        MyCtrlExtension TE = new MyCtrlExtension(sc);
        Pagereference pr = TE.FunctionToDeleteRecord();
        System.assertEquals(?, ?);
        Test.stopTest();
    }
   
}
I'm planning to do bulk load using data loader (enabling 'USE Bulk API' in settings). As data loader parallely runs multiple batches at a time, how can we handle hierarchies (for eg, account hierarchy) for the object? I mean to say, if the parent account is not loaded yet, child account will fail saying parent is not found. How can we handle this situation?

 
I need to import Accounts and Contacts from external system. I have defined external ids on both contact and accounts. I have to load accounts with external id first and then load each contact with external id of account with which it needs to establish relationship. Is this how it works? It did not work for me. Please help.

Eg: I have loaded account 'Oil Corporation' with external id as 'AAAA' 
After account is successfully loaded, I have loaded two contacts 'PersonA' and 'PersonB' with exteral id as 'AAAA' and they got successfully loaded but are not connected to account. I did specify that the relationship to be used on exernal id