• cathy_i
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies

hello, 

I'm a beginner in terms of apex coding in salesforce. And i had a very urgent requirement from the company i'm working with. Now, i managed to create an apex page and class controller but i couldnt have my test class run successfully. There's no error so far, but there's no message in the Run Test either that it was successful in the Apex test runner.

 

Here's my code:

--- CONTROLLER---

public with sharing class autoAccountSearchController {

public String strDebug1 {get;set;}
public List<Account> accounts {get;set;}

public autoAccountSearchController()
{
accounts = new List<Account>();
Account a = [select Id, Name from Account limit 1];
}
public PageReference populateAccounts()
{
accounts = [select Id, Name from Account where Name like :(strDebug1 + '%')];
return null;
}

}

 

--- TEST CLASS----

@isTest
private class testAutoAccountSearch {

 

static testMethod void mytestAutoAccountSearch () {
// TO DO: implement unit test

Account accounts = new Account(Id = '001f0000008M81y', Name = 'Test', OwnerId='005a0000007nDqPAAU', Site='PH NCR (4thDistrict) -City of Makati' );

testAutoAccountSearch test_a = new testAutoAccountSearch ();
   }
}

 

in Debug log this is what i get:

Debug Log:

26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
18:11:18.350 (1350393000)|EXECUTION_STARTED
18:11:18.350 (1350429000)|CODE_UNIT_STARTED|[EXTERNAL]|01pf0000000D2f8|testAutoAccountSearch.mytestAutoAccountSearch
18:11:18.355 (1355335000)|METHOD_ENTRY|[2]|01pf0000000D2f8|testAutoAccountSearch.testAutoAccountSearch()
18:11:18.355 (1355349000)|METHOD_EXIT|[2]|testAutoAccountSearch
18:11:18.355 (1355746000)|CONSTRUCTOR_ENTRY|[11]|01pf0000000D2f8|<init>()
18:11:18.355 (1355795000)|CONSTRUCTOR_EXIT|[11]|01pf0000000D2f8|<init>()
18:11:17.554 (1355813000)|CUMULATIVE_LIMIT_USAGE
18:11:17.554|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
Number of code statements: 2 out of 200000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 100
Number of record type describes: 0 out of 100
Number of child relationships describes: 0 out of 100
Number of picklist describes: 0 out of 100
Number of future calls: 0 out of 10

18:11:17.554|CUMULATIVE_LIMIT_USAGE_END

18:11:18.355 (1355840000)|CODE_UNIT_FINISHED|testAutoAccountSearch.mytestAutoAccountSearch
18:11:18.355 (1355846000)|EXECUTION_FINISHED

 

--------------------

 

 

i hope someone will help me with this. 

thanks,

cat

 

Hi, 

Im a newbie in salesforce so i don't really know how to do trigger and extensive formula. I need to create a field that is Series No. that will automatically increment when an opportunity is created. However this incremental function depends on which product (custom field) has been chosen because we have a couple of products that involves a range in series.

ex.

Product 1, 2, 3 - series should belong to 0000 to 2999

Product 4, 5 - series should belong to 3000 to 3999

 

If Opportunity 1 is posted choosing Prod 1 series should be 00001

If Opportunity 2 is posted choosing Prod 1 (same product) series should be 00002

If Opportunity 3 is posted choosing Prod 2 (same product) series should be 00003

If Opportunity 4 is posted choosing Prod 4 (same product) series should be 30001

 

please help.

thanks,

cat



 

hello, 

I'm a beginner in terms of apex coding in salesforce. And i had a very urgent requirement from the company i'm working with. Now, i managed to create an apex page and class controller but i couldnt have my test class run successfully. There's no error so far, but there's no message in the Run Test either that it was successful in the Apex test runner.

 

Here's my code:

--- CONTROLLER---

public with sharing class autoAccountSearchController {

public String strDebug1 {get;set;}
public List<Account> accounts {get;set;}

public autoAccountSearchController()
{
accounts = new List<Account>();
Account a = [select Id, Name from Account limit 1];
}
public PageReference populateAccounts()
{
accounts = [select Id, Name from Account where Name like :(strDebug1 + '%')];
return null;
}

}

 

--- TEST CLASS----

@isTest
private class testAutoAccountSearch {

 

static testMethod void mytestAutoAccountSearch () {
// TO DO: implement unit test

Account accounts = new Account(Id = '001f0000008M81y', Name = 'Test', OwnerId='005a0000007nDqPAAU', Site='PH NCR (4thDistrict) -City of Makati' );

testAutoAccountSearch test_a = new testAutoAccountSearch ();
   }
}

 

in Debug log this is what i get:

Debug Log:

26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
18:11:18.350 (1350393000)|EXECUTION_STARTED
18:11:18.350 (1350429000)|CODE_UNIT_STARTED|[EXTERNAL]|01pf0000000D2f8|testAutoAccountSearch.mytestAutoAccountSearch
18:11:18.355 (1355335000)|METHOD_ENTRY|[2]|01pf0000000D2f8|testAutoAccountSearch.testAutoAccountSearch()
18:11:18.355 (1355349000)|METHOD_EXIT|[2]|testAutoAccountSearch
18:11:18.355 (1355746000)|CONSTRUCTOR_ENTRY|[11]|01pf0000000D2f8|<init>()
18:11:18.355 (1355795000)|CONSTRUCTOR_EXIT|[11]|01pf0000000D2f8|<init>()
18:11:17.554 (1355813000)|CUMULATIVE_LIMIT_USAGE
18:11:17.554|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 0 out of 100
Number of query rows: 0 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
Number of code statements: 2 out of 200000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 10
Number of Email Invocations: 0 out of 10
Number of fields describes: 0 out of 100
Number of record type describes: 0 out of 100
Number of child relationships describes: 0 out of 100
Number of picklist describes: 0 out of 100
Number of future calls: 0 out of 10

18:11:17.554|CUMULATIVE_LIMIT_USAGE_END

18:11:18.355 (1355840000)|CODE_UNIT_FINISHED|testAutoAccountSearch.mytestAutoAccountSearch
18:11:18.355 (1355846000)|EXECUTION_FINISHED

 

--------------------

 

 

i hope someone will help me with this. 

thanks,

cat

 

Hi, 

Im a newbie in salesforce so i don't really know how to do trigger and extensive formula. I need to create a field that is Series No. that will automatically increment when an opportunity is created. However this incremental function depends on which product (custom field) has been chosen because we have a couple of products that involves a range in series.

ex.

Product 1, 2, 3 - series should belong to 0000 to 2999

Product 4, 5 - series should belong to 3000 to 3999

 

If Opportunity 1 is posted choosing Prod 1 series should be 00001

If Opportunity 2 is posted choosing Prod 1 (same product) series should be 00002

If Opportunity 3 is posted choosing Prod 2 (same product) series should be 00003

If Opportunity 4 is posted choosing Prod 4 (same product) series should be 30001

 

please help.

thanks,

cat



 

I'm using a trigger to submit custom object records for approval as soon as they are created.  Here is the code that submits the record(s):

 

 

trigger modSubmitter on Modification__c (after Insert) { Approval.ProcessSubmitRequest[] reqs = new Approval.ProcessSubmitRequest[]{}; for(Modification__c m : Trigger.New){ if(m.Status__c!='Approved'){ Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest(); req1.setObjectId(m.id); reqs.add(req1); } } if(reqs.size()>0) Approval.ProcessResult[] result = Approval.process(reqs); }

 

 

 I then try inserting a record and it fails because an exception is thrown, error is "MANAGER_NOT_DEFINED".  All users involved in the process have managers defined in their user records... plus the approval process doesn't look at the manager field on any users anyhow... it just uses 'related user' lookup fields for all steps.

 

The API docs just say that this error means there is no manager for the approval process, which doesn't help much.  I scoured the Apex guides to see if there were more Approval methods available for somehow defining a "manager" for the request, but there is nothing.

 

Any ideas?