HI Shubhangi, You can check AccountContactRelation (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accountcontactrelation.htm)
Try as mentioned in https://salesforce.stackexchange.com/questions/244933/need-help-with-test-class-for-code-coverage-on-accountcontactrelation-object/244935
@isTest
public class TestAccountContactRelation {
@isTest
static void TestAccountContactRelation() {
Account acct = new Account(Name='HelloWorld');
insert acct;
Contact con = new Contact(AccountId = acct.id,lastname = 'testdata' , firstname ='testdata1');
insert con;
Contact con1 = new Contact(AccountId = acct.id,lastname = 'testdata2' , firstname ='testdata2');
insert con1;
AccountContactRelation acctcr = new AccountContactRelation(AccountId = acct.id, ContactId = con.id, Primary__c = TRUE);
insert acctcr;
You can check AccountContactRelation (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accountcontactrelation.htm)
Try as mentioned in https://salesforce.stackexchange.com/questions/244933/need-help-with-test-class-for-code-coverage-on-accountcontactrelation-object/244935
Related: https://salesforce.stackexchange.com/questions/198812/getting-error-while-inserting-accountcontactrelation-record-in-test-class
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
I created this object.
Now i want to enter Personal code for primary.
Then how can i enter this?
I wrote below code:
Tet_Address__c newAdd = new Tet_Address__c(Name = 'ZA - 2, PĒTERUPE, SAULKRASTU PAG., SAULKRASTU NOV.', AddressKey__c = '119073458', PostalCode__c = 'LV-2160', Country__c = 'LATVIA', ForeignAddress__c = 'TEST ZARIŅI - 1, PĒTERUPE, SAULKRASTU PAG., SAULKRASTU NOV.', Active__c = True, Codified__c = True);
insert newAdd;
Account testAccount = new Account(Name='Shub',AccountNumber='12345678',Tet_AKAdmin_Address__c=newAdd.Id, Phone='7350850562',Tet_Customer_Type__c='Normal',Tet_Account_source__c='eShop',Tet_Segment__c='1',Tet_Company_Registration_Number__c='44102037674',RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Consumer').getRecordTypeId());
insert testAccount;
List<Contact> conList = new List<Contact>();
Contact con = new Contact();
con.FirstName='Rohit';
con.lastName='Salunke';
con.Email = 'tes1@gmail.com';
con.Birthdate = date.newInstance(1992, 04, 22);
con.MobilePhone = '10616456';
con.Tet_Contact_Pid__c = '060587-12949';
con.accountid=testAccount.id;
conList.add(con);
insert conList;
I have to update con.Tet_Contact_Pid__c from one primary contact to another primary
I created this object.
Now i want to enter Personal code for primary.
Then how can i enter this?
I wrote below code:
Tet_Address__c newAdd = new Tet_Address__c(Name = 'ZA - 2, PĒTERUPE, SAULKRASTU PAG., SAULKRASTU NOV.', AddressKey__c = '119073458', PostalCode__c = 'LV-2160', Country__c = 'LATVIA', ForeignAddress__c = 'TEST ZARIŅI - 1, PĒTERUPE, SAULKRASTU PAG., SAULKRASTU NOV.', Active__c = True, Codified__c = True);
insert newAdd;
Account testAccount = new Account(Name='Shub',AccountNumber='12345678',Tet_AKAdmin_Address__c=newAdd.Id, Phone='7350850562',Tet_Customer_Type__c='Normal',Tet_Account_source__c='eShop',Tet_Segment__c='1',Tet_Company_Registration_Number__c='44102037674',RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Consumer').getRecordTypeId());
insert testAccount;
List<Contact> conList = new List<Contact>();
Contact con = new Contact();
con.FirstName='Rohit';
con.lastName='Salunke';
con.Email = 'tes1@gmail.com';
con.Birthdate = date.newInstance(1992, 04, 22);
con.MobilePhone = '10616456';
con.Tet_Contact_Pid__c = '060587-12949';
con.accountid=testAccount.id;
conList.add(con);
insert conList;
I have to update con.Tet_Contact_Pid__c from one primary contact to another primary