• JustinMcc
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 4
    Replies

Hello,

 

I need to provide some functionality through Apex or Visualforce relating to a custom object, whereby:

 

  1. The user will get a list of jobs in Excel or csv format to produce a mailmerge from (based on certain criteria).
  2. Once the user has downloaded this list a field will be set on the custom object of the included rows to indicate what date the mail merge was sent.

Is this even possible through Salesforce and if so, how?

 

Thanks,

 

Justin

Hello,

 

My purpose is to use the Salesforce javascript functionality to put the record count for the related lists in any location I want on the page through js.

 

I am using sfdcPage.appendToOnloadQueue to have my javascript function called when the page is loaded.  I have created a javascript object with various methods defined using prototype, and attach one of the methods from this object to get called when the page has loaded.

 

I attach as so sfdcPage.appendToOnloadQueue(this.functionName);

 

The instance properties of the class contain which related lists to process.

 

My problem is that when I receive my call to the function I scheduled with appendToOnloadQueue my object has no instantiated variables.  Why is this?

 

If I use the DOM browser I can see my class with the correct variables hanging off of window, so why does this not work?

 

I have tried removing var from in front of my variable declaration; tried adding window. in front nothing works.  I am obviously declaring it outside a function.

 

I am only a beginner at javascript so can someone help me out?

 

I can see how to get round this but for my own info would like to understand the reason behind the issue.

 

Thanks,

 

Justin

Hello

 

so I have a visualforce page that displays a table of information that I use on a standard object's page layout.  There is a command button in this Visualforce page, my problem is that when I click the command button instead of the whole page being redirected it only redirects the iFramew when used as part of a Page layout.

 

Is there any way to get this button to redirect the whole page?

 

Thanks,

 

Justin

I've reported this as an issue to Salesforce support, but in our instance it is very easy for a user to bypass all validation rules against an Account.  I have not tried it with other objects yet.

 

  1. Go to an object that has a lookup to an Account (e.g. a Task would do it)
  2. Create a new object of this type.
  3. Click the lookup button to pick the related Account
  4. Click New, then simply fill in the name of the new account and hit save.

 Hey presto, you have saved the Account while bypassing all the validation rules.

Any help appreciated!

I sent this to the Salesforce support but I am getting nowhere with them:

In Java within Eclipse I can re-order the outline view: alphabetically, by access modifier, or type.

This does not seem to be the case with Force.com plugin, how can I change this or is it even possible?  It seems to show the elements only in the order they appear in the document.

 

If it is not possible is the source code for the Force.com plugin available?

Hello,

 

I am using the "Salesforce International Mapping using Google Maps" from the following link.

 

http://sites.force.com/appexchange/listingDetail?listingId=a0N300000016d25EAA

 

I have configured and installed this package correctly and using it is fine in Firefox.

 

 However, in Internet Explorer 6 the user receives a warning:

 

"This page contains both secure and nonsecure items.  Do you want to display the nonsecure items?"

 

This is very annoying from a user point of view, does anyone have a way round this?

 

I cannot solve this by changing Ie settings is there any other way?  I cannot either use Firefox for the general users.

 

Any help appreciated,

 

Justin

Hello,

 

My purpose is to use the Salesforce javascript functionality to put the record count for the related lists in any location I want on the page through js.

 

I am using sfdcPage.appendToOnloadQueue to have my javascript function called when the page is loaded.  I have created a javascript object with various methods defined using prototype, and attach one of the methods from this object to get called when the page has loaded.

 

I attach as so sfdcPage.appendToOnloadQueue(this.functionName);

 

The instance properties of the class contain which related lists to process.

 

My problem is that when I receive my call to the function I scheduled with appendToOnloadQueue my object has no instantiated variables.  Why is this?

 

If I use the DOM browser I can see my class with the correct variables hanging off of window, so why does this not work?

 

I have tried removing var from in front of my variable declaration; tried adding window. in front nothing works.  I am obviously declaring it outside a function.

 

I am only a beginner at javascript so can someone help me out?

 

I can see how to get round this but for my own info would like to understand the reason behind the issue.

 

Thanks,

 

Justin

I've reported this as an issue to Salesforce support, but in our instance it is very easy for a user to bypass all validation rules against an Account.  I have not tried it with other objects yet.

 

  1. Go to an object that has a lookup to an Account (e.g. a Task would do it)
  2. Create a new object of this type.
  3. Click the lookup button to pick the related Account
  4. Click New, then simply fill in the name of the new account and hit save.

 Hey presto, you have saved the Account while bypassing all the validation rules.

When developing a Visualforce page for overiding view page for any object, one problem that creeps up is to display the History details of a record. The standard related list Component doesn't works for History.

 

With the help of some code from Community ( I now can't find the link to it :( ), I wrote my own code  then to display the history of an object. It mimics the standard list as far as possible.  

 

Heres the code. It is for the Case object but it can be used for any other object.

 1.Component Code

 

<apex:component controller="CaseHistoriesComponentController">
<!-- Attribute Definition -->
<apex:attribute name="CaseId" description="Salesforce Id of the Case whose Case History needs to be rendered" type="Id" required="true" assignTo="{!caseId}" />

<!-- Case History Related List -->
<apex:pageBlock title="Case History">
<apex:pageBlockTable value="{!histories}" var="History" >
<apex:column headerValue="Date" value="{!History.thedate}"/>
<apex:column headerValue="User"> <apex:outputLink value="/{!History.userId}"> {!History.who} </apex:outputLink></apex:column>
<apex:column headerValue="Action"><apex:outputText escape="false" value="{!History.action}"/></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:component>

 

 

 

 

2. Apex Code

 

public class CaseHistoriesComponentController {

public Id caseId {get; set;}
public cHistories[] histories;

// Variables
public Static final Map<String, Schema.SObjectField> CaseFieldmap = Schema.SObjectType.Case.fields.getMap();
public Static final List<Schema.PicklistEntry> fieldPicklistValues = CaseHistory.Field.getDescribe().getPicklistValues();

public List<cHistories> getHistories()
{
list<cHistories> histories = new list<cHistories>();
String prevDate = '';
for(CaseHistory cHistory : [Select CreatedDate, CreatedBy.Name, CreatedBy.Id, Field, NewValue, OldValue from CaseHistory where CaseId = :caseId order by CreatedDate desc])
{
if((cHistory.newValue == null && cHistory.oldValue == null)
|| (cHistory.newValue != null && !(string.valueOf(cHistory.newValue).startsWith('005') || string.valueOf(cHistory.newValue).startsWith('00G')))
|| (cHistory.oldValue != null && !(string.valueOf(cHistory.oldValue).startsWith('005') || string.valueOf(cHistory.oldValue).startsWith('00G'))))
{
cHistories tempHistory = new cHistories();
// Set the Date and who performed the action
if(String.valueOf(cHistory.CreatedDate) != prevDate)
{
tempHistory.theDate = String.valueOf(cHistory.CreatedDate);
tempHistory.who = cHistory.CreatedBy.Name;
tempHistory.userId = cHistory.CreatedBy.Id;
}
else
{
tempHistory.theDate = '';
tempHistory.who = '';
tempHistory.userId = cHistory.CreatedBy.Id;
}
prevDate = String.valueOf(cHistory.CreatedDate);

// Get the field label
String fieldLabel = CaseHistoriesComponentController.returnFieldLabel(String.valueOf(cHistory.Field));

// Set the Action value
if (String.valueOf(cHistory.Field) == 'created') { // on Creation
tempHistory.action = 'Created.';
}
else if(cHistory.OldValue != null && cHistory.NewValue == null){ // when deleting a value from a field
// Format the Date and if there's an error, catch it and re
try {
tempHistory.action = 'Deleted ' + Date.valueOf(cHistory.OldValue).format() + ' in <b>' + fieldLabel + '</b>.';
} catch (Exception e){
tempHistory.action = 'Deleted ' + String.valueOf(cHistory.OldValue) + ' in <b>' + fieldLabel + '</b>.';
}
}
else{ // all other scenarios
String fromText = '';
if (cHistory.OldValue != null) {
try {
fromText = ' from ' + Date.valueOf(cHistory.OldValue).format();
} catch (Exception e) {
fromText = ' from ' + String.valueOf(cHistory.OldValue);
}
}

String toText = '';
if (cHistory.OldValue != null) {
try {
toText = Date.valueOf(cHistory.NewValue).format();
} catch (Exception e) {
toText = String.valueOf(cHistory.NewValue);
}
}
if(toText != '')
tempHistory.action = 'Changed <b>' + fieldLabel + '</b>' + fromText + ' to <b>' + toText + '</b>.';
else
tempHistory.action = 'Changed <b>' + fieldLabel;
}

// Add to the list
histories.add(tempHistory);
}
}

return histories;
}

// Function to return Field Label of a Case field given a Field API name
public Static String returnFieldLabel(String fieldName)
{
if(CaseHistoriesComponentController.CaseFieldmap.containsKey(fieldName))
return CaseHistoriesComponentController.CaseFieldmap.get(fieldName).getDescribe().getLabel();
else
{
for(Schema.PicklistEntry pickList : fieldPicklistValues)
{
if(pickList.getValue() == fieldName)
{
if(pickList.getLabel() != null)
return pickList.getLabel();
else
return pickList.getValue();
}
}
}
return '';
}
// Inner Class to store the detail of the case histories
public class cHistories {

public String theDate {get; set;}
public String who {get; set;}
public Id userId {get; set;}
public String action {get; set;}
}
}

  Let me know your views on the code or if you have any questions

 

Hello,

 

I am using the "Salesforce International Mapping using Google Maps" from the following link.

 

http://sites.force.com/appexchange/listingDetail?listingId=a0N300000016d25EAA

 

I have configured and installed this package correctly and using it is fine in Firefox.

 

 However, in Internet Explorer 6 the user receives a warning:

 

"This page contains both secure and nonsecure items.  Do you want to display the nonsecure items?"

 

This is very annoying from a user point of view, does anyone have a way round this?

 

I cannot solve this by changing Ie settings is there any other way?  I cannot either use Firefox for the general users.

 

Any help appreciated,

 

Justin