function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Steve_WSteve_W 

Trying to retrieve a field value from a related record for validation

I am trying to get a value from a picklist field on an object that has a lookup field to the objet that my trigger is running on. The purpose of the trigger is to prevent updates or deletion to a Quote Line Item record based on certain picklist values on the Trial__c object.

 

trigger QuoteLineItemStopDelete on QuoteLineItem (before delete, before update) {

if(Trigger.isDelete){
  for(QuoteLineItem qli : Trigger.old){
      List <Trial__c> Tr = [Select id, Quote__c, Trial_Sub_Status__c from Trial where Quote__c = qli.QuoteId ];

 

I am getting an unexpected token error relating to the qli.QuoteId field, can anyone explain what i am doing wrong? I want to get the id of Trial__c record where the QuoteId from the QuoteLineItem equals the Quote__c id from the Trial__c object.

 

Thanks