|  |  |  | 
|---|
|  |  |  | Account myAccount2; | 
|---|
|  |  |  | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; | 
|---|
|  |  |  | System.runAs(thisUser) { | 
|---|
|  |  |  | List<RecordType> rectCo = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM RecordType | 
|---|
|  |  |  | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; | 
|---|
|  |  |  | if (rectCo.size() == 0) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Profile prof = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM Profile | 
|---|
|  |  |  | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)']; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | myAccount2 = new Account( | 
|---|
|  |  |  | name = 'Testaccount002', | 
|---|
|  |  |  | 
|---|
|  |  |  | Account myAccount2; | 
|---|
|  |  |  | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; | 
|---|
|  |  |  | System.runAs(thisUser) { | 
|---|
|  |  |  | List<RecordType> rectCo = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM RecordType | 
|---|
|  |  |  | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; | 
|---|
|  |  |  | if (rectCo.size() == 0) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Profile prof = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM Profile | 
|---|
|  |  |  | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)']; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | myAccount2 = new Account( | 
|---|
|  |  |  | name = 'Testaccount002', | 
|---|
|  |  |  | 
|---|
|  |  |  | Account myAccount2; | 
|---|
|  |  |  | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; | 
|---|
|  |  |  | System.runAs(thisUser) { | 
|---|
|  |  |  | List<RecordType> rectCo = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM RecordType | 
|---|
|  |  |  | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; | 
|---|
|  |  |  | if (rectCo.size() == 0) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Profile prof = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM Profile | 
|---|
|  |  |  | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)']; | 
|---|
|  |  |  | myAccount2 = new Account(name = 'Testaccount003', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id, AgentCode_Ext__c = '2'); | 
|---|
|  |  |  | insert myAccount2; | 
|---|
|  |  |  | Contact core = new Contact(email = 'wan@salesforce.com', firstname = 'wan', lastname = 'Plumbers', accountid = myAccount2.id); | 
|---|
|  |  |  | 
|---|
|  |  |  | Account myAccount2; | 
|---|
|  |  |  | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; | 
|---|
|  |  |  | System.runAs(thisUser) { | 
|---|
|  |  |  | List<RecordType> rectCo = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM RecordType | 
|---|
|  |  |  | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; | 
|---|
|  |  |  | if (rectCo.size() == 0) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Profile prof = [ | 
|---|
|  |  |  | SELECT Id | 
|---|
|  |  |  | FROM Profile | 
|---|
|  |  |  | WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)' | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)']; | 
|---|
|  |  |  | myAccount2 = new Account(name = 'Testaccount003', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id, AgentCode_Ext__c = '2'); | 
|---|
|  |  |  | insert myAccount2; | 
|---|
|  |  |  | Contact core = new Contact(email = 'wan@salesforce.com', firstname = 'wan', lastname = 'Plumbers', accountid = myAccount2.id); | 
|---|