• Sham
  • NEWBIE
  • 290 Points
  • Member since 2007

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 81
    Replies

I'm trying to execute the simplest of codes in a future method, but when I call the method, it fails with the following exception:

System.AsyncException: Failed to enqueue future method

 

Here's my code:

 

global class OpptyEmailNotificationUtil {

@future public static void sendEmails1() {

System.debug('test');

}

}

 

I actually want to do a lot of other stuff in the future method, but am unable to even get this simple code to work.  Can anyone help?

 

Thanks. 

 

  • August 25, 2009
  • Like
  • 0

I have the following function which is being called on page submit for my visual force page. I am getting the following error when the user hits submit

 

Record ID: cannot Specify ID in an Insert Call

 

And the code is below

public PageReference confirm() {

case ticket = new case();

if (this.request != null) {

request.Title__c = this.empTitle;request.Department__c =

this.empDept; request.Reports_to__c = this.repToEmail;

 

try {

insert request; } catch (system.DMLException e){

ApexPages.addMessages(e);

return null;

}

this.caseId1 = generateNewTicket(request.employee_name__c, request.Grant_Email_access_to__c,

request.Outlook_out_of_office_message__c, request.Blackberry_user__c );

if (this.caseId1 == NULL)

return null;

}

 

list<Case> a = [Select c.CaseNumber from Case c where c.Id = :this.caseId1 limit 1];

if(a.size() != 0) {ticket = a[0];}

this.confNumber = ticket.CaseNumber;

 

try{ sendEmail(this.confNumber);

sendEmail();

} catch (EmailException e){

ApexPages.addMessages(e);

return null;

}

PageReference p = Page.offbsubmit;

p.setRedirect(true);

return p;

}

 

It says problem with insert but I see the new request was created! But I did not get any emails, so may be it was

choking at that part but I dont understand why. Any help please?

I'm looking to add an error message to an Opportunity if a user tries to delete it whilst it has any child contracts.

 

Currently my trigger code is as follows

 

trigger ClosedOpportunityPreventDeletion on Opportunity (before delete) {

if (system.Trigger.isDelete){

Opportunity[] Opps = [select id, (select id, Opportunity__c from PCFS__r) from Opportunity where id in :Trigger.oldMap.keySet()];

 

for (Opportunity o : Opps){

if(o.PCFS__r.size()>0){

o.adderror('You cannot delete this Opportunity as it has one or more Customer Forms associated with it');

}

}

}

  Unfortunately, if I use this code, I currently get an error saying "caused by: System.Exception: SObject row does not allow errors".

 

Any ideas?

 

With thanks 

 

 

Message Edited by Big Ears on 07-28-2009 06:54 AM

Hello - I am getting the following error when attempting to Save a record using a VisualForce Page (VisualForcExtension) and a Controller Extension (positionExtension):

 

System.NullPointerException: Attempt to de-reference a null object

                                                                                                                                                   

Class.positionExtension.Save: line 54, column 16 External entry point (line 54 column 16 is underlined in the following code fragment "return theController.save()";)

 

public class positionExtension { public string positionTypeID {get; set;} public positionExtension(ApexPages.StandardController positionController) { this.position = (Position__c)positionController.getRecord(); } public List<selectOption> PositionTypeOptions {get { List<selectOption> positionTypes = new List<selectOption>(); for (Position_Type__c ptr : [select name from Position_Type__c pt where pt.Department__c = :position.Department__c order by Name ]) positionTypes.add(new selectOption(ptr.id, ptr.name)); if (position.Department__c != null) { positionTypes.add(new selectOption('other', 'Other')); } else { positionTypes.add(new selectOption('', 'Please select a department', true)); } return positionTypes; } private set;} public Position_Type__c newPositionType{ get{ if (newPositionType == null) { newPositionType = new Position_Type__c();} return newPositionType; } private set; } public void resetPositionType() { positionTypeID = null; } public PageReference Save() { if (positionTypeID == 'other') { try{ newPositionType.Department__c = position.Department__c; insert newPositionType; position.Position_Type__c = newPositionType.ID; } catch (DmlException e) { ApexPages.addMessages(e); } } else { position.Position_Type__c = positionTypeID; } return theController.save(); } private final Position__c position; private final ApexPages.StandardController theController; }

 

The markup from the Visualforce Page that calls the Apex Class:

 

<apex:page standardController="Position__c" extensions="positionExtension" > <apex:form > <apex:sectionHeader title="Add New Position"/> <apex:pageBlock mode="edit" id="thePageBlock"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlocksection title="Information"> <apex:inputField value="{!Position__c.Location__c}"/> <apex:inputField value="{!Position__c.Hiring_Manager__c}"/> <apex:inputField value="{!Position__c.Status__c}"/> <apex:inputField value="{!Position__c.Notification__c}"/> <apex:inputField value="{!Position__c.Start_Date__c}"/> </apex:pageBlocksection> <apex:actionRegion > <apex:pageblocksection columns="1" title="Department"> <apex:inputField value="{!Position__c.Department__c}"> <apex:actionSupport event="onchange" rerender="dependentPositionType" action="{!resetPositionType}" status="departmentStatus"/> <apex:actionStatus id="departmentStatus" startText="Fetching position types..."/> </apex:inputField> </apex:pageblockSection> </apex:actionRegion> <apex:pageblockSection id="dependentPositionType" columns="1"> <apex:pageBlockSectionItem > <apex:outputLabel value="Position Type" for="pt"/> <apex:panelGrid columns="2"> <apex:actionRegion > <apex:outputText value="{!Position__c.Position_Type__c}" rendered="false"/> <apex:selectList id="pt" value="{!positionTypeID}" size="1" disabled="{!ISNULL(Position__c.Department__c)}"> <apex:selectOptions value="{!PositionTypeOptions}"/> <apex:actionSupport event="onchange" rerender="dependentPositionType" status="typeStatus"/> </apex:selectList> </apex:actionRegion> <apex:actionStatus id="typeStatus" startText="updating form..."> <apex:facet name="stop"> <apex:inputField value="{!newPositionType.Name}" rendered="{!positionTypeId == 'other'}" required="true"/> </apex:facet> </apex:actionStatus> </apex:panelGrid> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Position Details"> <apex:inputField value="{!Position__c.Job_Description__c}"/> <apex:inputField value="{!Position__c.Responsibilities__c}"/> <apex:inputField value="{!Position__c.Programming_Languages__c}"/> <apex:inputField value="{!Position__c.Educational_Requirements__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

I would appreciate any ideas for resolving this problem.  Please go easy on newbie learning VF and Apex.

 

Thanks,

SCR

  • July 23, 2009
  • Like
  • 0

I have a problem in static resources.

My picture is nothing in Force.com

The code is <apex:image url="{!$Resource.Blackberry}"></apex:image>  

 

Any idea?

 

 

regard

 

ahui

  • July 21, 2009
  • Like
  • 0

some one plese help me to find what is wrong with the below code.

 

upon selecting the value in the dropdown list and after clicking on save button, Account.status__c field should be updated with the dropdown list selected value.

 

When i try to save the below code i am receiving this error. Please help

 

Illegal assignment from LIST:String to String

 

 

VF Page

<apex:page tabStyle="Account" controller="Account_Update"> <apex:form > <apex:pageblock mode="edit"> <apex:outputLabel value="Status"></apex:outputLabel> <apex:selectList value="{!status}" multiselect="false" size="1"> <apex:selectOptions value="{!items}"/> </apex:selectList> <br /><br /> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> </apex:pageblock> </apex:form> </apex:page>

 

Controller

 

 

public class SBS_Account_Update { String[] Status =new String[]{}; Id AcctId = ApexPages.currentPage().getparameters().get('id'); Account recTypeid=[Select RecordTypeId from Account where id=:AcctId]; public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); if(recTypeid.RecordTypeId=='0123000000004ZZ') { options.add(new SelectOption('--Select--','--Select--')); options.add(new SelectOption('Fully Paid','Fully Paid')); options.add(new SelectOption('Partially Paid','Partially Paid')); } else { options.add(new SelectOption('--Select--','--Select--')); options.add(new SelectOption('Paid','Paid')); options.add(new SelectOption('Not Paid','Not Paid')); } return options; } public String[] getStatus() { return status; } public void setStatus(String[] status) { this.status= status; }

Account act=new Account(Id=AcctId);

public PageReference save() { acct.Status__c=this.Status; Illegal assignment from LIST:String to String update acct; return null; } }

In the above save method, i tried putting, acct.status__c=Status[2];

When clicked on save, just the VFpage is getting refreshed. Nothing is getting saved in the Account.Status__c field.

 

Also,please advise!!!!

Message Edited by mavs on 06-25-2009 12:41 PM
  • June 25, 2009
  • Like
  • 0

I have an <apex:fieldHidden id="abc" /> on my VF form. I set a value in this field on onSubmit of form. But I am unable to get to way to get this value in my apex class.

 

Any help please.

 

Regards,
Rao

I am update/insert record into the Contact, and I got this error message:



"Unable to create/update fields: Name. Please check the security settings of this field and verify that it is read/write for your profile."



I checked my profile and standard object permissions, all checked.
I have a VisualForce page, and want to override Account detail, but only in some circumstances (otherwise default to the standard salesforce view detail page).
 
When I override the "View" button with this VF page, the following code does redirect to the standard page, but it creates an infinite redirect loop.
 
How do I redirect from a VF page to a standard page and prevent the loop? Adding "&sfdc.override=1" to /id in routePage produces "URL no longer exists" error.
 

<apex:page
standardController="Account"
extensions="myAccountControllerExtension"
showHeader="true" tabStyle="account"
action="{!routePage}" >

 

 
 

public PageReference routePage() {
return new PageReference( '/' + acct.id );
}

 

 
 
 
Hi All,

    Good day. Is there a way to set the record type of a record to be saved via VF? Thanks!

I am using outputText to format some values.

Here is my code

 



<apex:page>
<apex:outputText value="{0,number,##,##,##,###.00}">
<apex:param value="{!1000000}" />
</apex:outputText>
<br/>
<apex:outputText value="{0,number,#,#,#,#.00}">
<apex:param value="{!10000000}" />
</apex:outputText>
</apex:page>

Interestingly the first formatting doesn't comes out proper,While the second is proper.

The first should display 10,00,000.00 instead of 1,000,000.00 (note the misplaced comma)

 

Has anybody encoutered a similar issue

 

 

 

  • May 24, 2010
  • Like
  • 0

I am looking to encrypt some data using 3DES algorithm.

Is this possible in Apex ?

 

Any pointers would be greatly appreciated.

 

Thanks,

Sham

  • October 20, 2009
  • Like
  • 0

I have wrapped some html tags in an <apex:component> but upon rendering it generates a span in which all contents are placed.

This sometimes messes up with styles.

 

Is there a property or method by which apex component can be forced to render a div or no wrapper at all ?

  • October 06, 2009
  • Like
  • 0
RenderAs PDF doesn't correctly render apex: dataList
Consider the code.
Code:
<apex:dataList value="{!account}" var="account1" id="theList" type="A" >
<apex:outputText value="{!account1.name}"/>
</apex:dataList>

 The following code renders as following in HTML
  • Edge Communications
  • Burlington Textiles Corp of America
  • Pyramid Construction Inc.

Now add render as pdf to the page ,rendering is done as
  • Edge Communications
  • Burlington Textiles Corp of America
  • Pyramid Construction Inc.
Is this a confirmed bug in Visual Force ?

Thanks




Message Edited by Sham on 09-19-2008 05:11 AM

Message Edited by Sham on 09-19-2008 05:12 AM
  • September 19, 2008
  • Like
  • 0
I have granted field level permissions to change the contact created on Case,but strangely
altough the portal user can select another contact from Lookup ,after  saving

Salesforce shows the same contact. ie Contact update is lost somewhere.

No triggers are running on Case on my org.

What could be the possible reason for this.? Is this a bug or something to do with sharing rules.
Any pointers will be greatly appreciated.

Thanks
Sham
  • August 29, 2008
  • Like
  • 0
Does anybody has an example how to use the pageStyle property of an VF page ?
I am trying set the background color of my page to some other color eg. Red;



  • August 27, 2008
  • Like
  • 0
In Apex,is it possible to query the various  RecordType(eg a standard Object) that is assigned to a profile.

I am trying to build a custom RecordType selection VisualForce page,where in i need to show only the RecordType
that are assigned to the currently logged in user profile.?
  • August 12, 2008
  • Like
  • 0
In Apex,it is possible to query the Recently viewed records by the user ?
  • August 11, 2008
  • Like
  • 0
Does Visual Force support dependent picklists ?

I would like to show the values three select lists from Case which are dependent on each other.

I have used <apex: inputField>,it creates the selectList properly but doesn't respect the dependency property.


Thanks
  • August 07, 2008
  • Like
  • 0
Hi,
 
When i want to access self service portal pages by logging in as portal user then i get this exception in javascript console(Using FireFox) and javascript error(Using IE):
 
"Error: uncaught exception: {faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{fault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }".
 
Any idea why i m getting this exception...
 
Thanks in advance.
 
 
  • November 23, 2007
  • Like
  • 0
    Is there a way to query the public calendars in organization,using sforce  API call?

Message Edited by Sham on 09-27-2007 04:15 AM

  • September 27, 2007
  • Like
  • 0

Hi,

 

I have a trigger to be deployed to production.

The trigger assigns some Leads after a Business criteria to a Queue.

 

I have created that queue in sandbox and when i try to deploy the trigger through the Force.com IDE, it is raising an error in deployment plan, saying reference ID not valid.

 

since that queue ID is used in trigger, i guess i need to move the queue first to production which would have same ID.

 

So how do i first move my queue to production?

 

Any help on this is highly appreciated.

 

Thanks,

Sales4ce

Hey all,

 

I am having an issue where a SELECT statement is only returning the first 20 records, despite the fact that I have not placed any limits on it. Is there a limit of 20 for what a SELECT can return?

 

If not, I can post my code to see if anyone can help me with why my query is being limited.

 

Thanks!

-Derrek

Hi everyone,

 

   In my appliction i am using picklist field.My requirement is, in picklist i should not be display "-None-" option and it won't accept null values also.if any one knows this plz tell me the solution.

 

Thanks in advance,

anu..

Hi Every one,

 

I have created dependency fields in salesforce..... I want to call those fields in visualforce pg.Can some one help me with the code in clling dependency fields in salesforce......

 

 

                                                         Thanks in advance,

 

 

                                                                   Anu...

These days i am developing a solution for one of clients based sites and customer portal.

 

I end up spending hours looking at the data, my code, debug log (which most often does not contain any useful data, a whole wack of items that were successful! ) and stare at an "under construction message" screenshot that the user sends me (as a result of an error they encoutered)

 

No error emails are sent to me about the failure... so most of the time i am lost!
I have no idea what going is on!

and you are hearing these words from a Salesforce Certified developer with more than 13 years of software development exprience!

 

I am hoping with these harsh words SF folks would be able to step up and fix the problem with this technology.

 

I have wrapped some html tags in an <apex:component> but upon rendering it generates a span in which all contents are placed.

This sometimes messes up with styles.

 

Is there a property or method by which apex component can be forced to render a div or no wrapper at all ?

  • October 06, 2009
  • Like
  • 0

I'm trying to execute the simplest of codes in a future method, but when I call the method, it fails with the following exception:

System.AsyncException: Failed to enqueue future method

 

Here's my code:

 

global class OpptyEmailNotificationUtil {

@future public static void sendEmails1() {

System.debug('test');

}

}

 

I actually want to do a lot of other stuff in the future method, but am unable to even get this simple code to work.  Can anyone help?

 

Thanks. 

 

  • August 25, 2009
  • Like
  • 0

 

Hi there

 

I am completely new to Salesforce, and I apologize in advance if this question has been answered before. 

 

Basically, a Client has all their customer details in Salesforce, and has been sending out Emails via it as well as keeping track of all their details through there. In short, we have developed a website for their customers to go to, and they update some options and it saves to a SQL database on our server. This all is completely separate to Salesforce. 

 

What we wish to achieve, is that once this page has been filled out, that we can set a particular field inside Salesforce which corresponds to that users Email, or name, or Id. So basically, once the page is done, they click “Finish” on the website, it runs a function which sets a value in Salesforce to “True”, for example, against their contact details. Is it possible to get these two to talk together, and if so – where do I start? 

 

Thanks for any help you can give!


 

I'm relatively new to Apex, but have already developed a very complicated app in visualforce/apex.

 

Well, after working with SOQL for the past six months, I'm convinced I'm either still doing something terribly wrong, or SOQL is a bad joke. Please help me understand what I'm missing.

 

I have many objects that all relate to one another through lookup fields, sometimes one to many, others one to one, others many to many.

 

For example, object1 has a lookup to object2. So, if I get object1, and I want to then retrieve other fields in the associated object2, I then have to use soql and Object2 = [select id,name,other_field__c from object2 where id=:obj2id];

 

We do this all over the place in our app, in literally every class.

 

I have basically discovered that in order to use SOQL, I can't use the "where" clause inline in a loop without hitting SOQL limits. So I have completely stopped using the where clause.

 

Instead, I have a utility class where I query from the database once in the beginning (using soql) all of the records for any objects we're going to need, and then I iterate through them using a for loop, and look for the field with the attribute I want. Occasionally we have hit "too many statement" limits using this approach, but it seems like it allows us at least to write a functioning app.

 

It feels rather absurd to do this (and almost like cheating, but moreso doing something outrageously ridiculous from a programming perspective), but we haven't been able to figure any way around this architecture.

 

 

Thanks in advance!

 

David

I have the following function which is being called on page submit for my visual force page. I am getting the following error when the user hits submit

 

Record ID: cannot Specify ID in an Insert Call

 

And the code is below

public PageReference confirm() {

case ticket = new case();

if (this.request != null) {

request.Title__c = this.empTitle;request.Department__c =

this.empDept; request.Reports_to__c = this.repToEmail;

 

try {

insert request; } catch (system.DMLException e){

ApexPages.addMessages(e);

return null;

}

this.caseId1 = generateNewTicket(request.employee_name__c, request.Grant_Email_access_to__c,

request.Outlook_out_of_office_message__c, request.Blackberry_user__c );

if (this.caseId1 == NULL)

return null;

}

 

list<Case> a = [Select c.CaseNumber from Case c where c.Id = :this.caseId1 limit 1];

if(a.size() != 0) {ticket = a[0];}

this.confNumber = ticket.CaseNumber;

 

try{ sendEmail(this.confNumber);

sendEmail();

} catch (EmailException e){

ApexPages.addMessages(e);

return null;

}

PageReference p = Page.offbsubmit;

p.setRedirect(true);

return p;

}

 

It says problem with insert but I see the new request was created! But I did not get any emails, so may be it was

choking at that part but I dont understand why. Any help please?

I have read the cookbook and see that I can use a trigger to block the creation of a record by throwing an error.

 

Is there a way to do it without throwing the error?

 

I need on creation of a task to check certain values and if they sync up I have to create a different object and not save (or delete after insert which doesn't seem possible) the original task.

 

Thanks

Doug

 

I'm looking to add an error message to an Opportunity if a user tries to delete it whilst it has any child contracts.

 

Currently my trigger code is as follows

 

trigger ClosedOpportunityPreventDeletion on Opportunity (before delete) {

if (system.Trigger.isDelete){

Opportunity[] Opps = [select id, (select id, Opportunity__c from PCFS__r) from Opportunity where id in :Trigger.oldMap.keySet()];

 

for (Opportunity o : Opps){

if(o.PCFS__r.size()>0){

o.adderror('You cannot delete this Opportunity as it has one or more Customer Forms associated with it');

}

}

}

  Unfortunately, if I use this code, I currently get an error saying "caused by: System.Exception: SObject row does not allow errors".

 

Any ideas?

 

With thanks 

 

 

Message Edited by Big Ears on 07-28-2009 06:54 AM

Hello - I am getting the following error when attempting to Save a record using a VisualForce Page (VisualForcExtension) and a Controller Extension (positionExtension):

 

System.NullPointerException: Attempt to de-reference a null object

                                                                                                                                                   

Class.positionExtension.Save: line 54, column 16 External entry point (line 54 column 16 is underlined in the following code fragment "return theController.save()";)

 

public class positionExtension { public string positionTypeID {get; set;} public positionExtension(ApexPages.StandardController positionController) { this.position = (Position__c)positionController.getRecord(); } public List<selectOption> PositionTypeOptions {get { List<selectOption> positionTypes = new List<selectOption>(); for (Position_Type__c ptr : [select name from Position_Type__c pt where pt.Department__c = :position.Department__c order by Name ]) positionTypes.add(new selectOption(ptr.id, ptr.name)); if (position.Department__c != null) { positionTypes.add(new selectOption('other', 'Other')); } else { positionTypes.add(new selectOption('', 'Please select a department', true)); } return positionTypes; } private set;} public Position_Type__c newPositionType{ get{ if (newPositionType == null) { newPositionType = new Position_Type__c();} return newPositionType; } private set; } public void resetPositionType() { positionTypeID = null; } public PageReference Save() { if (positionTypeID == 'other') { try{ newPositionType.Department__c = position.Department__c; insert newPositionType; position.Position_Type__c = newPositionType.ID; } catch (DmlException e) { ApexPages.addMessages(e); } } else { position.Position_Type__c = positionTypeID; } return theController.save(); } private final Position__c position; private final ApexPages.StandardController theController; }

 

The markup from the Visualforce Page that calls the Apex Class:

 

<apex:page standardController="Position__c" extensions="positionExtension" > <apex:form > <apex:sectionHeader title="Add New Position"/> <apex:pageBlock mode="edit" id="thePageBlock"> <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlocksection title="Information"> <apex:inputField value="{!Position__c.Location__c}"/> <apex:inputField value="{!Position__c.Hiring_Manager__c}"/> <apex:inputField value="{!Position__c.Status__c}"/> <apex:inputField value="{!Position__c.Notification__c}"/> <apex:inputField value="{!Position__c.Start_Date__c}"/> </apex:pageBlocksection> <apex:actionRegion > <apex:pageblocksection columns="1" title="Department"> <apex:inputField value="{!Position__c.Department__c}"> <apex:actionSupport event="onchange" rerender="dependentPositionType" action="{!resetPositionType}" status="departmentStatus"/> <apex:actionStatus id="departmentStatus" startText="Fetching position types..."/> </apex:inputField> </apex:pageblockSection> </apex:actionRegion> <apex:pageblockSection id="dependentPositionType" columns="1"> <apex:pageBlockSectionItem > <apex:outputLabel value="Position Type" for="pt"/> <apex:panelGrid columns="2"> <apex:actionRegion > <apex:outputText value="{!Position__c.Position_Type__c}" rendered="false"/> <apex:selectList id="pt" value="{!positionTypeID}" size="1" disabled="{!ISNULL(Position__c.Department__c)}"> <apex:selectOptions value="{!PositionTypeOptions}"/> <apex:actionSupport event="onchange" rerender="dependentPositionType" status="typeStatus"/> </apex:selectList> </apex:actionRegion> <apex:actionStatus id="typeStatus" startText="updating form..."> <apex:facet name="stop"> <apex:inputField value="{!newPositionType.Name}" rendered="{!positionTypeId == 'other'}" required="true"/> </apex:facet> </apex:actionStatus> </apex:panelGrid> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Position Details"> <apex:inputField value="{!Position__c.Job_Description__c}"/> <apex:inputField value="{!Position__c.Responsibilities__c}"/> <apex:inputField value="{!Position__c.Programming_Languages__c}"/> <apex:inputField value="{!Position__c.Educational_Requirements__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>

 

I would appreciate any ideas for resolving this problem.  Please go easy on newbie learning VF and Apex.

 

Thanks,

SCR

  • July 23, 2009
  • Like
  • 0

I have a problem in static resources.

My picture is nothing in Force.com

The code is <apex:image url="{!$Resource.Blackberry}"></apex:image>  

 

Any idea?

 

 

regard

 

ahui

  • July 21, 2009
  • Like
  • 0

I created a VF page and I integrated with sites. I have set all the permissions properly as much as I could. Now when I access the URL for sites, I am facing the following issues. Basically, my VF page has a contact lookup and then some fields from a custom object created by me.

 

1. If I login to sales force and click on the sites URL, I can see basic form with all the fields and everything but if I click on the look up for contact, I am getting Authorization required error. If I still try to fill some fields and submit the form, I am getting the following errors.

 

Errors j_id0:j_id2:thePageBlock:remail:j_id40:rem: An error occurred when processing your submitted information. j_id0:j_id2:thePageBlock:email:j_id50:em: An error occurred when processing your submitted information. j_id0:j_id2:thePageBlock:info:j_id54:**bleep**: An error occurred when processing your submitted information. j_id0:j_id2:thePageBlock:info:j_id65:dept: An error occurred when processing your submitted information.

 

 

Its complaining about some of the fields that I filled in(not all of them)..and rem, em and **bleep** and dept are id names of the fields that I filled in which are Employee email, title and deprtment.

 

How can I resolve this.

 

I have set the permissions for custom object as follows..

 

I have checked all fields under Basic access and Data administration except for delete and modifyall. Should I check them as well inorder to get rid of the page submission errors?

 

And for contact standard object, I checked read and create fields which are the only fields available for checking. But I still cannot access the Contact object through that look up field.

 

2. Secondly, if I dont login to salseforce, I cannot even see the basic form..I am getting unauthorized error.

 

How to fix these issues?...thanks!!

 

 

some one plese help me to find what is wrong with the below code.

 

upon selecting the value in the dropdown list and after clicking on save button, Account.status__c field should be updated with the dropdown list selected value.

 

When i try to save the below code i am receiving this error. Please help

 

Illegal assignment from LIST:String to String

 

 

VF Page

<apex:page tabStyle="Account" controller="Account_Update"> <apex:form > <apex:pageblock mode="edit"> <apex:outputLabel value="Status"></apex:outputLabel> <apex:selectList value="{!status}" multiselect="false" size="1"> <apex:selectOptions value="{!items}"/> </apex:selectList> <br /><br /> <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> </apex:pageblock> </apex:form> </apex:page>

 

Controller

 

 

public class SBS_Account_Update { String[] Status =new String[]{}; Id AcctId = ApexPages.currentPage().getparameters().get('id'); Account recTypeid=[Select RecordTypeId from Account where id=:AcctId]; public List<SelectOption> getItems() { List<SelectOption> options = new List<SelectOption>(); if(recTypeid.RecordTypeId=='0123000000004ZZ') { options.add(new SelectOption('--Select--','--Select--')); options.add(new SelectOption('Fully Paid','Fully Paid')); options.add(new SelectOption('Partially Paid','Partially Paid')); } else { options.add(new SelectOption('--Select--','--Select--')); options.add(new SelectOption('Paid','Paid')); options.add(new SelectOption('Not Paid','Not Paid')); } return options; } public String[] getStatus() { return status; } public void setStatus(String[] status) { this.status= status; }

Account act=new Account(Id=AcctId);

public PageReference save() { acct.Status__c=this.Status; Illegal assignment from LIST:String to String update acct; return null; } }

In the above save method, i tried putting, acct.status__c=Status[2];

When clicked on save, just the VFpage is getting refreshed. Nothing is getting saved in the Account.Status__c field.

 

Also,please advise!!!!

Message Edited by mavs on 06-25-2009 12:41 PM
  • June 25, 2009
  • Like
  • 0
I have a VisualForce page, and want to override Account detail, but only in some circumstances (otherwise default to the standard salesforce view detail page).
 
When I override the "View" button with this VF page, the following code does redirect to the standard page, but it creates an infinite redirect loop.
 
How do I redirect from a VF page to a standard page and prevent the loop? Adding "&sfdc.override=1" to /id in routePage produces "URL no longer exists" error.
 

<apex:page
standardController="Account"
extensions="myAccountControllerExtension"
showHeader="true" tabStyle="account"
action="{!routePage}" >

 

 
 

public PageReference routePage() {
return new PageReference( '/' + acct.id );
}