• Matthew Keefe
  • NEWBIE
  • 45 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
When inserting a new Task, AccountId cannot be set because it's set by the system. Is there a way to make sure the system sets it? I've tried setting the WhatId and the WhoId, but the AccountId is still not set after inserting the Task.

Here's some sample code:

System.Savepoint sp = Database.setSavePoint();

User TestOwner = [Select Id from User where Id = :UserInfo.getUserId()];

Account TestAccount = new Account(Name = 'Test Account');
insert TestAccount;

Contact TestContact = new Contact(FirstName='TEST First Name'
    ,LastName='TEST Last Name'
);

TestContact.AccountId = TestAccount.Id;
insert TestContact;

Task NewTask = new Task(Subject='Test Task'
    ,Status='Completed'
    ,ActivityDate=Date.today().addDays(-7)
    ,OwnerId=TestOwner.Id
    ,WhatId=TestAccount.Id
    ,WhoId=TestContact.Id
    //,AccountId=TestAccount.Id
);

insert NewTask;

system.debug('New Task: ' + NewTask);
system.debug('New Task AccountId: ' + NewTask.AccountId);

Database.rollback(sp);

Thanks!
Matt

Does anyone know of a way to break down the "API Requests, Last 24 Hours" listed in the Administrator Setup -> Company Profile -> Company Information. I'm looking for listing them by application or user name.

 

Also, I've searched some for an answer to whether internal Apex code counts as an API Request, please let me know if it does indeed count toward the limit.

 

Thanks!

When inserting a new Task, AccountId cannot be set because it's set by the system. Is there a way to make sure the system sets it? I've tried setting the WhatId and the WhoId, but the AccountId is still not set after inserting the Task.

Here's some sample code:

System.Savepoint sp = Database.setSavePoint();

User TestOwner = [Select Id from User where Id = :UserInfo.getUserId()];

Account TestAccount = new Account(Name = 'Test Account');
insert TestAccount;

Contact TestContact = new Contact(FirstName='TEST First Name'
    ,LastName='TEST Last Name'
);

TestContact.AccountId = TestAccount.Id;
insert TestContact;

Task NewTask = new Task(Subject='Test Task'
    ,Status='Completed'
    ,ActivityDate=Date.today().addDays(-7)
    ,OwnerId=TestOwner.Id
    ,WhatId=TestAccount.Id
    ,WhoId=TestContact.Id
    //,AccountId=TestAccount.Id
);

insert NewTask;

system.debug('New Task: ' + NewTask);
system.debug('New Task AccountId: ' + NewTask.AccountId);

Database.rollback(sp);

Thanks!
Matt

Hi,

 

I have an html input that I would like to pass to my apex controller. How can I have APEX access the value?


Sanitized code below, I am trying to pass the "rep2" field to my controller.

 

Sanatized code here, I'm using JQuery Autocomplete to populate the field.

VF Page:

 

$j(document).ready(function() 
    {
        $j("#rep2" ).autocomplete({
            'source': replist
        });
     });   

<apex:form >
<apex:pageBlock >

   <div class="ui-widget">
    <label for="rep2"><b>Reassign to: </b></label>
    <input id="rep2"/>
   </div>

<apex:pageBlockButtons >
        <apex:commandButton action="{!updateLeadOwner}" value="Save"   rerender="leadtoupdatetable"/>
       </apex:pageBlockButtons>
      </apex:pageBlock>

</apex:form>

 Controller:

public pagereference updateLeadOwner()
    {
        id leadid = ApexPages.currentPage().getParameters().get('id');
        string repname = Apexpages.currentPage().getParameters().get('rep2');
system.debug('-----------------DEBUG-------------');
        system.debug(repname);

 repname return null, what is the best way to access the value?

 

Thanks!

 

-Chris

  • July 29, 2011
  • Like
  • 0

I have found the standalone IDE Installer very difficulty to install. I downloaded the Windows 64-bit installer from http://wiki.developerforce.com/index.php/Force.com_IDE_Installation It was first claiming there was no java virtual machine installed. I reinstalled my Java, being sure to get the 64-bit for IE version and that seemed to help move further along, however when it asked to install to a location other than C:\Program Files (x86), I changed the target directory. This failed (Windows 7 is a bit overprotective of installing there) but worse, I could not change the install target back and now the installer will not execute at all. I copied the error message below.

 

I have installed every version of the Force.com IDE into Eclipse 3.2, 3.3 and 3.4 over the last 3-4 years; I thought I would see how this new application functions since I'm always eager to explore what SFDC is up to. Sadly, the installer is too much of a nuisance to bother with. If it doesn't clear away all obstacles presented by an OS, then you really ought to include a readme.

 

 

!SESSION 2010-08-26 21:41:24.317 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_21
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2010-08-26 21:41:26.845
!MESSAGE Application error
!STACK 1
java.io.IOException: Couldn't get lock for C:\Program Files (x86)\Common\logs/installer-%g.log
at java.util.logging.FileHandler.openFiles(Unknown Source)
at java.util.logging.FileHandler.<init>(Unknown Source)
at com.genuitec.pulse2.client.installer.ui.application.InstallerApplication.start(Unknown Source)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

!SESSION 2010-08-26 21:41:24.317 -----------------------------------------------eclipse.buildId=unknownjava.version=1.6.0_21java.vendor=Sun Microsystems Inc.BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_USCommand-line arguments:  -os win32 -ws win32 -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2010-08-26 21:41:26.845!MESSAGE Application error!STACK 1java.io.IOException: Couldn't get lock for C:\Program Files (x86)\Common\logs/installer-%g.log at java.util.logging.FileHandler.openFiles(Unknown Source) at java.util.logging.FileHandler.<init>(Unknown Source) at com.genuitec.pulse2.client.installer.ui.application.InstallerApplication.start(Unknown Source) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) at org.eclipse.equinox.launcher.Main.main(Main.java:1287)

 

I have no idea if this is the correct forum to post this in as it affects apex, visualforce, and sites. If the url parameter value contains the & symbol all parameters of the URL will be lost. For example:

 

 

PageReference page1 = new PageReference('http://www.test.com/page?name=Anderson And Smith');
system.debug(page1);

OUTPUT: System.PageReference[http://www.test.com/page?name=Anderson+And+Smith]



PageReference page2 = new PageReference('http://www.test.com/page?name=Anderson & Smith'); system.debug(page2); OUTPUT: System.PageReference[http://www.test.com/page]

 

URL encode the & symbol you might say. When I do this the symbol gets double encoded and then this causes issues:

 

 

 

PageReference page3 = new PageReference('http://www.test.com/page?name=Anderson %26 Smith');
system.debug(page3);

OUTPUT: System.PageReference[http://www.test.com/page?name=Anderson+%2526+Smith]

I'm sure part of the issue is that the & symbol is the designated seperator for URL params but there must be a way to adresss this problem, right?

 

Any ideas or solutions?

 

Thanks,

Jason

 

 

Does anyone know of a way to break down the "API Requests, Last 24 Hours" listed in the Administrator Setup -> Company Profile -> Company Information. I'm looking for listing them by application or user name.

 

Also, I've searched some for an answer to whether internal Apex code counts as an API Request, please let me know if it does indeed count toward the limit.

 

Thanks!

Hello,

 

I'm developing error logger for SFDC and im courius is there a way to get current class and method name?

E.g. i want to add in catch exception brackets line:

 

logNewError(currentClassName, currentMethodName, errorDescription).

 

I hope you got my point;)

 

Best Regards,

Lukas