I am attempting to utilize Financial Services Cloud in Salesforce. One of the interesting quirks about it is that an Account insertion is immediately followed by a Contact insertion and both records share the same FinServ__IndividualId__c.
I am attempting to write a test class that requires testing this relationship, but I'm unable to insert a Contact record of type "Individual" and have a contact created through the managed package trigger and associated individual Ids. In fact, none of that happens. I just have an inserted account.
I have a commented-out section and that was another approach.
The result is Account:{Name=234, Id=0013D00000OAwXNQA1, FinServ__IndividualType__c=Individual, RecordTypeId=0126A0000008xahQAA}
Account a = new Account();
Contact c = new Contact();
c.LastName='fname?';
c.FirstName='lname';
insert c;
//a.RecordTypeId = [SELECT DeveloperName, Id, SobjectType
//FROM RecordType
//Where SobjectType='Account'
//AND DeveloperName='IndustriesIndividual'][0].Id;
a.RecordTypeId=Schema.SObjectType.Account.getRecordTypeInfosByName().get('Individual').getRecordTypeId();
a.Name='234';
a.FinServ__IndividualType__c ='Individual';
a.FinServ__PrimaryContact__c=c.Id;
insert a;
a=[Select Name, Id, FinServ__IndividualId__c, FinServ__IndividualType__c, RecordType.DeveloperName FROM Account Where Id=:a.Id];
System.debug(a.RecordType.DeveloperName);
System.debug(a);
Does anybody have any experience/suggestions with this?
I have attempted the following example: https://success.salesforce.com/issues_view?id=a1p3A000000mCmQQAU --with no success, including attempting the suggested work-arround.
Test.stopTest()
statement as perhaps FS does its work asynchronously and those methods don't run until test.stopTest ? – cropredy Dec 4 '17 at 18:06