• phoenix7788
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
お世話になっております。

以下のようなApex Batchを書いていますが、

  global Iterable<AggregateResult> start(Database.BatchableContext bc) {
    AggregateResult[] sg= [SELECT Phone FROM Account WHERE Phone <> null GROUP BY Phone HAVING COUNT(Phone) >= 2];
    return sg;
  }

なぜかToo many query rowsのエラーが出ました。

09:39:03.0 (22546931)|SOQL_EXECUTE_BEGIN|[32]|Aggregations:0|SELECT Phone FRO Account WHERE Phone != NULL GROUP BY Phone HAVING COUNT(Phone) >= 2
09:39:03.0 (570162894)|SOQL_EXECUTE_END|[32]|Rows:44
09:39:03.0 (570212289)|EXCEPTION_THROWN|[32]|System.LimitException: Too many query rows: 50001
09:39:03.0 (570386384)|HEAP_ALLOCATE|[32]|Bytes:30
09:39:03.0 (570430741)|SYSTEM_MODE_EXIT|false 09:39:03.0 (570514055)|FATAL_ERROR|System.LimitException: Too many query rows: 50001

Apex Batch最初のデータ取得で件数制限ないと思いますが、件数制限エラーが出ました。
(ちなみに、Name項目だと問題なく実行できました。
× System.LimitException: Too many query rows: 50001
AggregateResult[] sg= [SELECT Phone FROM Account WHERE Phone <> null GROUP BY Phone HAVING COUNT(Phone) >= 2];
○ No error
AggregateResult[] sg= [SELECT Name FROM Account WHERE Name <> null GROUP BY Name HAVING COUNT(Name) >= 2];
)

なぜでしょうか??
hi

I have a apex batch:

  global Iterable<AggregateResult> start(Database.BatchableContext bc) {
    AggregateResult[] sg= [SELECT Phone FROM Account WHERE Phone <> null GROUP BY Phone HAVING COUNT(Phone) >= 2];
    return sg;
  }

but it doesnt working.The error is:

09:39:03.0 (22546931)|SOQL_EXECUTE_BEGIN|[32]|Aggregations:0|SELECT Phone FRO Account WHERE Phone != NULL GROUP BY Phone HAVING COUNT(Phone) >= 2
09:39:03.0 (570162894)|SOQL_EXECUTE_END|[32]|Rows:44
09:39:03.0 (570212289)|EXCEPTION_THROWN|[32]|System.LimitException: Too many query rows: 50001
09:39:03.0 (570386384)|HEAP_ALLOCATE|[32]|Bytes:30
09:39:03.0 (570430741)|SYSTEM_MODE_EXIT|false 09:39:03.0 (570514055)|FATAL_ERROR|System.LimitException: Too many query rows: 50001

i dont know why the error is happen.
(there is no error by using Name field
× System.LimitException: Too many query rows: 50001
AggregateResult[] sg= [SELECT Phone FROM Account WHERE Phone <> null GROUP BY Phone HAVING COUNT(Phone) >= 2];
○ No error
AggregateResult[] sg= [SELECT Name FROM Account WHERE Name <> null GROUP BY Name HAVING COUNT(Name) >= 2];
)

Is there a way to solve this?
 
Having trouble with the sign-up process for the new Predictive Vision Service?  Please let us know here and we will work to help you through the process.  

Thanks!
 
お世話になっております。

取引先責任者から参照関係にある職歴というオブジェクトがあります。
職歴を取引先責任者のIDをキーにSOQLでリストとして取得し、visualforceのPDFに表示したいと考えています。
ただし下図のように11件の職歴の枠は固定で表示したいと考えています。
User-added image
解決できないのが、dataTableなどで表示しようとすると上図のように3件しか職歴のレコードがない場合は、
職歴4以降が表示されなくなってしまいます。
職歴の番号ごとにSOQLで個別に取得することで解決はできますが、11回クエリを消費するため、
1回で取得でき、かつリストにない番号もあわせて表示する方法はあるものでしょうか。
  • July 11, 2016
  • Like
  • 0
お世話になっております。

以下のようなApex Batchを書いていますが、

  global Iterable<AggregateResult> start(Database.BatchableContext bc) {
    AggregateResult[] sg= [SELECT Phone FROM Account WHERE Phone <> null GROUP BY Phone HAVING COUNT(Phone) >= 2];
    return sg;
  }

なぜかToo many query rowsのエラーが出ました。

09:39:03.0 (22546931)|SOQL_EXECUTE_BEGIN|[32]|Aggregations:0|SELECT Phone FRO Account WHERE Phone != NULL GROUP BY Phone HAVING COUNT(Phone) >= 2
09:39:03.0 (570162894)|SOQL_EXECUTE_END|[32]|Rows:44
09:39:03.0 (570212289)|EXCEPTION_THROWN|[32]|System.LimitException: Too many query rows: 50001
09:39:03.0 (570386384)|HEAP_ALLOCATE|[32]|Bytes:30
09:39:03.0 (570430741)|SYSTEM_MODE_EXIT|false 09:39:03.0 (570514055)|FATAL_ERROR|System.LimitException: Too many query rows: 50001

Apex Batch最初のデータ取得で件数制限ないと思いますが、件数制限エラーが出ました。
(ちなみに、Name項目だと問題なく実行できました。
× System.LimitException: Too many query rows: 50001
AggregateResult[] sg= [SELECT Phone FROM Account WHERE Phone <> null GROUP BY Phone HAVING COUNT(Phone) >= 2];
○ No error
AggregateResult[] sg= [SELECT Name FROM Account WHERE Name <> null GROUP BY Name HAVING COUNT(Name) >= 2];
)

なぜでしょうか??
Hello
I am updating account rating from opportunity trigger. whenever opportunity stagename='Closed won', then in acocount , rating = 'Hot'

public class AccountUpdates_from_oppor
{
   public void updateaccount(list<Opportunity> accountid)
   {
      list<ID> accids = new list<ID>();
     
      list<Account> accountratings_new  = new list<Account>();
     
      for(Opportunity o:accountid)
      {
         accids.add(o.accountid);        
      }
     
      list<Account> acctratings = [select Id,rating from Account where ID=:accids];
     
      for(Opportunity opp:accountid)
      {
         for(Account a:acctratings)
         {
           if (opp.StageName == 'Closed Won')
               a.Rating='Hot';
        
               accountratings_new.add(a);
         }       
      }
      Database.Update(accountratings_new);
  }
}

trigger trg_updateaccountratings on Opportunity (before Insert,before Update)
{
  if (trigger.IsBefore)
  {
    if (trigger.IsUpdate)
    {
     AccountUpdates_from_oppor a1 = new AccountUpdates_from_oppor();
     a1.updateaccount(Trigger.New);
    }
  }
}

@istest(SeeAllData=false)
private class Accountopportunity_Test
{
    private static testmethod void validatetest()
    {
         Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator'];
         User u = new User(Alias = 'sample', Email='standarduser@testorg.com',
         EmailEncodingKey='UTF-8', LastName='sampleLname', LanguageLocaleKey='en_US',
         LocaleSidKey='en_US', ProfileId = p.Id,
         TimeZoneSidKey='America/Los_Angeles', UserName='testnamesss@testorg.com');
        
         system.runAs(u)
         {
        
              Account  acn = new Account();
              acn.Name='test1';
            
              Opportunity opp = new Opportunity();
              opp.Name='test opp';
              opp.CloseDate=System.Today();
              opp.StageName='Closed Won';
             
              Test.StartTest();
             
              Database.Insert(acn);
              Database.Insert(opp);
              system.assertEquals(acn.Rating,''Hot');
             
              Test.StopTest();
          }
       }
   }

Apex class & trigger working fine.​
​But when I execute test class I am getting error as :  " System.AssertException: Assertion Failed: Expected: None, Actual: Hot"

Thanks
sonali​​
I am getting this error:

Atmember: execution of AfterUpdate caused by: System.QueryException: List has no rows for assignment to SObject Class.ATeam_Cls.teamassign: line 66, column 1 Trigger.Atmember: line 2, column 1

class: public class ATeam_Cls {
        
    public static void teamassign(List<Account> newList){
        
        List<AccountTeamMember> latm = new List<AccountTeamMember>();
        List<AccountShare> las = new List<AccountShare>();
        set<id> setids = new set<id>();
        List<User> us = [Select id,userrole.Name,username,Email,profile.name from User where IsActive = true];
        
        for (Account acc : newList) {
            setids.add(acc.id);
        }
        
        List<AccountTeamMember> oldatm = [select id from AccountTeamMember where AccountId in : setids];
        if(oldatm != null){
            delete(oldatm);
        }
        
        for (Account acc : newList) {
        
        ID uid = acc.OwnerId;
        
        for(IDEXX_Water_Territories__c s : IDEXX_Water_Territories__c.getAll().values()){
            
            if(acc.Territory_ID__c == s.Territory_ID__c){ 
                
                for(User u : us){
                
                    if(u.Email == s.User_Email_Address__c ){
        
                        AccountTeamMember atm = new AccountTeamMember();
                        AccountShare  nas = new AccountShare();
                        atm.AccountId = acc.id;                
                        atm.TeamMemberRole = s.TeamMemberRole__c;
                        atm.UserId=u.id; 
                        latm.add(atm);
                        
                        if(u.profile.name != 'System Administrator'){
                         
                            nas.AccountId =acc.id; 
                            nas.UserOrGroupId =u.id;
                            nas.AccountAccessLevel ='Edit';
                            nas.OpportunityAccessLevel = 'Edit';
                            nas.CaseAccessLevel = 'Edit';
                            las.add(nas);
        
                        }
                       
                      
                    }
                }  
            }
        } 
       }
       
        
        try{
            
            insert(las);
            insert(latm);            
            
        }catch(DMLException e){
        
                    system.debug('error on deleting team members ' + e.getMessage());
        } 
        user usr = [select id,name,UserRole.Name from user where id =: userInfo.getUserId()];
    
    for(Account acc : newList){
       AccountTeamMember atm1 = new AccountTeamMember();
    
        atm1.AccountId = acc.id;                
        atm1.TeamMemberRole = usr.UserRole.Name;
        atm1.UserId=UserInfo.getUserId(); 
    
        try{
        
            insert atm1;
        }catch(DMLException e){
        
                    system.debug('error on deleting team members ' + e.getMessage());
        }

    
    }
    }
}

Trigger:

trigger Atmember on Account (after insert,after update) {
    ATeam_Cls.teamassign(trigger.new);
}

above are the class and trigger . please anyone help me out how can it be solved
お世話になります。質問させていただきます。

「取引先責任者」タブ内に、独自で作成したvisualforceページを配置することはできるのでしょうか?
設定関係を探してみたのですが、単に設定を見つけられないのか
もしくはそもそも上記のようなことは不可能なのかどうかを知りたいと思っています。

もしご存知のかたがいらっしゃいましたらご教授願えればと思います。
お世話になっております。
掲題の件について質問させて頂きます。

①設定>カスタマイズ>取引先>制限
  →で確認できるカスタム項目の利用状況と、
②設定>カスタマイズ>取引先>項目
  →に表示されているカスタム項目数

①と②の数が合わないのですが、何か考えられることはありますでしょうか。

何かご存じの方がいらっしゃいましたらご教授頂きたいです。
どうぞ宜しくお願い致します。
お世話になっております。

提題の件について質問させてください。
現在、社内用システムを標準カスタマイズで構築しています。

あるページを編集して保存したときに、一つ上の階層に戻るという機能を実装
してほしいという要望があがっているのですが、どのようにすれば対応可能でしょうか。

ご存じの方がいらっしゃいましたらご教示いただけますと幸いです。
よろしくお願いいたします。