Skip to main content
added 5 characters in body; edited tags
Source Link
Adrian Larson
  • 152.6k
  • 38
  • 250
  • 434

I am trying to cover the following in my test class.

@RemoteAction global static Tfunc InsertOrg(String Name,String AddressLine1,String AddressLine2,String AddressLine3,String AddressLine4,String City,String Country,String CountryName,String AliasName,String PostalCode,String StateOrProvince,String BusinessID,String RowID,String WebsiteURL){ TOrg__c oOrganisation = new TOrg__c(); oOrganisation.Name = Name; oOrganisation.Address_1__c = AddressLine1; oOrganisation.Address_2__c = AddressLine2; oOrganisation.Address_3__c = AddressLine3; oOrganisation.Address_4__c = AddressLine4; oOrganisation.City_Name__c = City; oOrganisation.Country__c = Country; oOrganisation.Country_Name__c = CountryName; oOrganisation.Postal_Code__c = PostalCode; oOrganisation.State_Province__c = StateOrProvince; oOrganisation.Organization_Business_ID__c = BusinessID; oOrganisation.Org_Row_ID__c = RowID; oOrganisation.Web_Site__c = WebsiteURL; Upsert oOrganisation Organization_Business_ID__c; return oOrganisation; } 

Organization_Business_ID__c is an external id field . how can i get rid of the error : System.SecurityException: ViewAllData or ViewAllRecords required to access external id fields which do not have a unique index

System.SecurityException: ViewAllData or ViewAllRecords required to access external id fields which do not have a unique index

I am trying to cover the following in my test class.

@RemoteAction global static Tfunc InsertOrg(String Name,String AddressLine1,String AddressLine2,String AddressLine3,String AddressLine4,String City,String Country,String CountryName,String AliasName,String PostalCode,String StateOrProvince,String BusinessID,String RowID,String WebsiteURL){ TOrg__c oOrganisation = new TOrg__c(); oOrganisation.Name = Name; oOrganisation.Address_1__c = AddressLine1; oOrganisation.Address_2__c = AddressLine2; oOrganisation.Address_3__c = AddressLine3; oOrganisation.Address_4__c = AddressLine4; oOrganisation.City_Name__c = City; oOrganisation.Country__c = Country; oOrganisation.Country_Name__c = CountryName; oOrganisation.Postal_Code__c = PostalCode; oOrganisation.State_Province__c = StateOrProvince; oOrganisation.Organization_Business_ID__c = BusinessID; oOrganisation.Org_Row_ID__c = RowID; oOrganisation.Web_Site__c = WebsiteURL; Upsert oOrganisation Organization_Business_ID__c; return oOrganisation; } 

Organization_Business_ID__c is an external id field . how can i get rid of the error : System.SecurityException: ViewAllData or ViewAllRecords required to access external id fields which do not have a unique index

I am trying to cover the following in my test class.

@RemoteAction global static Tfunc InsertOrg(String Name,String AddressLine1,String AddressLine2,String AddressLine3,String AddressLine4,String City,String Country,String CountryName,String AliasName,String PostalCode,String StateOrProvince,String BusinessID,String RowID,String WebsiteURL){ TOrg__c oOrganisation = new TOrg__c(); oOrganisation.Name = Name; oOrganisation.Address_1__c = AddressLine1; oOrganisation.Address_2__c = AddressLine2; oOrganisation.Address_3__c = AddressLine3; oOrganisation.Address_4__c = AddressLine4; oOrganisation.City_Name__c = City; oOrganisation.Country__c = Country; oOrganisation.Country_Name__c = CountryName; oOrganisation.Postal_Code__c = PostalCode; oOrganisation.State_Province__c = StateOrProvince; oOrganisation.Organization_Business_ID__c = BusinessID; oOrganisation.Org_Row_ID__c = RowID; oOrganisation.Web_Site__c = WebsiteURL; Upsert oOrganisation Organization_Business_ID__c; return oOrganisation; } 

Organization_Business_ID__c is an external id field . how can i get rid of the error :

System.SecurityException: ViewAllData or ViewAllRecords required to access external id fields which do not have a unique index

Source Link
starhunter
  • 799
  • 2
  • 15
  • 38

System.SecurityException: ViewAllData or ViewAllRecords required to access external id fields which do not have a unique index

I am trying to cover the following in my test class.

@RemoteAction global static Tfunc InsertOrg(String Name,String AddressLine1,String AddressLine2,String AddressLine3,String AddressLine4,String City,String Country,String CountryName,String AliasName,String PostalCode,String StateOrProvince,String BusinessID,String RowID,String WebsiteURL){ TOrg__c oOrganisation = new TOrg__c(); oOrganisation.Name = Name; oOrganisation.Address_1__c = AddressLine1; oOrganisation.Address_2__c = AddressLine2; oOrganisation.Address_3__c = AddressLine3; oOrganisation.Address_4__c = AddressLine4; oOrganisation.City_Name__c = City; oOrganisation.Country__c = Country; oOrganisation.Country_Name__c = CountryName; oOrganisation.Postal_Code__c = PostalCode; oOrganisation.State_Province__c = StateOrProvince; oOrganisation.Organization_Business_ID__c = BusinessID; oOrganisation.Org_Row_ID__c = RowID; oOrganisation.Web_Site__c = WebsiteURL; Upsert oOrganisation Organization_Business_ID__c; return oOrganisation; } 

Organization_Business_ID__c is an external id field . how can i get rid of the error : System.SecurityException: ViewAllData or ViewAllRecords required to access external id fields which do not have a unique index