• AgPrerna
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 1
    Replies
I have a custom object- Object__c which has a look up to Account.
Object__c has a field Start_Date_Time__c.
I want to get records(Object__c) for each Account with Maximum value of Start_date_Time__c.

TIA
Hi,
My requirement is as follows:
- Account is the parent of Digital App object.
-One Account can have multiple Digital Apps.
- If email address is changed in any Digital App, run the batch after 30 mins delay clubbing all the email address change for a particular account.
- within this 30 mins whatever email address is changing we will send the notification.
- If any change is made after 30 mins, it will be part of next batch run.

What i have done till now is:
- Created a new field in Account to set the 30 min delay
- new field in Digital App to store old email address (email notificatioon should be triggered to both changed and old email address)
-Batch Apex:
global class DigitalAppLoginChange implements Database.Batchable <sObject>{
    global Database.QueryLocator Start(Database.BatchableContext bc){
        DateTime currentTime = System.now();
        String query= 'Select id, JJ_Email_Updated__c,JJ_App_User_Old_Email__c,JJ_Linked_Account__c,JJ_AppUser_Login_Email__c, JJ_Last_Email_Changed_Time__c from JJ_Digital_App__c where LastModifiedDate=TODAY AND JJ_Linked_Account__c != null AND JJ_Linked_Account__r.JJ_Digital_App_Time_Delay__c <=: currentTime ';
        return Database.getQueryLocator(query);
        
    }
    global void execute(Database.BatchableContext bc, List<JJ_Digital_App__c> records){
         List<String> emails2 = new List<String>();
         Set<id>Accountid = new Set<id>();
         Map<id,String> emailAcc = new Map<id,String> ();
        System.debug('Test digital app ids'+records);
        for(JJ_Digital_App__c dApp :records){
            if((dApp.JJ_App_User_Old_Email__c != dApp.JJ_AppUser_Login_Email__c) && dApp.JJ_Email_Updated__c == True){
                emailAcc.put(dApp.JJ_Linked_Account__c,dApp.JJ_AppUser_Login_Email__c);
                Accountid.add(dApp.JJ_Linked_Account__c);
                System.debug('Test digital app ids'+dApp.id);
                dApp.JJ_Mobile_Updated__c=FALSE;
                update dApp;
                
            }
            //dApp.JJ_Mobile_Updated__c=FALSE;
                
            }
            for(Id acckey:emailAcc.keyset()){
            emails2.add(emailAcc.get(acckey));
            System.debug('List of email changes2'+emails2);
            System.debug('List of Acc email changes'+emailAcc);
            System.debug('List of affected Accounts'+Accountid);
                
           
}
global void finish(Database.BatchableContext bc){
}
}

How to procced?
TIA
I have a requirement where i need to include 3 checks and corresponding error message. I am aware that i can give only 2 error messages through Conag button using DC and EC attribute.
To implemet the 3rd conditona nd error messgae i am thinking of calling apex method from Conga button.
Can this be done?
I have a custom object-Patient.
the requirement is to - Link 2 or more patients together.

Suppose I have a Patient A, Patient B, Patient C.
There should be a lookup field on Patient 'Linked Patients'.
Now through this linked Patients i need to link Patient B & C to A.

Is this possible?
 
I have a Account Test1 with Address Line 1, City and State.
I have another Account Test2 with Address Line1.
Test1 is the parent of Test2.
In Case object,  i have a field where I am populating value of Test2 as name and Address Line1.
I want to merge Address Line-1, City and State in one of the fields of Case object.
Can we do this using formula field?
I have a custom object- Object__c which has a look up to Account.
Object__c has a field Start_Date_Time__c.
I want to get records(Object__c) for each Account with Maximum value of Start_date_Time__c.

TIA