1

I need to write unit testing code which has logic around system field last login date of user.As per spring'16 release salesforce has added method for setting created date like below.

Test.setCreatedDate(recordId, createdDatetime)

Sets CreatedDate for a test-context sObject.

Is there anything similar method to set system field 'lastlogindate' of user.

1

I don't think this is possible. You can create users see here but not set last login.

In cases like this before I've refactored code to allow test data to be injected.

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.