You need to sign in to do that
Don't have an account?
MaheemSam
Not able to insert record in TxnSecurity.PolicyCondition
Hi,
I am using below code to insert data into a custom object using TxnSecurity.PolicyCondition but its not working please suggest me what is the issue in code.
Thanks
Sudhir
I am using below code to insert data into a custom object using TxnSecurity.PolicyCondition but its not working please suggest me what is the issue in code.
public class AccountExportLog implements TxnSecurity.PolicyCondition { public boolean evaluate(TxnSecurity.Event e) { Integer numberOfRecords = Integer.valueOf(e.data.get('NumberOfRecords')); String entityName = String.valueOf(e.data.get('EntityName')); system.debug('Number of Records ' + numberOfRecords); system.debug('EntityName ' + entityName); system.debug('entity ' + e); system.debug('resource type ' + e.resourceType); if(e.resourceType == 'Account'){ //SELECT ID,Name FROM Report WHERE NAME = 'TEST_ACCOUNT_EXP' if(entityName == 'Account'){ //list<Report_Download_Log__c> rec = new list<Report_Download_Log__c>(); Report_Download_Log__c rec = new Report_Download_Log__c(API_Type__c = entityName,Download_by__c='00534000009Gu7u',Object_Name__c=entityName,Total_Records__c=numberOfRecords); //insert rec; //return true; } //Report_Download_Log__c rec = new Report_Download_Log__c( API_Type__c = entityName,Download_by__c='00534000009Gu7u',Object_Name__c=entityName,Total_Records__c=numberOfRecords); //insert rec; } return false; } }
Thanks
Sudhir
kamal somu a
The documentation (https://help.salesforce.com/articleView?id=security_transactions_apex_policies.htm&type=5) from salesforce says that the DML statements is not desirable to use inside the security policies since it might causes error.