• povery.sf@gmail.com
  • NEWBIE
  • 5 Points
  • Member since 2016
  • Salesforce Consultant

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
Hello,

I am new for apex classes. I was trying to create a trigger which replicate the account recorded to custom object. All account standard and custom field.

Could someone help me please?

Thanks
 
  • January 28, 2016
  • Like
  • 1
How does on delete Custom URLs From sites. I have tried every thing.
I Deactivated the site.  still the link for del is greyed out. 
gone to  Domain Management Custom URLs and its del link is greyed out too. click the edit link and it takes me back to the site edit page. 
What do i need to do to get rid of the custom URL in the Site pages. 
how to create data in test class for custom setting, with out using SeeAllData=true.
custom setting name is: AllCodeValues__c,  and field name is : firstcode__c
when you click the manage button on customm settings values are like below...
Atmakur    0012
Kavali       0013
kaluvai     0014
like this values is there so how can create data for this in test class.


thanks in advance.
  • January 25, 2016
  • Like
  • 0
public class AddingLineItemsController {
    public List<Professional_Services_Partner_Line_Items__C> LineItems {get;set;}
    public Integer rowNum{get;set;}
    public  AddingLineItemsController (){
        LineItems = new List<Professional_Services_Partner_Line_Items__c>();  
        LineItems.add(new Professional_Services_Partner_Line_Items__c());      
    }
    
    public void insertLineItems(){
        LineItems.Professional_Services_Partner_Contract__c = ApexPages.currentPage().getParameters().get('cid');
        insert LineItems;
    }
    
    public void insertRow(){
        LineItems.add(new Professional_Services_Partner_Line_Items__c()); 
    }
    
    public void delRow(){
        rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
        LineItems.remove(rowNum);   
    }
}

Above is my class. What I'm trying to accomplish is for the url parameter cid = Professional_Services_Partner_Contract__c for every row that is inserted. I keep getting this error: Error: Compile Error: Initial term of field expression must be a concrete SObject: List<Professional_Services_Partner_Line_Items__c> at line 10 column 9. Can anyone point me in the right direction?

Best,
Brian
 
HI, I'm working on the follwoing controller class test for a VF page. I've no idea if it works yet but when I run a test I get the following error.
 
TestMethod do not support Web service callouts

I belive this is because there is another trigger on the system that first when one of the objects  in the below test class is created. I don't want to remove this trigger, but I'd like somehow to edit my code below so that it doesn't throw up the error. I've read about mock calls but I'm not sure where the code would sit in my class. Any help would be appreiciated
 
@isTest
public class CreateIABookingControllerTest{
    public static testMethod void myTest() {
    PageReference pageRef = Page.CreateIABookingPage;
    Test.setCurrentPage (pageRef);
    CreateIABookingController controller = new CreateIABookingController();
    
    	//Set up test Account
        Account testaccount = new Account (Name='test account');
        insert testaccount;
        
        //Set up test Opp
        Opportunity testopp = new Opportunity(AccountId=testaccount.Id, Name = 'test opp', StageName = 'Closed Won', CloseDate = System.today());
        insert testopp;
        
        //Set up test IABooking
        ItsApproved_Booking__c testiabooking = new ItsApproved_Booking__c(Opportunity__c=testopp.Id);
        insert testiabooking;
        
        //Set up test IAProduct
        ItsApproved_Product__c testiaproduct = new ItsApproved_Product__c(Booking_Reference__c=testiabooking.Id,Opp__c=testopp.Id);
        insert testiaproduct;
        
        //Set up test IADesign
        ItsApproved_Design__c testiadesign = new ItsApproved_Design__c(Product_Reference__c=testiaproduct.Id,Opportunity__c=testopp.Id);
        insert testiadesign;
        
        //Set up test IADelivery
        ItsApproved_Delivery__c testiadelv = new ItsApproved_Delivery__c(ItsApproved_Design__c=testiadesign.Id,Opportunity__c=testopp.Id,Product__c=testiaproduct.Id);
        insert testiadelv;
    
    	controller = new CreateIABookingController();
    
    	//start test - Create Booking
    	controller.ItsApprovedBooking.Opportunity__c = testopp.Id;//related Opp
        controller.ItsApprovedBooking.Booking_Title__c = 'Booking Title';
        controller.ItsApprovedBooking.Customer_Reference__c = 'Customer Ref';
    	insert controller.ItsApprovedBooking;
        //Add Product to Booking
        controller.ItsApprovedProduct.Booking_Reference__c = testiabooking.Id;//related Booking
        controller.ItsApprovedProduct.Opp__c = testopp.Id;//related Opp
        controller.ItsApprovedProduct.Product_Code__c = 'Static 6s';
        insert controller.ItsApprovedProduct;
        //Add Design to Product
        controller.ItsApprovedDesign.Product_Reference__c = testiaproduct.Id; //related Product
        controller.ItsApprovedDesign.Opportunity__c = testopp.Id; //related Opp
        controller.ItsApprovedDesign.Artwork_Title__c = 'Artwork Title';
        insert controller.ItsApprovedDesign;
        //Add Delivery to Design
        controller.ItsApprovedDelivery.ItsApproved_Design__c = testiadesign.Id; //related Design
        controller.ItsApprovedDelivery.Product__c = testiaproduct.Id; //related Product
        controller.ItsApprovedDelivery.Opportunity__c = testopp.Id; //related Opp
        controller.ItsApprovedDelivery.Depot_Code__c = integer.valueOf(123);
        controller.ItsApprovedDelivery.Quantity__c = integer.valueOf(10);
        insert controller.ItsApprovedDelivery;

    }
}

 
Hello,

I am inserting a record to a custom object like below
 
List<Account> accountList = [SELECT  Id, Name, Column1__c, Column2__c, Column3__c, ParentId
                             FROM Account 
                             WHERE Id = '001b000000r6WE3' LIMIT 1];
CustomObject1__c rtList = new CustomObject1__c();

for(Account a : accountList){
	rtList.Name = a.Name;
	rtList.Column1__c = a.Column1__c;
	rtList.Column2__c = a.Column2__c;
	rtList.Column3__c = a.Column3__c;   
    //rtList.id = a.ParentId;
    rtList.Parent_Account__r.Id  = 'a008E000001Vzxq';  //LOOKUP
}

System.debug('AccountList  # '+accountList);
System.debug('rtList # '+rtList);

Update rtList;

The lookup field always gives me error when uploading.
Lookup field name is "Parent account" I tried using  "rtList.Parent_Account__r.Id" and also "Parent_Account__r.Parent_Account__c " but both of them gives error,

What can be solution, if want also want to update the lookup field through Apex code ?
  • January 25, 2016
  • Like
  • 0
Hi,

Is it possible to delete the schedule record in schedule object after scheuled. Please Share the sample code 

Adv Thnx
Siv
  • January 25, 2016
  • Like
  • 0