• nitin Sharma 401
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Hi Everybody,

I have been sending few accoint names from the flow to the Apex Invocable method and that method is suppose to return accountids back to us but it's giving me the below given error

Error Occurred: The number of results does not match the number of interviews that were executed in a single bulk execution request.

global class lookUpAccountAnnotation 
{
   @InvocableMethod
   public static list<list<string>>getAccountIds(list<list<string>>names)
    {
      //wew.add(new List<String>{'VEC209_ALGE', '2751282.05'});
    list<string>fullnames=new list<string>();
    //list<string>strn1=new list<string>(names);
    list<string>t=new list<string>();
    for(list<string>strn:names)
    {
    
    for(integer i=0;i<strn.size();i++)
    {
        fullnames.add(strn[i]);
      }
    }
    List<Account> accounts = [SELECT Id FROM Account WHERE Name in :fullnames];
    //list<List<String>>accountids = new list<List<String>>();
    list<list<string>>accountids=new list<list<string>>();
    for(Account acc:accounts)
    {
      //wew.add(new List<String>{'VEC209_ALGE', '2751282.05'});
    accountids.add(new list<string>{(acc.id)});
     
    }
    
    for(list<string>Accids:accountids)
    {
    
    System.debug('Now show moe he errors'+accids);
    
    }
     return accountids;  
 }
 }
I have am sending three account names from the flow to the apex and  after querying those accoints it is suppose to return the id's of of the Account but it's giving me the following error.

Error Occurred: The number of results does not match the number of interviews that were executed in a single bulk execution request.
 
Hi Everybody,

I have been sending few accoint names from the flow to the Apex Invocable method and that method is suppose to return accountids back to us but it's giving me the below given error

Error Occurred: The number of results does not match the number of interviews that were executed in a single bulk execution request.

global class lookUpAccountAnnotation 
{
   @InvocableMethod
   public static list<list<string>>getAccountIds(list<list<string>>names)
    {
      //wew.add(new List<String>{'VEC209_ALGE', '2751282.05'});
    list<string>fullnames=new list<string>();
    //list<string>strn1=new list<string>(names);
    list<string>t=new list<string>();
    for(list<string>strn:names)
    {
    
    for(integer i=0;i<strn.size();i++)
    {
        fullnames.add(strn[i]);
      }
    }
    List<Account> accounts = [SELECT Id FROM Account WHERE Name in :fullnames];
    //list<List<String>>accountids = new list<List<String>>();
    list<list<string>>accountids=new list<list<string>>();
    for(Account acc:accounts)
    {
      //wew.add(new List<String>{'VEC209_ALGE', '2751282.05'});
    accountids.add(new list<string>{(acc.id)});
     
    }
    
    for(list<string>Accids:accountids)
    {
    
    System.debug('Now show moe he errors'+accids);
    
    }
     return accountids;  
 }
 }
I have am sending three account names from the flow to the apex and  after querying those accoints it is suppose to return the id's of of the Account but it's giving me the following error.

Error Occurred: The number of results does not match the number of interviews that were executed in a single bulk execution request.

 
Can somebody please tell me how to write a below given query in batach apex which I have writte in start method and then sent them to the execute method.

However ,My problem is I am not able to write where clause

string query='SELECT ID,Ownerid,Accountid,prestigious_contact__c from contact where assistantname='Christy'' && level__c='Primary' && prestigious_contact__c';

This  query is for the Batch Apex class.
1)Assistantname field is text
2) level__c is a picklist field
3)prestigious_contact__c is  a boolean field which is checkbox on the contact object


 
I have couple of objects and the relationship is as follows

1)Acount
2)Opp
3)contact
4)Planning 
5)Management
 

Account has a ralationmship with the Opp object and planning has a lookup relatiomship with Opp and management has a lookup wiht thr planining

I have created email field on the Management object 

I have trigger on the planning object and from planning I am extracting management reord which are basically copied contacts from the contact object known as special contacts.If more record are added in the contact object I need to match email on the management with email on the contact object and if they match it means management has that record so no need to insert just update that record..If the email does not match then copy that contact object to the management object......Management has no direct relationship  realtionhip withe contact object

Relationship goes like this:- 

Starting backwards from management------Plannnig -----Opp-----Account-----Contact
 
My code is  not complete and I have focussed on after udpate trigger assuning that certain records with thei email address already esists in the Management object and new we gonna update them if the email matches with the email on the contact object


Problem is at the line where I am checking if the email from the contact record exists in the map of Management object.I know email exists in both the objects but it's always giving me null value so please help me out.


trigger UpdateStartegicPlanning on Strategic_planning__c (after update)
{
    set<string>EmailtoLastname=new set<string>();
    set<id>IdofStrategicplan=new set<id>();
    set<id>storeoppIds=new set<id>();
    for(Strategic_planning__c Str:trigger.new)
    {
       
      IdofStrategicplan.add(str.id);  
           
    }
     list<Realtionship_Management__c>ManageRec=([select Key_Contacts_Email_Address__c from Realtionship_Management__c where Strategic_planning__c=:IdofStrategicplan]);
    //might need maoo for the above line
    //
    //        
    
    Map<string,Realtionship_Management__c>must=new Map<string,Realtionship_Management__c>();
    
    for(Realtionship_Management__c Mrecords:ManageRec)
    {
        
        
      must.put(Mrecords.Key_Contacts_Email_Address__c,mrecords);
        
        
    }

for(Strategic_planning__c Check:Trigger.new)
   {
 
       
       
       storeoppIds.add(check.opportunity__c);
            
       
   }
  

    
list<opportunity>newOppIds=[Select id,accountid from opportunity where id in:storeoppIds];
set<id>accountids=new set<id>();
for(opportunity ids:newoppids)
{
accountids.add(ids.accountid);    
system.debug('the account id is'+accountids);   
   
}    
List<account>str=[select id,(select id,Key_Contact_Account_Planning__c,lastname,email from contacts where Key_Contact_Account_Planning__c=true)from account where id in:accountids];
   
list<Realtionship_Management__c>management=new list<Realtionship_Management__c>();

for(Strategic_planning__c plan1:trigger.new)
{
System.debug('The strategic planning id is'+plan1);
for(account s:str)
{
  System.debug('The account info is is'+s);  
    
for(contact contra:s.contacts)
{
    
    if(must.containskey(contra.email))
    {
       system.debug('the email address is');
        //+EmailRelation.containskey(contra.email)); 
    }
    else
    {
        system.debug('the email address is not good');
        
        
    }
     
    
    
}    
}    
}
}    



 





 

Hello All,

I have trigger on the the Account object that updates a custom field (MyOpsPath) on the Opportunity object when Account.Name,Site, or SI_Site_Reference__c changes. My trigger fails after the 4th update due to the CPU time limit error.

Is anyone willing to take a look, other suggestions, or help fix my code?

With thanks in advance.

Robert

trigger UpdateMyOpsPathFromAccount on Account (after update) {
System.Debug('*** UpdateMyOpsPathFromAccount *** ');
//String ClosedLit='Closed%'; *** 27/Feb/2020
String Slsh = '\\';
String PthLit1 = 'ni-cr-svc-fp1';
String PthLit2 = 'QUOTES AND CONTRACTS - LIBRARY';

Set<Id> accountIds = new Set<Id>();

   for(Account acc : trigger.new) {
       if(acc.SI_Site_Reference__c!=null){ 
          //System.Debug('This Accounts SI_Site Reference__c='+acc.SI_Site_Reference__c);   
          if((acc.Name != trigger.oldMap.get(acc.Id).Name) ||
             (acc.Site != trigger.oldMap.get(acc.Id).Site) ||
             (acc.SI_Site_Reference__c != trigger.oldMap.get(acc.Id).SI_Site_Reference__c)){      
              accountIds.add(acc.Id);
              
              String FrstLtr=acc.Name.substring(0,1);
              String Ctgry='2 Accounts (A to H)';
              If(FrstLtr.containsAny('ABCDEFGH'))   {Ctgry='2 Accounts (A to H)';}
              If(FrstLtr.containsAny('IJKLMNOP'))   {Ctgry='3 Accounts (I to P)';}
              If(FrstLtr.containsAny('QRSTUVWXYZ')) {Ctgry='4 Accounts (Q to Z)';}  

              System.Debug('acc.Name='+acc.Name);
              System.Debug('FrstLtr='+FrstLtr);  
              System.Debug('Ctgry='+Ctgry);   
              System.debug('Account with Change='+acc.Id);           
              System.Debug('Old Account Name='+trigger.oldMap.get(acc.Id).Name);
              System.Debug('New Account Name='+acc.Name);
              System.Debug('Old Account Site='+trigger.oldMap.get(acc.Id).Site); 
              System.Debug('New Account Site='+acc.Site);
              System.Debug('Old Account Site Reference='+trigger.oldMap.get(acc.Id).SI_Site_Reference__c);
              System.Debug('New Account Site Reference='+acc.SI_Site_Reference__c);                           
              
              if (!accountIds.isEmpty()){
                  // Get Opportunity Information
                  List<Opportunity>
                  LstOpps=[SELECT Id, MyOpsPath__c, AccountId, Almac_Division__c, StageName, Reference_Number__c  
                  FROM Opportunity
                  //WHERE AccountId in: accountIds AND Almac_Division__c='SI' AND (NOT StageName LIKE:ClosedLit)]; *** 27/Feb/2020
                  WHERE AccountId in: accountIds AND Almac_Division__c='SI' ];

                    System.Debug('LstOpps.size='+LstOpps.size()); 
                    System.Debug('Id='+LstOpps[0].Id);
                    System.Debug('AccountId='+LstOpps[0].AccountId); 
                    System.Debug('Alamc_Division__c='+LstOpps[0].Almac_Division__c);
                    System.Debug('StageName='+LstOpps[0].StageName);                   
                   
                    If(!LstOpps.isEmpty()){ 
                       for(Opportunity o: LstOpps) {

                       System.Debug('BEFORE-MyOpsPath='+LstOpps[0].MyOpsPath__c);                       
   
                       LstOpps[0].MyOpsPath__c=(Slsh+Slsh+PthLit1+Slsh+'sqman'+Slsh+PthLit2+Slsh+Ctgry+Slsh+acc.Name+' ('+acc.Site+') '+acc.SI_Site_Reference__c+Slsh+'Quotes'+Slsh+LstOpps[0].Reference_Number__c+Slsh);
                       
                       System.Debug('AFTER-MyOpsPath__c='+LstOpps[0].MyOpsPath__c);

                       Update LstOpps;
                       System.Debug('*** Opportunity Updated ***');

                       }
                    }
              }
          } 
       }
   }
}
 

 

 

Can somebody please tell me how to write a below given query in batach apex which I have writte in start method and then sent them to the execute method.

However ,My problem is I am not able to write where clause

string query='SELECT ID,Ownerid,Accountid,prestigious_contact__c from contact where assistantname='Christy'' && level__c='Primary' && prestigious_contact__c';

This  query is for the Batch Apex class.
1)Assistantname field is text
2) level__c is a picklist field
3)prestigious_contact__c is  a boolean field which is checkbox on the contact object


 
Hi,
I have found similar questions but didn't find a definitive answer or "known issue".
I have an autolaunched flow that is triggered by a process. The process fires when a new Calendar Event record is created. For every Contact that was added to the Name field in the Event record, the flow should create a record for the custom object "Event participation". Salesforce has put those invited Contacts together in the WhoRelationId field of the (Calendar) Event record. So that field can contain more than 1 Contact record id. Maybe some Salesforce guy was feeling lucky the day he made that functionality....
Anyway; when I run the Flow in Debug mode, I add the Event id as input and it all works fine. For each Contact record, an "Event Participation" record is created. When I let the Process do its work, however, only the first Contact record results in an Event Participation record. I'm just a functional person ("clicks, no code") myself, but I had a developer take a look at this. He can't figure this out. The loop would be the prime suspect, but that seems to be OK. I added a screenhot of the flow.
Any ideas would be very welcome.
The alternative would be to either tell the business user that we can't make this work (not on my watch....) or rebuild the (Calendar) Event object. Phew.....

Thanks.
Eric DelahayUser-added image