• Darryl Singh
  • NEWBIE
  • 30 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 13
    Replies
Has anyone successfully connected to an Oracle database via External Data Sources?  We have all of the connection parameters (server, port, SID, Server Name, user name, password), and have successfully connected our Oracle database to other platforms.  But so far, all attempts to create an External Data Source in Salesforce have been spectacularly unsuccessful.  Is there a server-side service that needs to be running to make this work?  Also, can anyone provide me an example of the External Data Source URL for connecting to Oracle?  Or even better, a full screenshot of the external data source entries on a working Oracle connection.  Any help would be greatly appreciated.

Hi Everyone,

 

We have dashboards that are scheduled and emailed to certain users.  The "from" email address is not our "no reply" address.  On Dashboard emails, where does the sender's email address come from, and how can I change it to the "no reply" address?

 

Thanks in advance for your help!

Hi Everyone,

 

This very simple VF page is not executing the getSiteEqp method when rendering the pageBlockTable.  I have verified that the SiteEqp list is properly loaded with 70 elements in the controller extension constructor, but it doesn't matter.  The system.debug statement is the first statement in the getSiteEqp method, but it is not logged in the execution log, so I think the getSiteEqp method is not even being executed.  Can anyone tell me why?  Here's the VF code:

 

<!-- Copyright Ebara International Corporation 2012 -->
<!-- Written by Darryl Singh -->
<apex:page standardController="Case" extensions="Assign_Case_Equip" >
<apex:form >
<apex:pageBlock id="SCE">
<h1 style="font-size:30px"><center>Assign Case Equipment</center></h1><br/>
<center>
<apex:commandButton value="Assign Selected" action="{!AssignSelected}" />
<apex:commandButton value="Assign All" action="{!AssignAll}" />
<apex:commandButton value="Cancel" action="{!Cancel}" />
</center>
<apex:pageMessages />
<apex:pageBlockTable value="{!SiteEqp}" var="SE" id="SEqp" columns="5" width="100%" >
<apex:column headerValue="Sel" style="width:98%" >
<apex:inputField value="{!SE.Selected__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Serial#" >
<apex:outputText value="{!SE.Name}" style="width:98%" />
</apex:column>
<apex:column headerValue="Model Number" >
<apex:outputText value="{!SE.Model_Number__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Position Number" >
<apex:outputText value="{!SE.Position_Number__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Part Number" >
<apex:outputText value="{!SE.Part_Number__c}" style="width:98%" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

and the controller extension . . .

 

// Copyright Ebara International Corporation 2012
// Written by Darryl Singh
public with sharing class Assign_Case_Equip {

// Class field definitions:
public list<Case_Equipment__c> deleteCE {get; set;}
public list<Case_Equipment__c> insertCE {get; set;}
public list<Site_Equipment__c> SiteEqp {get; set;}
public map<Id, Case_Equipment__c> CaseEquipMap {get; set;}
public final Case c;

public Assign_Case_Equip(ApexPages.StandardController stdController) {
this.c = (Case)stdController.getRecord();
list<Site_Equipment__c> SiteEqp = new List<Site_Equipment__c>();
map<Id, Case_Equipment__c> CaseEquipMap = new map<Id, Case_Equipment__c>();
for (Site_Equipment__c SE : [ select Id, Selected__c, Name, Model_Number__c, Position_Number__c, Part_Number__c
from Site_Equipment__c a where Site__c in (select Site_Number__c from Case where Id = :c.Id)
order by Name ]) SiteEqp.add(SE);
for (Case_Equipment__c CE : [ select Id, Site_Equipment__r.Id from Case_Equipment__c a where Case__c = :c.ID ]) {
CaseEquipMap.put(ce.Site_Equipment__r.Id, ce);
}
}

public list<Site_Equipment__c> getSiteEqp() {
system.debug('SiteEqp Size = ' + string.ValueOf(SiteEqp.Size()));
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null) SiteEqp[x].Selected__c = False; else SiteEqp[x].Selected__c = True;
}
return SiteEqp;
}

public pageReference assignSelected() {
list<Case_Equipment__c> deleteCE = new list<Case_Equipment__c>();
list<Case_Equipment__c> insertCE = new list<Case_Equipment__c>();
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null & SiteEqp[x].Selected__c == True) {
insertCE.add(new Case_Equipment__c(Site_Equipment__c = SiteEqp[x].Id, Case__c = c.Id));
}
if(ce <> null & SiteEqp[x].Selected__c == False) deleteCE.add(ce);
}
if(deleteCE.size() > 0) database.delete(deleteCE,false);
if(insertCE.size() > 0) database.insert(insertCE,false);
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}

public pageReference assignAll() {
list<Case_Equipment__c> deleteCE = new list<Case_Equipment__c>();
list<Case_Equipment__c> insertCE = new list<Case_Equipment__c>();
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null) {
insertCE.add(new Case_Equipment__c(Site_Equipment__c = SiteEqp[x].Id, Case__c = c.Id));
}
}
if(insertCE.size() > 0) database.insert(insertCE,false);
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}

public pageReference Cancel() {
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}
}

Hi Everyone, we are setting up the Salesforce Mobile i-phone app for our field service engineers.  They need access to case e-mails on their i-phones.  However, the Case Email related list is not available to be added to the Mobile Configuration.  We tried creating a web link to the Salesforce email message list page, and that worked just fine, except it forces you to sign on and it takes you outside the Salesforce Mobile App.  Does anybody know how to show the case emails in the native mobile app?

Hi Everyone,

We can extend standard controllers and use these extensions in Visualforce pages, and that's great.  But we have batch Apex classes that need to be able to execute our own custom methods on some of our custom objects, so we would like to be able to extend custom object classes by adding our own custom methods without setting up dummy VF pages.

For example, we wish to add a custom method myMethod to the custom object MyCustomObject__c  so that we may use that method in a batch Apex class.  Something like:
 
MyCustomObject__c MyCO = new MyCustomObject__c();
MyCO.myMethod();

Anybody know how to do this?

Hi Everyone,

 

I have a fairly simple trigger on a custom junction object Case_FSE_Assignments between Case and Field_Service_Engineers.  When a new Case_FSE_Assignments is inserted, the user ID associated with the Field_Service_Engineer is automatically added as a follower of the case.  The trigger works just fine when a Case_FSE_Assignment row is inserted from the UI.  However, when inserting from a test class, the trigger doesn't get triggered.  The trigger doesn't fail, it simply doesn't trigger.  The test class fails with a query exception "List has no rows for assignment to SObject" at the EntitySubscription es assignment statement.  Help!

 

caseFSEFollow Trigger:

 

trigger caseFSEFollow on Case_FSE_Assignment__c (after insert) {


Map<Id, Field_Service_Engineer__c> allFSEUsers = new Map<ID, Field_Service_Engineer__c>(
[select Id, User__c from Field_Service_Engineer__c]);
for(Case_FSE_Assignment__c caseFSE : Trigger.new)
ChatterUtils.addFollower(allFSEUsers.get(caseFSE.Field_Service_Engineer__c).User__c, CaseFSE.Case__c);

}

 

CaseFSEFollowTest Class:

 

@isTest

private class CaseFSEFollowTest {

static testMethod void Test1() {

    User UserAMS = [select Id from User where profileId in 
                        (select Id from profile where name = 'Cryo AMS') limit 1];

    User UserFSE = [select Id from User where Id in 
                        (select User__c from Field_Service_Engineer__c) limit 1];

    Field_Service_Engineer__c FSE = [select Id from Field_Service_Engineer__c
                                        where User__c = :UserFSE.Id]; 

    Case testCase = [select Id from Case limit 1];

System.RunAs(UserAMS) {
        
        Case_FSE_Assignment__c CaseFSE = new Case_FSE_Assignment__c(
        Case__c = testCase.Id,
        Field_Service_Engineer__c = FSE.Id,
        Start_Date__c = system.today());
        insert CaseFSE;
        EntitySubscription es = [select subscriberID from EntitySubscription where parentID = :testCase.Id
                                            and subscriberID = :UserFSE.Id limit 1];

        System.assertEquals(es.subscriberID, UserFSE.Id);
        }
        
    }
}

Hi Everyone!
While building a list of SelectOptions of Users, all options default to unselected.  However, when the User matches the logged-on user, we need to set the SelectOption to selected.  How can this be done in the following code?


public List<SelectOption> getFSEOptions() {

  List<SelectOption> FSEoptions = new List<SelectOption>();

  for (Field_Service_Engineer__c f : [select id, user__r.name from Field_Service_Engineer__c

                                                             order by user__r.name]) {

    FSEoptions.add(new SelectOption(f.id,f.user__r.name));

  }
  return FSEoptions;

}

Hi Everyone!

 

Does anybody have a list of valid date format strings for the apex:outputText tag?  Here is sample code:

 

{<apex:outputtext value="{0,date,yyyy.MM.dd}"> <apex:param value="{!dr.Report_Date__c}" /> </apex:outputtext> }

 

This code works, but I would like to re-format Report_Date__c to "Tue Jan 17".  In general, I would like to know what are all the formatting strings available,not just for dates, but for everything else, too.  Can't find it in the Visualforce Developer's Guide.

Has anyone successfully connected to an Oracle database via External Data Sources?  We have all of the connection parameters (server, port, SID, Server Name, user name, password), and have successfully connected our Oracle database to other platforms.  But so far, all attempts to create an External Data Source in Salesforce have been spectacularly unsuccessful.  Is there a server-side service that needs to be running to make this work?  Also, can anyone provide me an example of the External Data Source URL for connecting to Oracle?  Or even better, a full screenshot of the external data source entries on a working Oracle connection.  Any help would be greatly appreciated.

Hi Everyone,

 

This very simple VF page is not executing the getSiteEqp method when rendering the pageBlockTable.  I have verified that the SiteEqp list is properly loaded with 70 elements in the controller extension constructor, but it doesn't matter.  The system.debug statement is the first statement in the getSiteEqp method, but it is not logged in the execution log, so I think the getSiteEqp method is not even being executed.  Can anyone tell me why?  Here's the VF code:

 

<!-- Copyright Ebara International Corporation 2012 -->
<!-- Written by Darryl Singh -->
<apex:page standardController="Case" extensions="Assign_Case_Equip" >
<apex:form >
<apex:pageBlock id="SCE">
<h1 style="font-size:30px"><center>Assign Case Equipment</center></h1><br/>
<center>
<apex:commandButton value="Assign Selected" action="{!AssignSelected}" />
<apex:commandButton value="Assign All" action="{!AssignAll}" />
<apex:commandButton value="Cancel" action="{!Cancel}" />
</center>
<apex:pageMessages />
<apex:pageBlockTable value="{!SiteEqp}" var="SE" id="SEqp" columns="5" width="100%" >
<apex:column headerValue="Sel" style="width:98%" >
<apex:inputField value="{!SE.Selected__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Serial#" >
<apex:outputText value="{!SE.Name}" style="width:98%" />
</apex:column>
<apex:column headerValue="Model Number" >
<apex:outputText value="{!SE.Model_Number__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Position Number" >
<apex:outputText value="{!SE.Position_Number__c}" style="width:98%" />
</apex:column>
<apex:column headerValue="Part Number" >
<apex:outputText value="{!SE.Part_Number__c}" style="width:98%" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

and the controller extension . . .

 

// Copyright Ebara International Corporation 2012
// Written by Darryl Singh
public with sharing class Assign_Case_Equip {

// Class field definitions:
public list<Case_Equipment__c> deleteCE {get; set;}
public list<Case_Equipment__c> insertCE {get; set;}
public list<Site_Equipment__c> SiteEqp {get; set;}
public map<Id, Case_Equipment__c> CaseEquipMap {get; set;}
public final Case c;

public Assign_Case_Equip(ApexPages.StandardController stdController) {
this.c = (Case)stdController.getRecord();
list<Site_Equipment__c> SiteEqp = new List<Site_Equipment__c>();
map<Id, Case_Equipment__c> CaseEquipMap = new map<Id, Case_Equipment__c>();
for (Site_Equipment__c SE : [ select Id, Selected__c, Name, Model_Number__c, Position_Number__c, Part_Number__c
from Site_Equipment__c a where Site__c in (select Site_Number__c from Case where Id = :c.Id)
order by Name ]) SiteEqp.add(SE);
for (Case_Equipment__c CE : [ select Id, Site_Equipment__r.Id from Case_Equipment__c a where Case__c = :c.ID ]) {
CaseEquipMap.put(ce.Site_Equipment__r.Id, ce);
}
}

public list<Site_Equipment__c> getSiteEqp() {
system.debug('SiteEqp Size = ' + string.ValueOf(SiteEqp.Size()));
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null) SiteEqp[x].Selected__c = False; else SiteEqp[x].Selected__c = True;
}
return SiteEqp;
}

public pageReference assignSelected() {
list<Case_Equipment__c> deleteCE = new list<Case_Equipment__c>();
list<Case_Equipment__c> insertCE = new list<Case_Equipment__c>();
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null & SiteEqp[x].Selected__c == True) {
insertCE.add(new Case_Equipment__c(Site_Equipment__c = SiteEqp[x].Id, Case__c = c.Id));
}
if(ce <> null & SiteEqp[x].Selected__c == False) deleteCE.add(ce);
}
if(deleteCE.size() > 0) database.delete(deleteCE,false);
if(insertCE.size() > 0) database.insert(insertCE,false);
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}

public pageReference assignAll() {
list<Case_Equipment__c> deleteCE = new list<Case_Equipment__c>();
list<Case_Equipment__c> insertCE = new list<Case_Equipment__c>();
for(Integer x = 0; x < SiteEqp.size(); x++) {
Case_Equipment__c ce = CaseEquipMap.get(SiteEqp[x].Id);
if(ce == null) {
insertCE.add(new Case_Equipment__c(Site_Equipment__c = SiteEqp[x].Id, Case__c = c.Id));
}
}
if(insertCE.size() > 0) database.insert(insertCE,false);
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}

public pageReference Cancel() {
PageReference casePage = new ApexPages.StandardController(c).view();
return casePage;
}
}

Hi Everyone, we are setting up the Salesforce Mobile i-phone app for our field service engineers.  They need access to case e-mails on their i-phones.  However, the Case Email related list is not available to be added to the Mobile Configuration.  We tried creating a web link to the Salesforce email message list page, and that worked just fine, except it forces you to sign on and it takes you outside the Salesforce Mobile App.  Does anybody know how to show the case emails in the native mobile app?

Hi Everyone,

 

When our sandbox is due to expire, myself and a group of my users get a notification from salesforce.com. This is very annoying for me because I do not want them to get this email. Where can I find the settings for this communication so that the email only goes to me and a few other administrators?

 

Thanks,

V

Hi Everyone,

We can extend standard controllers and use these extensions in Visualforce pages, and that's great.  But we have batch Apex classes that need to be able to execute our own custom methods on some of our custom objects, so we would like to be able to extend custom object classes by adding our own custom methods without setting up dummy VF pages.

For example, we wish to add a custom method myMethod to the custom object MyCustomObject__c  so that we may use that method in a batch Apex class.  Something like:
 
MyCustomObject__c MyCO = new MyCustomObject__c();
MyCO.myMethod();

Anybody know how to do this?

Hi Everyone,

 

I have a fairly simple trigger on a custom junction object Case_FSE_Assignments between Case and Field_Service_Engineers.  When a new Case_FSE_Assignments is inserted, the user ID associated with the Field_Service_Engineer is automatically added as a follower of the case.  The trigger works just fine when a Case_FSE_Assignment row is inserted from the UI.  However, when inserting from a test class, the trigger doesn't get triggered.  The trigger doesn't fail, it simply doesn't trigger.  The test class fails with a query exception "List has no rows for assignment to SObject" at the EntitySubscription es assignment statement.  Help!

 

caseFSEFollow Trigger:

 

trigger caseFSEFollow on Case_FSE_Assignment__c (after insert) {


Map<Id, Field_Service_Engineer__c> allFSEUsers = new Map<ID, Field_Service_Engineer__c>(
[select Id, User__c from Field_Service_Engineer__c]);
for(Case_FSE_Assignment__c caseFSE : Trigger.new)
ChatterUtils.addFollower(allFSEUsers.get(caseFSE.Field_Service_Engineer__c).User__c, CaseFSE.Case__c);

}

 

CaseFSEFollowTest Class:

 

@isTest

private class CaseFSEFollowTest {

static testMethod void Test1() {

    User UserAMS = [select Id from User where profileId in 
                        (select Id from profile where name = 'Cryo AMS') limit 1];

    User UserFSE = [select Id from User where Id in 
                        (select User__c from Field_Service_Engineer__c) limit 1];

    Field_Service_Engineer__c FSE = [select Id from Field_Service_Engineer__c
                                        where User__c = :UserFSE.Id]; 

    Case testCase = [select Id from Case limit 1];

System.RunAs(UserAMS) {
        
        Case_FSE_Assignment__c CaseFSE = new Case_FSE_Assignment__c(
        Case__c = testCase.Id,
        Field_Service_Engineer__c = FSE.Id,
        Start_Date__c = system.today());
        insert CaseFSE;
        EntitySubscription es = [select subscriberID from EntitySubscription where parentID = :testCase.Id
                                            and subscriberID = :UserFSE.Id limit 1];

        System.assertEquals(es.subscriberID, UserFSE.Id);
        }
        
    }
}

Hi Everyone!
While building a list of SelectOptions of Users, all options default to unselected.  However, when the User matches the logged-on user, we need to set the SelectOption to selected.  How can this be done in the following code?


public List<SelectOption> getFSEOptions() {

  List<SelectOption> FSEoptions = new List<SelectOption>();

  for (Field_Service_Engineer__c f : [select id, user__r.name from Field_Service_Engineer__c

                                                             order by user__r.name]) {

    FSEoptions.add(new SelectOption(f.id,f.user__r.name));

  }
  return FSEoptions;

}

For some reason, I have to catch the event when a user is leaving a visualforce page (closing the page, clicking on another link, ...) and execute a method of my controller.

The idea was to use something like window.onbeforeunload = function(){ Unload();return false} which should call the function "unload()". It's working pretty well when I replace the "Unload()" with a javascript alert, meaning the function is executed but the aim is to call the controller... So I have a simple actionfunction  <apex:actionFunction action="{!OnUnload}" name="Unload"/> which should call the method "OnUnload" in my controller. Unfortunately, it is not working... It's not the first time I'm using actionfunction called from Javascript but it looks like that the line "actionfunction" is already "unloaded" even on "onbeforeunload" :/

Has someone already been confronted to this problem ?? 

for example if i set some values to a record when you enter a visualforce page. can i work on these values if a user just closes the browser or the tab.

 

i have a visualforce page used to edit a record and when a user is editing the record i save some values to the record so no other users can use the visualforce page to edit the same record at the same time.  to " lock " the record for editing. there is a button users have to click to " unlock " the record before they close the page. can i automate the " unlock " button action if they close the browser or the tab?