• pmb
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Does anyone know the syntax to access a lookup data type in a trigger. I am trying to grab a Contact Id from a trigger that is created on a Contract insert.  Here is is the code:

trigger emailConfirm on Contract (after insert) {
Contract[] newContract = Trigger.new;
Id templateId= '00X401200012BvE';
Id targetId = newContract[0].CustomerSigned
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setSubject('contract confirm');
mail.setTemplateId(templateId);
mail.setTargetObjectId(targetId);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}

This does not work. I can grab any fields that are not of data type lookup though. For example newContract[0].ContractNumber works just fine.

I also tried the following with no success:

newContract[0].CustomerSigned.Id
newContract[0].CustomerSigned[0].Id


Any help is greatly appreciated.

PB
  • October 16, 2008
  • Like
  • 0
I'm trying to create a visual force page that has only 1 line for getting the contact name.
<apex:page sidebar="false" showHeader="false" cache="false" standardStylesheets="false" docType="html-5.0" standardController="Contact" > 
<apex:pageBlock >
 <h1>Hello {!Contact.name}</h1> 
</apex:pageBlock>
</apex:page>

This page is in a SF.com site that i'v created.
the problem is that i'm getting an unauthorized message that public user cant access for this page. It happens because i'm trying to access the contact object. I believe its admin configuration.
Can someone help me with that by writing the steps for getting public access for this page and the contact object?
Eg:
Go to ->
Do that
and so ...
Note! please don't send any URL referrals for this, Thanx :)
Anyone know why I have suddenly lost the ability to include a VF page in one of my sections on a custom object page layout?  It used to be there as recently as a few weeks ago and now I only see Scontrols, related lists, custom links, and fields for my object, no more "Pages".

Please advise...

Thanks