• devNut!
  • NEWBIE
  • 124 Points
  • Member since 2005

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

Hi there.My inputText field in my vf page is renderd like so:

 

 

 

but in my vf code I have 

<apex:pageBlockSectionItem > <apex:outputLabel value="Title" for="titleField" /> <apex:inputText value="{!title}" required="true" id="titleField" style="width: 200px;" /> </apex:pageBlockSectionitem>

 

Where you can see that the inputText is required=true but it's not showing up on my vf page.

This field binds to a String property in my custom controller that's called title

 

Thanks for the help & regards

 

  • February 05, 2009
  • Like
  • 0

Hi,
 
I'm building a VisualForce page that needs to send a report to an email address entered in a textfield (not a User or a Contact) using a VisualForce template
 
According to the docs, targetObjectId is an optional field when sending an email, but I keep getting this error:
 
SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing targetObjectId with template
 
If I set the TargetObjectId to an existing contact, it all works fine, but I do not want these email to always go to a contact.
 
Is there anything I'm missing? 
 
 
Thanks so much for your help!
 
--Alex 
 
Here's the code:
 
    Messaging.SingleEmailMessage emailMsg = new Messaging.SingleEmailMessage();
    emailMsg.setSaveAsActivity(false);
    emailMsg.setWhatId(AccountProfile.Id);
    emailMsg.setTemplateId([select Id from EmailTemplate where DeveloperName = 'AccountProfileReportEmail'].Id);
    String[] emailAddresses = emailTo.split(';');
    emailMsg.setToAddresses(emailAddresses);
     Messaging.SendEmailResult[] sers;
        //Insert PDF as quote attachment & send email
        try
        {
            //insert profileAttachment;
            sers = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {emailMsg});
        }
        catch(DmlException dmle)
        {
            for (Integer i=0; i < dmle.getNumDml(); i++)
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, dmle.getDmlMessage(i)));

            Database.rollback(sp);
            return null;
        }
        catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
            Database.rollback(sp);
            return null;
        }  
I am the manager of a 3 person support department and I want to add the tasks of my other two employees on my Home tab so I can track open and closed tasks. I cannot seem to figure this out.

Any suggestions?

-Thanks!

Billy



Message Edited by filmfx on 08-27-2008 11:03 AM
  • August 27, 2008
  • Like
  • 0
From what I understand of Cross Object Formula Fields you can't use them to reference Long Text Area fields.  Does anyone know if that is right/wrong?  Or for that matter if it's right, is it something that may change in the future???
  • August 27, 2008
  • Like
  • 0

Why is it that when using a sandbox the main salesforce application is hosted on https://cs2.salesforce.com, but visualforce pages are hosted on https://c.cs2.salesforce.com?

 

When embedding a visualforce page on an objects's page layout the use of two different servers creates a cross-domain scripting issue.


Doesn't it make sense for all pages of a given salesforce org/instance to be served from ONE server?

I'm using the visualforce flash tag:

 

<apex:flash src="{!$Resource.FlashApplication}"
         id="CmpId"
         width="100%" height="100%"
         flashvars="session_id={!$Api.Session_ID}&server_url={!$Api.Partner_Server_URL_90}" />

 

 

However when loading the visualforce page the prompt "This page contains both secure and nonsecure items." appears.  When the  <apex:flash is commented out, the page loads without the prompt.

 

Any ideas?

Hi,
Is it possible to define some javascript that runs when a visualforce page loads (not necessarily for the first time)?


Thanks!
Since adobe flex is a client side technology it does not have access to machine's local resources.  For example an adobe flex application cannot open a file on a user's machine and write it to a document object via the salesforce api.  However, adobe flex does have support for uploading files but requires a script (e.g. php) on the other end to accept the file.

Does salesforce.com provide the ability to write a custom script to handle file uploads via a adobe flex application ?
apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

Is it because  POST is required to upload the file ?




Message Edited by devNut! on 11-18-2008 11:30 AM
I am experimenting with the "<apex:inputFile>" tag trying to create a page where the user can upload one file at a time.  The first file upload works but the second one throws the exception:

Here is the scenario:
1) load file upload page
2) select and upload file
3) user is re-directed to the file upload page
4) select and upload file
5) exception: 
Insert failed. First exception on row 0 with id 01530000000henEAAQ; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]


It's like the context is not being reset when the page is refreshed (see return from doSave() below)
Any input is appreciated.


VF Page

Code:
<apex:page standardController="Document" extensions="TestFileUploadControllerExtension" showHeader="false" sidebar="false">
    <apex:messages />
    <apex:form id="theForm">
      <apex:pageBlock >
          <apex:pageBlockSection >
            <apex:inputFile value="{!document.body}" filename="{!document.name}"/>
            <apex:commandButton value="save" action="{!doSave}"/>
          </apex:pageBlockSection>
       </apex:pageBlock>
     
    </apex:form>
</apex:page>

 
Controller Extension
Code:
public class TestFileUploadControllerExtension {

ApexPages.StandardController controller;


public TestFileUploadControllerExtension(ApexPages.StandardController c)
{
System.debug('@@@@@@@@ TestFileUploadControllerExtension');

this.controller = c;

}

public PageReference doSave()
{
System.debug('@@@@@@@@ doSave');

Document d = (Document) controller.getRecord();
System.debug('@@@@@@@@ document name: '+d.name);

d.folderid = UserInfo.getUserId(); //store in Personal Documents
System.debug('@@@@@@@@ document folder id: '+d.folderid);

insert d;
System.debug('@@@@@@@@ document object id: '+d.id);


System.debug('@@@@@@@@ redirect');
PageReference page = new PageReference('/apex/TestFileUpload');
return page;
}




}

 




Message Edited by devNut! on 11-17-2008 12:35 PM
According to http://trust.salesforce.com/trust/status/ winter 09 was released for NA1 on Oct 3rd.

However I don't see the tag objects (e.g. AccountTag, ContactTag) using dataloader or the force.com schema explorer.

Any ideas?
"Send an Email" through the salesforce UI allows you to specify a "Related To" record which can be of type custom object OR standard object.

However the WhatId property through the API only allows standard objects.  Is this expected?

-------------- from the apex language reference -------------------------
Optional. If you specify a contact for the targetObjectId field, you can specify a whatId as well. This helps to further ensure that merge fields in the template contain the correct data. The value must be one of the following types:
  • Account
  • Asset
  • Campaign
  • Case
  • Contract
  • Opportunity
  • Order
  • Product
  • Solution
  • Custom



  • September 16, 2008
  • Like
  • 0
Hello,
Once a View or Report is created.  Is there a way to get at the data it contains?

E.g.
- Create a new view on accounts
- Click a button (preferably on the views page) to do something with the account records in the view

Thanks.
  • September 09, 2008
  • Like
  • 0
I'm trying to use the mass email call and am getting an error:

15:42:56 INFO - 20080905194256.499:AnonymousBlock: line 14, column 1: ----------------------------------------- 20080905194256.499:AnonymousBlock: line 15, column 1: (Messaging.SendEmailResult[getErrors=(Messaging.SendEmailError[getFields=null;getMessage=Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.;getStatusCode=System.StatusCode.NO_MASS_MAIL_PERMISSION;getTargetObjectId=null;]);isSuccess=false;])


Code:
Id templateId= '00X300000012aLJEAY';
Id[] cIds = new Id[1];
cIds[0]='0033000000R0ByYAAV';

Messaging.MassEmailMessage  mail = new Messaging.MassEmailMessage();
mail.setTargetObjectIds( cIds ); // the target contact 
mail.setTemplateId( templateId); //template to be used
mail.setBccSender(false);
mail.setSaveAsActivity(false);
mail.setUseSignature(false);

Messaging.SendEmailResult[] res = Messaging.sendEmail(new Messaging.Email[] { mail } , false);

System.Debug('-----------------------------------------');
System.Debug(res);

 

The apex code is running in system context so I don't see why I'd need to enable mass email permission on a user profile.

Any ideas?
  • September 05, 2008
  • Like
  • 0
Hi,
Trying to run the following statement that simply queries the EmailTemplate standard object

Code:
for ( EmailTemplate et : [ select Id, Name, Body from EmailTemplate  ] )
{
System.debug(logginglevel.DEBUG, 'obj data: '+et);
}

 
but getting the error:
Save error: Loop variable must be an SObject or list of EmailTemplate


Can anyone shed some light?


I am creating a HTML template through the Salesforce UI.  When I specify the text as size 12 using the formatting controls it appears fine in the salesforce UI - See screenshot

However when viewing the underlying HTML code stored in the HtmlValue property of the EmailTemplate object (see below) the size is not specified properly (It shows 5 but should be 12).

Is this expected?

-----------
Code:
<table cellpadding="5" width="550" height="400" cellspacing="5" border="0" >
<tr height="400" valign="top" >
<td locked="0" style=" font-family:arial; bLabel:main; color:#000000; font-size:12pt; 
bEditID:r3st1; background-color:#FFFFFF;" aEditID="c1r1" tEditID="c1r1" >
<![CDATA[<font size="5">Test</font><br>]]></td>
</tr>
</table>

 


Why can't the plain text body and html body be specified when sending a SingleEmailMessage using a template through the API ?

The Salesforce UI allows a user to select a template and edit the email body before sending.


---------------------------------------------------
<sendEmailResponse xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <result>
    <errors>
      <fields xsi:nil="true"/>
      <message>
        When a template is specified the plain text body, html body and subject may not be specified
      </message>
      <statusCode>
        INVALID_FIELD_WHEN_USING_TEMPLATE
      </statusCode>
      <targetObjectId xsi:nil="true"/>
    </errors>
    <success>
      false
    </success>
  </result>
</sendEmailResponse>
Trying to test apex code coverage using the Force.com IDE and getting the error:

ServiceException: While running test:NS_119162ce7e2.<className> - TOO_MANY_APEX_REQUESTS: too many apex requests (UNKNOWN_EXCEPTION)
While running test:NS_119162ce7e2.<className> - TOO_MANY_APEX_REQUESTS: too many apex requests (UNKNOWN_EXCEPTION)

---------------------------------------------------
Also getting an error when trying to run ALL TESTS through the salesforce ui (setup -> develop ->apex classes) :

Unable to Process Request

We apologize for the inconvenience



The salesforce.com servers are temporarily unable to respond to your request that requires Apex. We apologize for the inconvenience.
Thank you for your patience, and please try again in a few moments.

Visit http://trust.salesforce.com for current system status and availability.

back



All systems are reported operational on trust.salesforce.com


I'd like to override the standard "Add Products" button on the Products related list displayed on Opporunity records.

This button takes you to the standard "Opportunity Product Selection" screen - I'd like to make some changes to this standard page using visualforce. 


Is this possible? How would I go about doing this?


Thanks!
Does anyone know the EXACT cause of this error?
-------------------------------------------------------------------------

Unable to Process Request

Concurrent requests limit exceeded.

To protect all customers from excessive usage and Denial of Service attacks, we limit the number of long-running requests that are processed at the same time by an organization. Your request has been denied because this limit has been exceeded by your organization. Please try your request again later.

-----------------------------------------------------------

Thanks.


Hello,
Is the following behaviour expected?

1) User clicks a custom tab to load a custom flex application
2) The Flex application accepts the user's session and connects to apex web services to perform data read/create/update operations
3) User shift+clicks on the Salesforce "Logout" link (top right corner)
4) A new window is displayed telling the user he/she has been logged out

At this point if the user clicks on any salesforce tab, he/she will be re-directed to the login screen, with the following message displayed: " You have attempted to access a page that requires a Salesforce login. If you are already a user of the system, please login below."

However after clicking logout, if the user goes back to the main window he/she can continue to use our flex application.  Meaning the user can still perform create/update/read operations against salesforce web services.

Should the session used by the flex application be invalidated after the user clicks the salesforce "logout" link?

Thanks in advance.



Message Edited by devNut! on 06-10-2008 08:12 AM

Message Edited by devNut! on 06-11-2008 05:14 AM
Hello,
I'm running dataloader from the command line and want to filter the level of log messages sent to the console.

Do I merely need to put a configured version of "log-conf.xml" in the <dir> specified by the command line argument

-Dsalesforce.config.dir=<dir> ?



Thanks!

Hello,
Some applications that live inside a salesforce tab do not "log in", but rather operate using the user's session. 

Does Salesforce provide a method to prevent session timeout for such applications?  e.g. some kind of keep alive call 
Or is the "Disable session timeout warning popup." supposed to address this issue?


This post is an extension of the following posts in that tab applications don't have the user's credentials
http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=16004
http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=940&query.id=65872


Thanks!
Hello,

Does Apex code contribute the API usage limit?



Thanks

Hi there.My inputText field in my vf page is renderd like so:

 

 

 

but in my vf code I have 

<apex:pageBlockSectionItem > <apex:outputLabel value="Title" for="titleField" /> <apex:inputText value="{!title}" required="true" id="titleField" style="width: 200px;" /> </apex:pageBlockSectionitem>

 

Where you can see that the inputText is required=true but it's not showing up on my vf page.

This field binds to a String property in my custom controller that's called title

 

Thanks for the help & regards

 

  • February 05, 2009
  • Like
  • 0

Hi,

 I am able to get the contact details in the VF page directly by using the standard controller -"Contact"But while using the standard controller as Campaign I am not able to do the same as I did in retrieving fields(Name,ID....)  by using contacts.

For contacts: 

 

<apex:page  Standardcontroller ="Contact">

<apex:inputText value="{!Contact.name}"></apex:inputText> 

</apex:Page> 

 

the name of a particular campaign  is displayed in a text box overhere.But how can i do the same with campaign...

 

Here i am using it as  -

<apex:page Standardcontroller="Campaign">

<apex:inputText value="{! Campaign.name}"></apex:inputText> 

</apex:Page> 

 

the error is displayed as Error: Unknown property 'ArrayList.Name'

 

 

 

This might be a  simple one but i am not able to solve it out.Please help me out asp.

Thanx in Advance. 

  • February 05, 2009
  • Like
  • 0

I'm using the visualforce flash tag:

 

<apex:flash src="{!$Resource.FlashApplication}"
         id="CmpId"
         width="100%" height="100%"
         flashvars="session_id={!$Api.Session_ID}&server_url={!$Api.Partner_Server_URL_90}" />

 

 

However when loading the visualforce page the prompt "This page contains both secure and nonsecure items." appears.  When the  <apex:flash is commented out, the page loads without the prompt.

 

Any ideas?


Hi,
 
I'm building a VisualForce page that needs to send a report to an email address entered in a textfield (not a User or a Contact) using a VisualForce template
 
According to the docs, targetObjectId is an optional field when sending an email, but I keep getting this error:
 
SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Missing targetObjectId with template
 
If I set the TargetObjectId to an existing contact, it all works fine, but I do not want these email to always go to a contact.
 
Is there anything I'm missing? 
 
 
Thanks so much for your help!
 
--Alex 
 
Here's the code:
 
    Messaging.SingleEmailMessage emailMsg = new Messaging.SingleEmailMessage();
    emailMsg.setSaveAsActivity(false);
    emailMsg.setWhatId(AccountProfile.Id);
    emailMsg.setTemplateId([select Id from EmailTemplate where DeveloperName = 'AccountProfileReportEmail'].Id);
    String[] emailAddresses = emailTo.split(';');
    emailMsg.setToAddresses(emailAddresses);
     Messaging.SendEmailResult[] sers;
        //Insert PDF as quote attachment & send email
        try
        {
            //insert profileAttachment;
            sers = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {emailMsg});
        }
        catch(DmlException dmle)
        {
            for (Integer i=0; i < dmle.getNumDml(); i++)
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, dmle.getDmlMessage(i)));

            Database.rollback(sp);
            return null;
        }
        catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage()));
            Database.rollback(sp);
            return null;
        }  
Hi fellow developers,

I'm trying to emulate the sample in the vf dev guide (Adding Custom List Buttons using Standard List Controllers), but with a twist: using a detail from a master-detail (Account = Master, detail = Flavor_Request__c).

I have both the Apex Class and controller similar to the example in the dev guide:

Code:
public class OpptyFlavorListButton
{
    public OpptyFlavorListButton(ApexPages.StandardSetController controller) {
            controller.setPageSize(10);
    }
}

<apex:page standardController="Flavor_Request__c" recordSetVar="flavors"
    tabStyle="Flavor_Request__c" extensions="OpptyFlavorListButton">
<apex:form >
    <apex:pageBlock title="Edit Status" mode="edit">
        <apex:pageMessages />
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="Save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        </apex:pageBlockButtons>

        <apex:pageBlockTable value="{!selected}" var="f">
            <apex:column value="{!f.name}"/>
            <apex:column value="{!f.Request_Type__c}"/>
            <apex:column value="{!f.Sample_Size__c}"/>
            <apex:column headerValue="Status">
                <apex:inputField value="{!f.Status__c}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

 



The buttons are added to the appropriate layouts, however, I keep getting the following errors:
1. Invalid variant 'parent': value 'Account'
2. Invalid variant 'parent': value 'Opportunity'

I get error #1 when trying this from the Account page (related list of flavors)
I get error #2 when trying this from the Opportunity page (related list of flavors)

I'm hitting these errors as the System Administrator who wrote the code...

Any feedback/suggestions would greatly be appreciated.

Thanks,
Larry


Message Edited by Legerdemain on 12-04-2008 08:38 PM

Message Edited by Legerdemain on 12-04-2008 08:39 PM
Hi,
Is it possible to define some javascript that runs when a visualforce page loads (not necessarily for the first time)?


Thanks!
Since adobe flex is a client side technology it does not have access to machine's local resources.  For example an adobe flex application cannot open a file on a user's machine and write it to a document object via the salesforce api.  However, adobe flex does have support for uploading files but requires a script (e.g. php) on the other end to accept the file.

Does salesforce.com provide the ability to write a custom script to handle file uploads via a adobe flex application ?
apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

Is it because  POST is required to upload the file ?




Message Edited by devNut! on 11-18-2008 11:30 AM
I am experimenting with the "<apex:inputFile>" tag trying to create a page where the user can upload one file at a time.  The first file upload works but the second one throws the exception:

Here is the scenario:
1) load file upload page
2) select and upload file
3) user is re-directed to the file upload page
4) select and upload file
5) exception: 
Insert failed. First exception on row 0 with id 01530000000henEAAQ; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]


It's like the context is not being reset when the page is refreshed (see return from doSave() below)
Any input is appreciated.


VF Page

Code:
<apex:page standardController="Document" extensions="TestFileUploadControllerExtension" showHeader="false" sidebar="false">
    <apex:messages />
    <apex:form id="theForm">
      <apex:pageBlock >
          <apex:pageBlockSection >
            <apex:inputFile value="{!document.body}" filename="{!document.name}"/>
            <apex:commandButton value="save" action="{!doSave}"/>
          </apex:pageBlockSection>
       </apex:pageBlock>
     
    </apex:form>
</apex:page>

 
Controller Extension
Code:
public class TestFileUploadControllerExtension {

ApexPages.StandardController controller;


public TestFileUploadControllerExtension(ApexPages.StandardController c)
{
System.debug('@@@@@@@@ TestFileUploadControllerExtension');

this.controller = c;

}

public PageReference doSave()
{
System.debug('@@@@@@@@ doSave');

Document d = (Document) controller.getRecord();
System.debug('@@@@@@@@ document name: '+d.name);

d.folderid = UserInfo.getUserId(); //store in Personal Documents
System.debug('@@@@@@@@ document folder id: '+d.folderid);

insert d;
System.debug('@@@@@@@@ document object id: '+d.id);


System.debug('@@@@@@@@ redirect');
PageReference page = new PageReference('/apex/TestFileUpload');
return page;
}




}

 




Message Edited by devNut! on 11-17-2008 12:35 PM
Hi,
I am developing an apex class which is getting fired by a cron toolkit. In this Apex class I am checking for the name of the day for today(Example. Sunday, Monday etc.). I need to perform some database operations in today is the Wednesday. But I am not getting method in date object static and instance methods which will geive me the name of the day for  specified date. Can anyone tell me the syntax of such method. Please note that it should be Apex class method.
Thanks for the help :)
In Application sale, I found Accounts has a data type address.

In my application I also needs a field like that.

But I have no idea how it comes.

Any one know about that?

thank you for you help!
Hi,

When I query sfdc to get a list of users, one user that is returned is "License Manager".

UserName: 033400000004laoaam@00d80000000kvmweaw

Email address: 033400000004LAoAAM@00D80000000KVmWEAW.apx

ProfileId: 00580000001f31UAAQ

First Name: License

Last Name: Manager

I was wondering if anyone else has had this problem? If this is a known issue? And if this user is intentionally exposed?

If it is intentional, does anyone know of a easy way to filter this user out of my query? I only want the users which are in my sfdc UI. 


Thanks,

Alex

  • September 26, 2008
  • Like
  • 0
I've written an Account trigger to create/update a linked Contact record whenever an Account is created/updated.  I want to avoid a duplicate Contact being created when a Lead is converted.  Is there any Apex way to determine if you're in the middle of a Lead conversion so I can tell my trigger not to fire?

Thanks
David