• fatmonk
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 10
    Replies

I have a problem with Miising Field.  Here is full  test: -- 

 

 

private class TestChargeCostUpdate{
static testMethod void testCCUpdate(){
// create data
Account acc = new Account(name='TestAccount');
insert acc;
Opportunity op = new Opportunity(AccountId=acc.id,name='Test Opp',StageName='Provided Quote',CloseDate=Date.toDay());
insert op;
Charge__c es1 = new Charge__c(Opportunity__c = op.id, Monthly_Recurring_Charge__c=1);
insert es1;
Contract contr = new Contract(Opportunity__c = op.id);
insert contr;
   }

}

 

Error:

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [AccountId]: [AccountId]

 

 

Thanks for your help. 

 

 

I am writing my first trigger test: cover =0% 

Message:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You Must Enter A Charge: []

 

Stack Trace

Class.TestUpdateCharge.testChargeContractTrigger: line 6, column 1

 

 

 

@isTest
  public Class TestUpdateCharge {

  static testMethod void testChargeContractTrigger(){
 Charge__c c = new Charge__c (City__c = 'Oakland');
  insert c; <-- line 6


c = [select id,contract__c,Opportunity__c from Charge__c where City__c = 'Oakland'];

System.assertEquals(null, c.contract__c);
System.assertEquals(null, c.Opportunity__c);

}

}

Thanks,

I am writing my first trigger test: cover =0% 

Message:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You Must Enter A Charge: []

 

Stack Trace

Class.TestUpdateCharge.testChargeContractTrigger: line 6, column 1

 

 

 

1@isTest
public Class TestUpdateCharge {

static testMethod void testChargeContractTrigger(){
Charge__c c = new Charge__c (City__c = 'Oakland');
insert c;


c = [select id,contract__c,Opportunity__c from Charge__c where City__c = 'Oakland'];

System.assertEquals(null, c.contract__c);
System.assertEquals(null, c.Opportunity__c);

}

}

I use the code from
http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref_listViews.htm%7CStartTopic=Content%2Fpages_compref_listViews.htm%7CSkinName=webhelp

 

<apex:page standardController="Contract" recordSetVar="Contract" >
<apex:form id="theform">
<apex:selectList value="{!filterid}" size="1">
<apex:selectOptions value="{!listviewoptions}"/>
</apex:selectList>
<apex:commandButton value="Go" action="{!list}" reRender="list"/>
<apex:pageBlock >

<apex:pageBlockTable value="{!contract}" var="c" id="list">
<apex:column ><apex:facet name="header"> Order Form Number</apex:facet>

value="{!c.ContractNumber}"</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Problem is When I Click on GO button, The page Jump to standard apex URL(/800/o) instead of refresh the /apex/Contract page.

Does any one know how to refresh the page only? Thanks

I have two custom objects Invoice__c and Estimate__c which looksUp to contract.

On Contract standard detail page displays both Invoives and Estimates RelatedList but if I create a costom detail page, they both do not show;

Here is example link to custom detail page: 

 

.visual.force.com/apex/Contract?id=800U0000000DV5z

 

vf:

 

<apex:page standardController="contract">
    <apex:pageBlock >
        <apex:detail relatedList="true"/>

    </apex:pageBlock>
</apex:page>

 

am i missing something?

I am a new bie to trigger. I would like to create a trigger for Contracts. Currently the object existing Object are Opportunity is a Master Relation of two Custom Object Estimate__c and Expense__c and it also has a look up relatioship with Contract.

 

Each Contract can have multiple Estimate__c and Expense__c.

Estimate__c, Expense__c and Contract can be created under Opportunity in an order. When the Contract is Create and new record, I would like to have (Expense and Estimate show under Contract related list because they all share Opportunity id.)

I don't how to insert the Contract.id into Expesen__c.Contract__c or Estimate__c.contract__c. 

 

Thanks so much.

Luong

 

I am having problem with right mouse click 

I create a custom search list result. on The ReturnResult Listview. it works fine(go to the detail page)  if I click  on the link. but when use the right mouse click (Open New Tab) I get a new search page instead. 

Here is the code:

 <apex:commandLink action="/apex/CustomAcountDetail_Test?id={!acc.id}" value={!acc.name}> 

 

Thanks

I am a newbie to VF and Apex. I have developed a custom account search which return a listview.

ListView account links to Detail page. Here is a problem: when user returns from detail page, the listview is fresh or clear out. How could i keep the listview of search result. I turn cache="true" it does not work?

Thanks;

  • September 30, 2011
  • Like
  • 0

I have a problem with Miising Field.  Here is full  test: -- 

 

 

private class TestChargeCostUpdate{
static testMethod void testCCUpdate(){
// create data
Account acc = new Account(name='TestAccount');
insert acc;
Opportunity op = new Opportunity(AccountId=acc.id,name='Test Opp',StageName='Provided Quote',CloseDate=Date.toDay());
insert op;
Charge__c es1 = new Charge__c(Opportunity__c = op.id, Monthly_Recurring_Charge__c=1);
insert es1;
Contract contr = new Contract(Opportunity__c = op.id);
insert contr;
   }

}

 

Error:

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [AccountId]: [AccountId]

 

 

Thanks for your help. 

 

 

I am writing my first trigger test: cover =0% 

Message:

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You Must Enter A Charge: []

 

Stack Trace

Class.TestUpdateCharge.testChargeContractTrigger: line 6, column 1

 

 

 

@isTest
  public Class TestUpdateCharge {

  static testMethod void testChargeContractTrigger(){
 Charge__c c = new Charge__c (City__c = 'Oakland');
  insert c; <-- line 6


c = [select id,contract__c,Opportunity__c from Charge__c where City__c = 'Oakland'];

System.assertEquals(null, c.contract__c);
System.assertEquals(null, c.Opportunity__c);

}

}

Thanks,

I have two custom objects Invoice__c and Estimate__c which looksUp to contract.

On Contract standard detail page displays both Invoives and Estimates RelatedList but if I create a costom detail page, they both do not show;

Here is example link to custom detail page: 

 

.visual.force.com/apex/Contract?id=800U0000000DV5z

 

vf:

 

<apex:page standardController="contract">
    <apex:pageBlock >
        <apex:detail relatedList="true"/>

    </apex:pageBlock>
</apex:page>

 

am i missing something?

I am a new bie to trigger. I would like to create a trigger for Contracts. Currently the object existing Object are Opportunity is a Master Relation of two Custom Object Estimate__c and Expense__c and it also has a look up relatioship with Contract.

 

Each Contract can have multiple Estimate__c and Expense__c.

Estimate__c, Expense__c and Contract can be created under Opportunity in an order. When the Contract is Create and new record, I would like to have (Expense and Estimate show under Contract related list because they all share Opportunity id.)

I don't how to insert the Contract.id into Expesen__c.Contract__c or Estimate__c.contract__c. 

 

Thanks so much.

Luong

 

I am having problem with right mouse click 

I create a custom search list result. on The ReturnResult Listview. it works fine(go to the detail page)  if I click  on the link. but when use the right mouse click (Open New Tab) I get a new search page instead. 

Here is the code:

 <apex:commandLink action="/apex/CustomAcountDetail_Test?id={!acc.id}" value={!acc.name}> 

 

Thanks

Hi there. I have the following code:

 

public class TestController { public TestController() { castIt(); } private void castIt() { String s = 'TRUE'; try { Boolean b = Boolean.valueOf(s); }catch(Exception e) { System.debug('******** THERE WAS AN EXCEPTION: ' + e.getMessage()); } } }

 This will not work!

I get an exception everytime I try to do this and I can't figure out for the life of me why.

Any ideas? It seems so simple.

Thanks

 

 

  • January 28, 2009
  • Like
  • 0