You need to sign in to do that
Don't have an account?
Shubham Sinha 49
How to insert two records at the same time?
I have two objects . Account and Patient Therapy. I am calling my method from apex class. i have done like this but getting an error
while calling this method from anonymous method.
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [BIIB_Patient__c]
while calling this method from anonymous method.
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_FILTER_VALIDATION_EXCEPTION, Value does not exist or does not match filter criteria.: [BIIB_Patient__c]
public Static User createUserAccount(registrationDetails regDetailsWrapObj){ Product_vod__c prodCatlog = [SELECT Name FROM Product_vod__c WHERE Name = :System.label.BIIB_Product_Aducanumab][0]; List<Account> checkAccountData = [SELECT id,FirstName, LastName, PersonEmail,BIIB_PASS_Zip_Code__c FROM Account WHERE LastName =: regDetailsWrapObj.LastName AND PersonEmail =: regDetailsWrapObj.Email Limit 1 ]; Account createAccount; if(checkAccountData.size()> 0) { createAccount = checkAccountData[0]; BIIB_Patient_Therapy__c patTherapy = new BIIB_Patient_Therapy__c(); patTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication; patTherapy.BIIB_Therapy__c = prodCatlog.Id; patTherapy.BIIB_Patient__c= createAccount.id; insert patTherapy; } else { createAccount = new Account (); createAccount.FirstName= regDetailsWrapObj.firstName; createAccount.LastName =regDetailsWrapObj.lastName; insert createAccount; BIIB_Patient_Therapy__c accPatTherapy = new BIIB_Patient_Therapy__c(); accPatTherapy.BIIB_Indication__c = System.label.BIIB_Patient_Therapy_Indication; accPatTherapy.BIIB_Therapy__c = prodCatlog.id; accPatTherapy.BIIB_Patient__c= createAccount.id; insert accPatTherapy; }
PRAKASH JADA 13
FIELD_FILTER_VALIDATION_EXCEPTION this means there is a filter on that field and it would accept only certain data. check the data that you are trying to send is part of that filter accept data. I believe this would help you to resolve your issue.