• Jan Julian
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 0
    Replies

I have  the following relationship query instantiated to a Map<>:

 

Map<Id, Account> accountsMap = new Map<Id, Account>([
select a.id, a.Name, a.Active_Support_Contract__c,
(select s.id, s.status__c, s.status, s.name, s.accountId, s.recordType.name from a.ServiceContracts s)
from Account a where a.id in :accountIds]);
.
.
.
Account account = accountsMap.get(aid);

if (account.ServiceContracts != null) {...} // "Attempt to de-reference a null object"
if (account.ServiceContracts.size() != 0 {...} // "Attempt to de-reference a null object"
for (ServiceContract sc : account.ServiceContracts) {} // "Attempt to de-reference a null object"

 

I've tried several ways of accessing the Account's ServiceContracts. Everything works fine in my sandbox but when I'm ready to deploy to production, I get the errors above.

 

The log files are not helpful either. 

 

 

From a visualforce page, I need to retrieve our organization's salesforce instance's URL, and not the visual force URL.

 

For example I need https://cs1.salesforce.com instead of https://c.cs1.visual.force.com

 

Here's what I've tried so far and the outcome I got:

 

  1. Accessed the Site global variable from the VF Page .

    <apex:outputText value="{!$Site.Domain}" /> returns null

    Sidenote: Everything in $Site.xxx seems to return null.

  2. From the Apex controller

     public String getSfInstance()
     {
     return ApexPages.currentPage().getHeaders().get('Host');
     }

    public String getSfInstance() { return URL.getSalesforceBaseUrl().toExternalForm(); }

     

    returns c.cs1.visual.force.com and https://c.cs1.visual.force.com, respectively.

     

    Question: How do I retrieve the right instance: https://cs1.salesforce.com?


Hi,

 

I was wondering if there's a way to forcefully send an email of scheduled reports and dashboards, instead of waiting for the scheduled refresh time?

 

Every now and then I need to have an email version of the report/dashboard immediately so I can forward it to colleagues who have no Salesforce access.

 

Cheers,

Jan 

I'm currently working on a standard controller extension for ServiceContract which is invoked via a custom button on the detail page.

 

The custom button takes the user to a visualforce page. As I'm the developer however, Salesforce, by default, will automatically show the page editor for the corresponding visualforce page and controller.

 

As I'm coding/testing out the page and its controller, a couple of annoyances happen which I can't find workarounds for.

 

1. The visualforce page has a cancel button (which uses the standard cancel action) which upon clicking DOES take the user to the ServiceContract detail page, but the URL remains in the https://Salesforce_instance/apex/myNewPageName, as opposed to https://Salesforce_instance/servicecontractId.

 

How should I implement the buttons so that the URL will correctly change?

 

Additionally, the page editor remains after I'm redirected to the detail page (which might be related to the non-changing URL). This, I think, lead to #2

 

2. Everytime I click the custom button on the ServiceContract detail page - invoking the above controller, another page editor is rendered. If i keep doing that eventually I'd get something like this:

 

 

 

 Are these bugs, or am I doing something wrong?


I was wondering if it's possible to display messages/notifications to let the user know that a trigger has run.

 

There's concerns over a trigger automating too much so it would be nice to somehow let the user know that a trigger has made changes.