-1

I'm trying to create some fake events using python in Event Log File:

from simple_salesforce import Salesforce, SalesforceLogin, SFType


session_id, instance = SalesforceLogin(username=username, password=password, security_token=security_token, domain=domain, client_id=client_id, consumer_key=consumer_key)
sf = Salesforce(session_id=session_id, instance=instance)
qa = SFType('EventLogFile', session_id, instance)

data = {
    "EventType": "Login"
}

qa.create(date)

But I'm getting an error saying:

Response content: [{'message': 'entity type cannot be inserted: Event Log File', 'errorCode': 'CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY', 'fields': []}]

Is there a way to do this? If not like this directly to Event Log File, is there a way that I can do with python, then logs will appear in Events Log File?

1 Answer 1

1

As the error states, you can't do DML to EventLogFile. You can see this in the object reference

Supported Calls describeSObjects(), query(), retrieve()

What you need to do instead is to do other actions that cause SFDC to generate EventLogFiles. In your case, you will need to do some logins to the target org to get Login events to appear in the EventLogFile.

EventLogFiles don't get generated immediately so you'll need to query them later (hourly - beta), otherwise 24 hours

1
  • Thanks @cropredy Commented Jul 13, 2022 at 21:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .