Skip to main content
replaced http://salesforce.stackexchange.com/ with https://salesforce.stackexchange.com/
Source Link

I have a custom object: License, this has a Lookup for the standard Account (meaning: an account can have many licenses) and they are shwon on the account page with a related list.

On my account page, there is a custom field called: Support_end_date

I want that if anyone is accessing the License page, a pop up will show if the account is not under support. (first part is working, as for SF question: How to compare 2 dates in JavaScript on a Visualforce page?How to compare 2 dates in JavaScript on a Visualforce page?)

My current code than is:

<apex:page StandardController="OptiTex_License__c">
 <script>
window.document.onload = new function(e)
{
  var tempdate = new Date("{!OptiTex_License__c.Account.Support_end_date__c}");

  if(tempdate < Date.now() || tempdate ){
    alert("--- ATTENTION --- \nCustomer is NOT under Support\nor no support end date is given.");
  }
}
</script>

</apex:page>

*Similar code, only that the StandardController is now the customer: License object.

I tried to access the Account field through: OptiTex_License__c.Account.Support_end_date__c - but that gave me a compilation error.

So I ask: How and where in my code to I query (SOQL maybe?) or simply have access to the values from my parent.

I have a custom object: License, this has a Lookup for the standard Account (meaning: an account can have many licenses) and they are shwon on the account page with a related list.

On my account page, there is a custom field called: Support_end_date

I want that if anyone is accessing the License page, a pop up will show if the account is not under support. (first part is working, as for SF question: How to compare 2 dates in JavaScript on a Visualforce page?)

My current code than is:

<apex:page StandardController="OptiTex_License__c">
 <script>
window.document.onload = new function(e)
{
  var tempdate = new Date("{!OptiTex_License__c.Account.Support_end_date__c}");

  if(tempdate < Date.now() || tempdate ){
    alert("--- ATTENTION --- \nCustomer is NOT under Support\nor no support end date is given.");
  }
}
</script>

</apex:page>

*Similar code, only that the StandardController is now the customer: License object.

I tried to access the Account field through: OptiTex_License__c.Account.Support_end_date__c - but that gave me a compilation error.

So I ask: How and where in my code to I query (SOQL maybe?) or simply have access to the values from my parent.

I have a custom object: License, this has a Lookup for the standard Account (meaning: an account can have many licenses) and they are shwon on the account page with a related list.

On my account page, there is a custom field called: Support_end_date

I want that if anyone is accessing the License page, a pop up will show if the account is not under support. (first part is working, as for SF question: How to compare 2 dates in JavaScript on a Visualforce page?)

My current code than is:

<apex:page StandardController="OptiTex_License__c">
 <script>
window.document.onload = new function(e)
{
  var tempdate = new Date("{!OptiTex_License__c.Account.Support_end_date__c}");

  if(tempdate < Date.now() || tempdate ){
    alert("--- ATTENTION --- \nCustomer is NOT under Support\nor no support end date is given.");
  }
}
</script>

</apex:page>

*Similar code, only that the StandardController is now the customer: License object.

I tried to access the Account field through: OptiTex_License__c.Account.Support_end_date__c - but that gave me a compilation error.

So I ask: How and where in my code to I query (SOQL maybe?) or simply have access to the values from my parent.

Correct terminology in the title and make it a bit more specific
Link

How to query forinclude data from custom Lookup Relationships in Visualpagea Visualforce page

Source Link
Saariko
  • 5.7k
  • 14
  • 81
  • 169

How to query for data in Visualpage

I have a custom object: License, this has a Lookup for the standard Account (meaning: an account can have many licenses) and they are shwon on the account page with a related list.

On my account page, there is a custom field called: Support_end_date

I want that if anyone is accessing the License page, a pop up will show if the account is not under support. (first part is working, as for SF question: How to compare 2 dates in JavaScript on a Visualforce page?)

My current code than is:

<apex:page StandardController="OptiTex_License__c">
 <script>
window.document.onload = new function(e)
{
  var tempdate = new Date("{!OptiTex_License__c.Account.Support_end_date__c}");

  if(tempdate < Date.now() || tempdate ){
    alert("--- ATTENTION --- \nCustomer is NOT under Support\nor no support end date is given.");
  }
}
</script>

</apex:page>

*Similar code, only that the StandardController is now the customer: License object.

I tried to access the Account field through: OptiTex_License__c.Account.Support_end_date__c - but that gave me a compilation error.

So I ask: How and where in my code to I query (SOQL maybe?) or simply have access to the values from my parent.