• Jon Guliker
  • 0 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 2
I was trying to find a way to get a screen flow on a record page to update when a record was edited. I copied the Apex code for a lightning component linked in this article: https://douglascayers.com/2017/07/17/keep-flows-and-data-in-sync-on-lightning-record-pages/.
The component refreshs a Visualforce page when it detects edits to the record. I then just had to embed my flow in a vf page.
This worked great, however, my original intent was to get this to work in a lightning community. My understanding is that Lightning Data Service doesn't work in communities. I'm not much of a developer (as mentioned, I copied the code and just made a few small edits), so I am not sure how this component would need to be adjusted to get it to work in the community. I could post the code here, but it is in a bundle. 
Here is the direct link: https://github.com/douglascayers/sfdc-reloadable-visualforce-lightning-component/tree/master/src/aura/VisualforceRecordCmp
Hi. I'm an Admin and not a Developer, first off.  I want to create a simple Lightning Component with one field (custom) on a standard object so that it may be displayed on the right side of a Lightning Record Page, separate from other fields on the same record.  In essence, all fields except the single field, will be in the main standard Record Detail component and the single field will be in its own component on the right.  How would I go about creating a Lightning Component with just one field?
I'm using Database.update method in my batch class. When I run the batch job I intentionally make some error to occur to see how my code handles it. The job completes successfully but the 'finish' method from my batch class is not invoked. Why is this?I'm trying to copy an inactive Account Owner to the Contact Owner field which generates an internal Salesforce Error but the job completes successfully as I'm using Database class method instead of DML statement. I'm unable to see the debug statement of my Finish method in the log. Piece of my code

global void execute(Database.BatchableContext context, List<sObject> scope){
...............................some code
List<Contact> contacts = new List<Contact>();
        updateResult = Database.update(contacts ,false);
 for (Database.SaveResult ir : updateResult ) {  
        //Operation failed, so get all errors                       
          for(Database.Error err : ir.getErrors()){                                
          System.debug('The following error has occurred -------------'+ err.getStatusCode() + ': ' + err.getMessage());
          System.debug('Task fields that affected this error: ' + err.getFields());
           Error = 'Failed Store --'+ '  ' + ir.getId() + '    ' +err.getStatusCode() ;

 //Finish Method 
    global void finish(Database.BatchableContext context){
    List<String> listOfEmails = new List<String>();
    // Get the AsyncApexJob that represents the Batch job using the Id from the BatchableContext  
       AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed,TotalJobItems, CreatedBy.Email, ExtendedStatus from AsyncApexJob where Id = :context.getJobId()];  
System.debug('********Inside Finish***updateErrors.size()-------'+updateErrors.size());            
                // Email the Batch Job's submitter that the Job is finished.  
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();    
                mail.setSubject('Account Sync batch Status: ' + a.Status);  
                String msg = 'The batch Apex job failed to update and Address for'+'   '+updateErrors.size()+ ' '+ 'Contacts' + '  ' + Error;
                List<Email_List__c> receivers = Email_List__c.getall().values();
                for(Email_List__c e:receivers){
                    String s = e.Email_Id__c;
                Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });