0

We have an DataLoad activity.Query users where KCS Role /= null For any users that Knowledge License / TRUE.

Thanks in Advance

  • Can you tell me if FlexeraMemberCreationHandler.FlexeraMemberCreation is a future method? – TSmith Nov 22 '16 at 11:00
  • @TSmith Thanks for your Quick Reply...Yes as per my understanding FlexeraMemberCreationHandler is the Future method. Thanks – walter sfdc Nov 22 '16 at 11:04
4

Salesforce imposes a governor limit that states no more than 50 future calls may be made in a single request. Take a look at the docs. The governor limit is not about 51 records being called/processed inside a future call, it's about the number of future calls in a single request. In your case here you are calling the future method for each user.

....
for(User u:trigger.new){
    if(u.Synchronize_with_Flexera_Member__c == true && !system.isbatch() && !system.isfuture() && !system.isScheduled()){
        FlexeraMemberCreationHandler.FlexeraMemberCreation(u.id); 
    }
}  
....

You will need to modify your future method to accept a list of these user ids and call once from your UserMasterTrigger. You will end up with something like the following in UserMasterTrigger after modifying FlexeraMemberCreationHandler.FlexeraMemberCreation method:

List<Id> userIds =  new List<Id>();
for(User u:trigger.new){
    if(u.Synchronize_with_Flexera_Member__c == true && !system.isbatch() && !system.isfuture() && !system.isScheduled()){
        userIds.add(u.Id);
    }
} 
if (userIds != null) FlexeraMemberCreationHandler.FlexeraMemberCreation(userIds);
  • Hi Smith, Am sorry i didn't get your answer. We are tried your logic which you are mentioned above.But we are getting error like "Incompatible element type User for collection of Id at line 11 column 13 " Please check below bit of code. for(User u:trigger.new){if(u.Synchronize_with_Flexera_Member__c == true && !system.isbatch() && !system.isfuture() && !system.isScheduled()){ userIds.add(u); //FlexeraMemberCreationHandler.FlexeraMemberCreation(u.id); } } if (userIds!=null) FlexeraMemberCreationHandler.FlexeraMemberCreation(userIds); } – walter sfdc Nov 22 '16 at 11:30
  • Pass the User Id to the userIds list. – TSmith Nov 22 '16 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.