• rao6308
  • NEWBIE
  • 5 Points
  • Member since 2010

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

Experts

 

Please help me find my mistake in the following test method :

 

main class method :
    public PageReference savenew()
    {   
        multi_deal__c savenewrec = new multi_deal__c
            (    
               /* name                         = multinew.name,
                unit_buy_price__c            = multinew.unit_buy_price__c,
                opportunity__c               = CurrentId,
                unit_sell_price__c           = multinew.unit_sell_price__c,
                global_sfdc_category__c      = multinew.global_sfdc_category__c,
                //unit_value__c              = fixFormatting(unitval)
                unit_value__c                = multinew.unit_value__c,
                global_sfdc_subcategory_1__c = multinew.global_sfdc_subcategory_1__c,
                global_sfdc_subcategory_2__c = multinew.global_sfdc_subcategory_2__c */
                
                Display_order__c                         = multinew.display_order__c,
                opportunity__c                           = currentid,
                name                                     = multinew.name,
                Total_Deal_Max__c                        = multinew.Total_Deal_Max__c,
                Buyer_max__c                             = multinew.Buyer_Max__c,
                Global_SFDC_Category__c                  = multinew.Global_SFDC_Category__c,                                        
                Global_SFDC_Subcategory_1__c             = multinew.Global_SFDC_Subcategory_1__c,
                Global_SFDC_Subcategory_2__c             = multinew.Global_SFDC_Subcategory_2__c,
                unit_value__c                            = multinew.unit_value__c,
                Unit_Sell_Price__c                       = multinew.Unit_Sell_Price__c,
                Unit_buy_price__c                        = multinew.Unit_buy_Price__c,
                Alternative_Highlights__c                = multinew.Alternative_Highlights__c,
                Multi_Deal_Expiration_Date__c            = multinew.Multi_Deal_Expiration_Date__c       
            );
        Database.SaveResult SR = database.insert(savenewrec);
        if(sr.isSuccess())
        {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Multi Deal Data saved.'+ savenewrec.Id);
            ApexPages.addMessage(myMsg);
            cancelnewmode();
        }
        return null;
    }


test method :

//Inserts
 account a = new account();
                         a.name = 'test acct';
                         insert a;                       
                         
                         opportunity o = new opportunity();
                         o.name = 'test oppty';
                         o.StageName = 'Prospecting';
                         o.CloseDate = date.today();
                         o.Deal_Strengh__c = 'Rep Getting Info';
                         o.Feature_Date__c = date.newinstance(2011, 7, 15);
                         o.AccountId = a.Id;
                         insert o;                        
                         
                         //insert multi-deal
                         multi_deal__c md = new multi_deal__c(
                         Opportunity__c = o.Id,
                         name           = 'test',
                         unit_value__c  = 123);
                            
//Inserts
Test.starttest();
insert md;
Test.stoptest();
checkbox_class check = new checkbox_class();
PageReference p = Page.oppmultideals;
Test.setCurrentPageReference(p);
System.currentPageReference().getParameters().put('id',md.opportunity__c);
check.savenew(); == when i call this method i get the following error :

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

Class.Checkbox_Class.savenew: line 58, column 34 Class.Checkbox_Class.createmultideal: line 308, column 3 External entry point

 

I am sure I am missing something, please help me out

 

Thanks a lot in advance.

Experts

 

Please help me find my mistake in the following test method :

 

main class method :
    public PageReference savenew()
    {   
        multi_deal__c savenewrec = new multi_deal__c
            (    
               /* name                         = multinew.name,
                unit_buy_price__c            = multinew.unit_buy_price__c,
                opportunity__c               = CurrentId,
                unit_sell_price__c           = multinew.unit_sell_price__c,
                global_sfdc_category__c      = multinew.global_sfdc_category__c,
                //unit_value__c              = fixFormatting(unitval)
                unit_value__c                = multinew.unit_value__c,
                global_sfdc_subcategory_1__c = multinew.global_sfdc_subcategory_1__c,
                global_sfdc_subcategory_2__c = multinew.global_sfdc_subcategory_2__c */
                
                Display_order__c                         = multinew.display_order__c,
                opportunity__c                           = currentid,
                name                                     = multinew.name,
                Total_Deal_Max__c                        = multinew.Total_Deal_Max__c,
                Buyer_max__c                             = multinew.Buyer_Max__c,
                Global_SFDC_Category__c                  = multinew.Global_SFDC_Category__c,                                        
                Global_SFDC_Subcategory_1__c             = multinew.Global_SFDC_Subcategory_1__c,
                Global_SFDC_Subcategory_2__c             = multinew.Global_SFDC_Subcategory_2__c,
                unit_value__c                            = multinew.unit_value__c,
                Unit_Sell_Price__c                       = multinew.Unit_Sell_Price__c,
                Unit_buy_price__c                        = multinew.Unit_buy_Price__c,
                Alternative_Highlights__c                = multinew.Alternative_Highlights__c,
                Multi_Deal_Expiration_Date__c            = multinew.Multi_Deal_Expiration_Date__c       
            );
        Database.SaveResult SR = database.insert(savenewrec);
        if(sr.isSuccess())
        {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.info,'Multi Deal Data saved.'+ savenewrec.Id);
            ApexPages.addMessage(myMsg);
            cancelnewmode();
        }
        return null;
    }


test method :

//Inserts
 account a = new account();
                         a.name = 'test acct';
                         insert a;                       
                         
                         opportunity o = new opportunity();
                         o.name = 'test oppty';
                         o.StageName = 'Prospecting';
                         o.CloseDate = date.today();
                         o.Deal_Strengh__c = 'Rep Getting Info';
                         o.Feature_Date__c = date.newinstance(2011, 7, 15);
                         o.AccountId = a.Id;
                         insert o;                        
                         
                         //insert multi-deal
                         multi_deal__c md = new multi_deal__c(
                         Opportunity__c = o.Id,
                         name           = 'test',
                         unit_value__c  = 123);
                            
//Inserts
Test.starttest();
insert md;
Test.stoptest();
checkbox_class check = new checkbox_class();
PageReference p = Page.oppmultideals;
Test.setCurrentPageReference(p);
System.currentPageReference().getParameters().put('id',md.opportunity__c);
check.savenew(); == when i call this method i get the following error :

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

Class.Checkbox_Class.savenew: line 58, column 34 Class.Checkbox_Class.createmultideal: line 308, column 3 External entry point

 

I am sure I am missing something, please help me out

 

Thanks a lot in advance.

How do I obtain the Visualforce page code for the Tab, Summary, Detail, Edit and Delete pages of a custom object? I would like to customize it to add my own markup or remove certain elements to create a unique look without having to write too much apex code. This helps develop custom pages faster and reduces the amount of testing (meaning saves more development $$$).



Thanks in Advance

freshstart force

I understand you can map custom lead fields to opportunity, account, etc. How can you change the mapping of "Standard" lead fields.

 

For example, Standard lead field "Mailing Address" is automatically mapped to show up in the Contact field. Is there anyway to change that? For example, I would like that to show up in the opportunity tab.

 

Thanks!

Hi All,

 

How to use a field in validation from other object that does not have relation in between.

The StageName and Renewal are from 'Opportunity' and Details_Required_for_Renewals__c is from the object 'Product'.

There is no relationship in between the Opportunity and Product objects(means no lookup or masterdetail field is created)

 

I wrote the formula as given:

AND(
           Renewal__c="", 
           OR(  ISPICKVAL( StageName, "Signed contract received"),
                    ISPICKVAL( StageName, "Closed Won")),
           $ObjectType.Product__c.Fields.Details_Required_for_Renewals__c, "FALSE"
 )

when i'm clicking check for syntax i'm getting the following error

" Incorrect parameter for function AND(). Expected Boolean, received Object "

 

any help to overcome this error will be appreciated.

 

Thanks in Advance.

  • September 22, 2010
  • Like
  • 0

I've got an updated verison of our app logo which is to be added and released.

 

Through the documents tab, I have opened up the logo document and replaced it with the new logo. I've released the new version (a major version upgrade - 1.3 to 1.4) and it has not updated my logo.

 

I had beta tested prior to the managed release but I had forgot to check the logo.

 

So why is this happening and can I change the logo via a patch upgrade?

 

Should I do it by creating a new document for the logo altogether (which would mean an entirely new major version)?

 

Thanks in advance,

Luke

HELP , I have refreshed a sandbox but cannot login since.  I have used the production login + the sandbox name and the same password but i can't login .

 

Does the login / password change when you refresh a sandbox?

Please help me understand what is going on here.  According to the documentation this code should work with no issues.  I am trying to cast a return value of type parent class to a child class variable.  This code compiles fine but throws 

 

System.TypeException: Invalid conversion from runtime type Class1Test to Class1ExtensionTest

 

Here is the sample code

 

 

public virtual class Class1Test {

private string sCopy;
public Class1Test(string s){
sCopy = s;
}

public class Class1ExtensionTest extends Class1Test{

public Class1ExtensionTest(string s){
super(s);
}
}
}

public class TestClass{

public static testmethod void testmethod(){
Class1Test.Class1ExtensionTest t = (Class1Test.Class1ExtensionTest)testCasting();
}

private Class1Test testCasting( ){
return new Class1Test('This Should work');
}
}

 

 

 

I have created a trigger which is calling an external web service to synchronize the leads creation/deletion process. When i delete/create leads the web service is working fine but when i mass upload it(mass import process..) or mass delete process (when it reaches its max limit..i.e. 250) it throws an exception and an error mail is generated with this error "System.CalloutException: IO Exception: Read timed out" error. I have also added the timeout_x property in my code to the max value(60000). But still its throwing the same error. Kindly help. Thanks in advance. Shaveta