• hunter
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
I'm receiving the error message below from a trigger.  A picklist field in the Sale Object updates with the value "Sold" which, when saved, updates a picklist field in a linked record in the Listing Object with the same value.  At least it did on my previous record.  Now, it does not work.  Does anyone have an idea why this would stop working?

The User ID 005E0000000HkLL belongs to me...the administrator.
The Company ID 00DE0000000HsKC is my company and correct.

Error Message:
Apex script unhandled trigger exception by user/organization: 005E0000000HkLL/00DE0000000HsKC

updateListingStatusfromSale: execution of AfterUpdate

caused by: System.DmlException: Update failed. First exception on row 0 with id a070L000013cCjNQAU; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, ERROR:  You can't alter this listing.  Please contact your system administrator.: []

Trigger.updateListingStatusfromSale: line 60, column 1


My Trigger:
trigger updateListingStatusfromSale on Transactions__c (after insert, after update) { Transactions__c[] objects = new Transactions__c[]{}; List<ID> TransIds = New List<ID>(); for(Transactions__c a : Trigger.new) { if(a.Status__c == 'Canceled' ) { TransIds.add(a.Linked_Listing__c); List<Listings__c> TransList = [SELECT id, Listing_Status__c FROM Listings__c WHERE id in :TransIds]; for(integer i = 0 ; i < TransList.size(); i++) { TransList[i].Listing_Status__c = 'Active'; } update TransList; } else if(a.Status__c == 'Contingent -Other' ) { TransIds.add(a.Linked_Listing__c); List<Listings__c> TransList = [SELECT id, Listing_Status__c FROM Listings__c WHERE id in :TransIds]; for(integer i = 0 ; i < TransList.size(); i++) { TransList[i].Listing_Status__c = 'Contingent -Other'; } update TransList; } else if(a.Status__c == 'Contingent -Upon Sale' ) { TransIds.add(a.Linked_Listing__c); List<Listings__c> TransList = [SELECT id, Listing_Status__c FROM Listings__c WHERE id in :TransIds]; for(integer i = 0 ; i < TransList.size(); i++) { TransList[i].Listing_Status__c = 'Contingent -Upon Sale'; } update TransList; } else if(a.Status__c == 'Pending' ) { TransIds.add(a.Linked_Listing__c); List<Listings__c> TransList = [SELECT id, Listing_Status__c FROM Listings__c WHERE id in :TransIds]; for(integer i = 0 ; i < TransList.size(); i++) { TransList[i].Listing_Status__c = 'Pending'; } update TransList; } else if(a.Status__c == 'Sold' ) { TransIds.add(a.Linked_Listing__c); List<Listings__c> TransList = [SELECT id, Listing_Status__c FROM Listings__c WHERE id in :TransIds]; for(integer i = 0 ; i < TransList.size(); i++) { TransList[i].Listing_Status__c = 'Sold'; } update TransList; } } }
Line 60 is "update TransList;"

This used to work on my last launch of the trigger.   Not sure why it doesn't work now.
  • October 12, 2017
  • Like
  • 0

I simply want to update a date field in a CustomObj__c from Standard Contract Obj upon Save of the Standard Contract Obj

 

Example:

When the "PTO Date" is updated & Saved on the Contract obj - that updated Date should auto-fill into the Service_Start_Date field on the

Service Contract custom_Obj__c

 

This should be a simple trigger however, I'm a bit snagged on it - Help Please :) -  Thx in Advance !!

 

 

 

 

Good day. Hye I'm new in this area and i'm about to create a VF page that will create 4 columns in Page Layout.

 

I want to know what is the language being used in creating a Visualforce Page. Does it using Java, Javascript, HTML or etc etc? Can we randomly choose what sort of language to be used in the system? Or does we able to select which language that most preferable? Or does it only stick to only one language? And I would like if you could re-confirm me the way of doing it. 1) Need to embed the code in the Apex Classes 2) Go to the respective Object and select the Trigger section and embed another code to call the code in the Apex Classes * Am i in the right track?

 

Can someone please guide me on this..

  • October 25, 2010
  • Like
  • 0