• Prasad Avala(SFDC-SF)
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 9
    Replies
Below is the code snippet:
list<case> clist=[select id,recordtypeId,recordtype.developername from case limit 2];
for(case cs:clist){
    newcase__c bInstance = new newcase__c(); 
    Map<String,newcase_Config__mdt> Mapmetadata = newcase_Config__mdt.getAll();
 for(String mdtMap : Mapmetadata.keySet()){
        String fromField = Mapmetadata.get(mdtMap).From__c; //assume the value is recordtype.developername
        String toField = Mapmetadata.get(mdtMap).to__c; //assume the value is recordtype.developername
        system.debug('@@'+cs.recordtype.developername);
        bInstance.put(toField,cs.get(fromField));    
 system.debug('binstance'+binstance);        
    }
}
Here, from__c is holding the recordtype.developername on the case object and to__c is holding the recordtype.developername on the newcase__c object. In line 9, the fetched recordtype value has to get assigned to newcase__c's recordtype.developername. But I am getting an error as 'Invalid field recordtype.developername for Case'. Is there any way to achieve this?   
So here the cursor & limit here I have hardcoded and is now working fine.
So my real requirement is here limit is always a constant and the cursor value increases based on the limit.

Lets take now for the first time the URL is,
https://xyz/abcHistory?apiKey=SupportApiKeyQA&wrap=true&ref=TechSupportDiagTool&cursor=1000&limit=10
the next time my cursor value must alone increase by 10. and the endpoint must be.
https://xyz/abcHistory?apiKey=SupportApiKeyQA&wrap=true&ref=TechSupportDiagTool&cursor=1010&limit=10
Here I know we need to use custom setting, can somebody please help me?
i.e. the cursor value in the custom setting alone must increase by limit value.
 
I have a List<Contact> in apex, but ultimately what I want is Map<Contact,List<String>> where the List<String> is the list of account numbers associated to the contact.

I had some working queries a while back, but I didn't think I'd need them, so got rid of them.  Now I'm not sure how to do it.  I assume I need to hit  Account Contact Relationships somehow, but don't know how.
Hi guys

"A Universal Containers developer new to the Force.com platform was given the task of creating a trigger that posts a Chatter notification to the entire organization when a position moves to the open/approved state, so that everyone in the company has the opportunity to recommend
people and earn the hiring b"?
HI, I am trying to check a chk box if there is a child record present , if no then unchk this chk box (look up relation to the custom object from Opportunity)
list<id> ids = new list<id>();
    if(trigger.isinsert || trigger.isupdate){
        
        
       for(Apttus_Proposal__Proposal__c p : trigger.new){
            ids.add(p.Apttus_Proposal__Opportunity__c);
        }
        list<opportunity> opp = [select id,Has_Quote_Proposal__c from opportunity where id in :ids];
        list<opportunity> oppttyupdate = new list<opportunity>(); 
        for(opportunity o : opp){
            o.Has_Quote_Proposal__c=true;
            oppttyupdate.add(o);
        }
        update oppttyupdate;
    }
    
    
    if(trigger.isdelete){
        
        list <id> ids3 = new list<id>();
        for(Apttus_Proposal__Proposal__c p : trigger.old){
            ids3.add(p.Apttus_Proposal__Opportunity__c);
        }
      
      
        list<opportunity> opp = [select id,Has_Quote_Proposal__c,(select id,name from XXXXX0000001yUfDEAU__r) from opportunity where id in :ids3];
        list<opportunity> oppttyoupdate = new list<opportunity>(); 
        for(opportunity o : opp){
            
            if(o.XXXXXXX0000001yUfDEAU__r.size()<1){
                o.Has_Quote_Proposal__c = false;
                oppttyoupdate.add(o);
            }
        }
        update oppttyoupdate;              
            }
                                     }
                             
                     }
Advance thanks 
trigger Limit1000AccountsForUsers on Account (after insert, after update)
{Account accs = Trigger.new[0];
string accountOwner = accs.OwnerId;

If(accs.Protected_Accounts__c == true){Integer accounts = [ SELECT COUNT()FROM Account WHERE Account.OwnerId=: accountOwner]; 
system.debug(accounts);

If(accounts > 2 ) {accs.addError('You already have 1000 Accounts in your ownership. Please remove one Account before adding a new.');
}
}
}

We have the following code to limit number of Protected Accounts to 1000 per user.  I have one user that has 950 Protected Accounts and 50 unprotected Accounts.  When I try to add another protected Account I am getting the error 'You already have 1000 Accounts in your ownership. Please remove one Account before adding a new.'.

I only want this error to occur when a user tries to add over 1000 Protected Accounts.

Is there something missing within the Apex?