• dshpa
  • NEWBIE
  • 0 Points
  • Member since 2009

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

I want to save a VF page as MS Word file. So I've added the attribute

 

contentType="application/vnd.ms-word#Test.doc"

 

to the apex:page tag. This works but some characters in the final file are replaced with another combinations. For example the hyphen is replaced with —, apostrophe - with ’ and so on. The problem is obviously related to character encoding. It can be solved with modified attribute value

 

contentType="application/vnd.ms-word; charset=Windows-1252"

 

That's fine, all text is shown normally. But I need also the default file name in this attribute like this

 

contentType="application/vnd.ms-word#Test.doc; charset=Windows-1252"

 

And this value gives the incorrect encoding again as if I remove charset value. So I can get either the right encoding or the default file name. But I need them simultaneously! I've dug up all the Internet but without any success. Also I tried to add META tag to the page and to modify HTTP headers directly but it didn't work. Can anybody help me with it?

  • June 01, 2011
  • Like
  • 0

Hi all!

 

I have a strange and annoying problem with my Force.com site. There is a start page where a user can press a button and pass to another page. From time to time after pressing the button the page refreshes about 1 or 2 minutes and then Authorization Required Page appears. There is no errors in the method for this button because all code is enclosed in try/catch block, so user must see a message if an exceptions is thrown. Of course I try this in debug mode. The problem is this issue is unpredictable and takes place not very often so it's hard to reproduce it. But one time I managed to do this and didn't see any additional messages in Authorization Required Page. May be someone has an idea how to find out what's wrong? I don't know what to do if I don't have any error messages to clarify the situation. Any help will be appreciated.

  • May 26, 2011
  • Like
  • 0

I work with Person Accounts in my code. To get the Contact of such Account I use the following:

 

 

Contact personAccountContact = anyPersonAccount.Contacts[0];

 

 

That works. But I encountered quite unexpected problem when testing my code. I create a test Person Account like this:

 

 

Account account = new Account();
account.FirstName = 'First Name';
account.LastName = 'Last Name';
account.RecordTypeId = [
	select Id
	from RecordType
	where (Name='Person Account')
	and (SobjectType='Account')
].Id;
insert account;

 

But when I try to get the Contact of the created Account as described above I fails. The number of Contacts for created Account is 0. I debugged this code and found that RecordTypeId field is assigned with the proper value, but IsPersonAccount field is false and PersonContactId field is null. Where am I wrong?

 

  • November 12, 2010
  • Like
  • 0

I try to create my first Force.com site. It works perfectly in sandbox, but in production I can't access any SFDC object. In my case I need aceess to Contacts (only to read, no changes). I check Field-Level Security, set Read and Create permissions for Contact object in Public Access Settings and created a simplest default VF page (below).

 

 

<apex:page standardcontroller="Contact" recordSetVar="Contacts" >
	<apex:form >
		<apex:pageBlock title="Contacts">
	      	<apex:pageBlockTable value="{!Contacts}" var="Contact">
	            <apex:column headerValue="Name">
	               	{!Contact.Name}
	           	</apex:column> 
	      	</apex:pageBlockTable>
	   	</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

When I open my site (this page), the list on the page is empty. When I set up Tab Settings for Contacts in "Default On" and try to click tab "Contacts" I get "Authorization Required" page. In Preview as Admin mode there is an additional info: "Page not allowed fo profile:/it/003/o". How can it help me? The similar situation is for any other SFDC object. I can't access nothing! I searched Community but didn't found any working solution. I understand, that the problem is in absent permissions for something, but don't know what to do else.

  • October 08, 2010
  • Like
  • 0

Hi all,

 

I want to create time-dependent workflow rule to send email notification if a Lead is unread by owner within 2 days. I found that Lead object has field IsUnreadByOwner but it isn't accessible through formula editor. That's why I created custom field UnreadByOwner_Copy and trigger setting its value to IsUnreadByOwner. This value is used as criteria in workflow rule.

However, when Lead Owner is changed, trigger sets UnreadByOwner_Copy=true, and workflow rule evaluates, it takes the previous value of UnreadByOwner_Copy=false and does not run.

 

Does anybody know workaround for this issue?

Thanks!

  • April 01, 2010
  • Like
  • 0
We need to customize Approval Request page ("Approve/Reject" screen of Approval Process). We'd like to color a field in dependence of its value. For example, if an approval request on Opportunity with amount more than 1000 then it should be red, otherwise it should be green.

Is this possible?

Thanks in advance.

  • March 06, 2009
  • Like
  • 0

Hi all!

 

I have a strange and annoying problem with my Force.com site. There is a start page where a user can press a button and pass to another page. From time to time after pressing the button the page refreshes about 1 or 2 minutes and then Authorization Required Page appears. There is no errors in the method for this button because all code is enclosed in try/catch block, so user must see a message if an exceptions is thrown. Of course I try this in debug mode. The problem is this issue is unpredictable and takes place not very often so it's hard to reproduce it. But one time I managed to do this and didn't see any additional messages in Authorization Required Page. May be someone has an idea how to find out what's wrong? I don't know what to do if I don't have any error messages to clarify the situation. Any help will be appreciated.

  • May 26, 2011
  • Like
  • 0

I work with Person Accounts in my code. To get the Contact of such Account I use the following:

 

 

Contact personAccountContact = anyPersonAccount.Contacts[0];

 

 

That works. But I encountered quite unexpected problem when testing my code. I create a test Person Account like this:

 

 

Account account = new Account();
account.FirstName = 'First Name';
account.LastName = 'Last Name';
account.RecordTypeId = [
	select Id
	from RecordType
	where (Name='Person Account')
	and (SobjectType='Account')
].Id;
insert account;

 

But when I try to get the Contact of the created Account as described above I fails. The number of Contacts for created Account is 0. I debugged this code and found that RecordTypeId field is assigned with the proper value, but IsPersonAccount field is false and PersonContactId field is null. Where am I wrong?

 

  • November 12, 2010
  • Like
  • 0

I try to create my first Force.com site. It works perfectly in sandbox, but in production I can't access any SFDC object. In my case I need aceess to Contacts (only to read, no changes). I check Field-Level Security, set Read and Create permissions for Contact object in Public Access Settings and created a simplest default VF page (below).

 

 

<apex:page standardcontroller="Contact" recordSetVar="Contacts" >
	<apex:form >
		<apex:pageBlock title="Contacts">
	      	<apex:pageBlockTable value="{!Contacts}" var="Contact">
	            <apex:column headerValue="Name">
	               	{!Contact.Name}
	           	</apex:column> 
	      	</apex:pageBlockTable>
	   	</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

When I open my site (this page), the list on the page is empty. When I set up Tab Settings for Contacts in "Default On" and try to click tab "Contacts" I get "Authorization Required" page. In Preview as Admin mode there is an additional info: "Page not allowed fo profile:/it/003/o". How can it help me? The similar situation is for any other SFDC object. I can't access nothing! I searched Community but didn't found any working solution. I understand, that the problem is in absent permissions for something, but don't know what to do else.

  • October 08, 2010
  • Like
  • 0

I am getting the following error on a custom Visualforce page:

Type is not visible: test

 

Vforce Page:

<apex:page controller="EditCases" tabstyle="Case"> <apex:sectionHeader title="Edit Cases" subtitle="Bug Meeting Mass Update" /> <apex:form > <apex:pageBlock mode="edit" title="Mass Update Cases"> <p><apex:outputText value="{!headerMessage}" /></p> <h3>Report Criteria: </h3> <p></p> <table style="width: 100%"> <tr> <td rowspan="3" width="50px" height="50px"><img src="https://ssl.salesforce.com/servlet/servlet.ImageServer?id=01500000000crMo&oid=00D00000000hZTB&lastMod=1235399976000"></img></td> <td>Sub Status contains <i>bug</i> </td> </tr> <tr> <td>ETA is <i>NULL</i></td> </tr> <tr> <td>Status is <i>Pending</i> or <i>Suspended</i></td> </tr> </table> <br /> <apex:pageblockSection id="Cases" columns="1" title="Bug Meeting Cases" rendered="{!canEdit}"> <apex:pageblocktable align="center" value="{!Cases}" var="Case" title="Cases" width="100%"> <apex:column headerValue="Case Number" width="10%"><apex:outputLink value="/{!Case.ID}">{!Case.CaseNumber}</apex:outputlink></apex:column> <apex:column headerValue="Account" width="15%"><apex:outputLink value="/{!Case.Account.ID}">{!Case.Account.Name}</apex:outputlink></apex:column> <apex:column headerValue="Bug ID" width="50%"><apex:inputField value="{!Case.Bug_ID__c}" /></apex:column> <apex:column headerValue="Subject" width="50%"><apex:inputField value="{!Case.Subject}"/></apex:column> <apex:column headerValue="Bug Description" width="50%"><apex:inputField value="{!Case.Bug_Description__c}" /></apex:column> <apex:column headerValue="Summary" width="50%"><apex:inputField value="{!Case.Bug_Meeting_Summary__c}" /></apex:column> <apex:column headerValue="ETA" width="50%"><apex:inputField value="{!Case.ETA_version__c}" /></apex:column> <apex:column headerValue="Assigned To" width="50%"><apex:inputField value="{!Case.Bug_Assigned__c}" /></apex:column> <apex:column headerValue="Status" width="15%"><apex:inputField value="{!Case.Status}"/></apex:column> <apex:column headerValue="Sub Status" width="15%"><apex:inputField value="{!Case.Sub_Condition__c}"/></apex:column> </apex:pageblockTable> </apex:pageblockSection> <p/> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save Cases" rendered="{!canEdit}" /> <apex:commandButton action="{!cancel}" value="Cancel" /> </apex:pageblockButtons> </apex:pageBlock> </apex:form> </apex:page>

 

 

Apex Class+Test:

public class EditCases { List<Case> cases; String headerMessage; Boolean canEdit = true; public EditCases() { cases = getcases();+ headerMessage = getHeaderMessage(); canEdit = getCanEdit(); } public List<Case> getCases() { if (cases == null) { cases = [ select Id, CaseNumber, Priority, Status, Subject, Case.Account.ID,Case.Account.Name,Case.Bug_ID__c,Case.Bug_Description__c,Case.Bug_Meeting_Summary__c,Case.ETA_version__c, CreatedDate,Sub_Condition__c, Bug_Assigned__c from Case where sub_condition__C like '%Bug%' and ETA_version__C = null and (Status = 'Pending' or Status = 'Suspended') order by CaseNumber]; return cases; } else { return cases; } } public String getHeaderMessage() { String message = ''; if (cases.size() == 0) { message = 'There are no cases to edit.'; canEdit = false; } else { canEdit = true; } return message; } public Boolean getCanEdit() { return canEdit; } // Action that is executed if Save button is clicked public PageReference save() { // Return to Cases tab page after editing PageReference returnPage = new PageReference('/500/o'); // Save all changes update cases; return returnPage; } // Action that is executed if Cancel button is clicked. public PageReference cancel() { // Return to Cases tab page after editing PageReference returnPage = new PageReference('/500/o'); return returnPage; } public static testMethod void tesEditCases() { // Create the necessary records to test automatic order creation // Create a case // This assumes that the pick list values used exist for // - Priority (High) // - Status (New) // - Origin (Phone) Case testCase = new Case( Priority = 'High', Subject = 'Test Subject', Status = 'Pending', LPTicket__c = 'LTK12345X', sub_condition__C = 'Bug Meeting', // ETA_version__C = '8.4', // Bug_ID__C = '1234', Origin = 'Phone'); insert testCase; //************************** // Test EditCases controller //************************** PageReference pageRef = Page.EditCases; Test.setCurrentPage(pageRef); // Create an instance of the controller EditCases editCasesController = new EditCases(); // Get the list of cases from the controller List<Case> casesToEdit = editCasesController.getCases(); // Verify that there is at least one case to edit system.assertEquals(casesToEdit.size() > 0, true); // Retrieve the header message String editCasesMessage = editCasesController.getHeaderMessage(); // Verify that the header message is blank system.assertEquals(editCasesMessage, ''); // Check the Cancel action String canceleditCasesPage = editCasesController.cancel().getUrl(); // Check the save action String editCasesPage = editCasesController.save().getUrl(); } }

 

Nothing has changed in my environment or in my apex class and Vforce pages. Any help or suggestions welcome.