• Andres Monge 9
  • NEWBIE
  • 0 Points
  • Member since 2014
  • QA ASSURANCE
  • CAN CAPITAL

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I have to elements united with a lookup relation: bMerchants and Products.
If you insert one Merchant two Products will be create, I write a trigger but it throw me this error:

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger InsertProducts caused an unexpected exception, contact your administrator: InsertProducts: execution of AfterInsert caused by: System.StringException: Invalid id: 24: Trigger.InsertProducts: line 29, column 1


This is the code of the Trigger:
 
trigger InsertProducts on Merchant__c (after insert) {

  List<Product__c> products= new List<Product__c>();

  for(Merchant__c m: Trigger.new)
      {
        Product__c pproducts = new Product__c();
        pproducts.Merchant__c = String.valueOf(m.Name);
        products.add(pproducts);
      }
    
  insert products;

 }

I made everything I don't know what to do, please if any body could help me I would appreciate.

Thanks and Regards.
Hello,

I had this problem, I want to open the apex code of the custom object but I couldn't I tried with this link below

https://help.salesforce.com/HTViewHelpDoc?id=accessing_layout_custom.htm&language=en_US

But I don't see any option, I don't know if I need other rights to Edit the Layout.

User-added image
 
If anyone can help me I would appreciate.

Thanks and Regards.

Hello,

I had this problem, I want to open the apex code of the custom object but I couldn't I tried with this link below

https://help.salesforce.com/HTViewHelpDoc?id=accessing_layout_custom.htm&language=en_US

But I don't see any option, I don't know if I need other rights to Edit the Layout.

User-added image
 
If anyone can help me I would appreciate.

Thanks and Regards.