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
Pavan Kumar Desabhatla 8Pavan Kumar Desabhatla 8 

send email from trigger data missing

My question, I have the following objects that I’m trying to query on and get the results.

Request__c ,Request_item__c have a master detail relation and Catalog_item__c has a look up to the Request_item__c.

The query below  would run just fine if I pass a request ID value in developer console.

I have a VF page that would render the output with an id again.

However when placed this in a class constructor and give it the ID from trigger.new it would fail to retrieve any rows.

Any help in this regard is appreciated.

select Name,Request__r.Name,
             Request__r.Contact__c,
            Request__r.Lead__c,
             Catalog_item__r.Name,
             Request__r.Request_Details_rtf__c,
             quantity__c,
             Catalog_item__r.cost_center__c,
             Catalog_item__r.sizeoptions__c,
             request__r.Send_to_Company__c,
             request__r.Send_to_Contact__c,
             request__r.Request_Shipping_Street__c,
             request__r.Request_Shipping_City__c,
             request__r.Request_Shipping_State__c,
             request__r.Request_Shipping_Postal_Code__c,
             request__r.Request_Shipping_Country__c,
             request__r.Phone__c
             from request_item__c where Request__r.Id=:reqId1
Tony TannousTony Tannous
Dear,

if you are getting from trigger.new on before insert, the id is null because the record is not commited.

Good Luck.
Pavan Kumar Desabhatla 8Pavan Kumar Desabhatla 8
Thanks Tony. Im using this in an after trigger of Request object. The insert of request happens first and then request item and I wanted to send an email notification to request email field after a request is inserted with the request item summary.
Regards
Pavan
Tony TannousTony Tannous
Dear Pavan,

can you put all the class code that you are using + trigger.

Regards