• dkccraig
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hi all,

 

I am trying to upload a file as a Document with apex.

 

Let's say I have a 3 second video clip on my hard drive at "/Users/MyUserName/Desktop/test.avi" and I want to upload this file as a Document.  I have the following code to do so:

 

Document d = new Document;

d.Name = 'Test Video';

d.Body = Blob.valueOf('/Users/MyUserName/Desktop/Test.avi');

d.FolderID = ...; //A valid folder id

insert d;

 

Unfortunately it just sets the body to the blob "/Users/MyUserName/Desktop/test.avi" instead of uploading the file at that path.  What am I doing wrong?

Hi all,

 

I have a standalone Flex app, e.g. not embedded in a VF page.

 

I can log into a non-sandbox org, but I cannot seem to log into a sandbox org.

 

I have tried changing the LoginRequest.server_url property to "https://test.salesforce.com" and "http://cs2.salesforce.com" with no luck, and I also tried changing xmlns:salesforce= to both of these values as well.

 

How is this meant to be attained? 

 

Thanks!

Hello,

 

I am trying to create a lookup field without using a standardController.  

 

Inside my VF Page I have the following:

 

 

<apex:inputField id="acctField" value="{!acct.Id}" />

 

Inside my custom controller I have the following:

 

 

... Account acct; ... public Account getAcct() {return acct;} public void setAccount(Account acct) {this.acct = acct;}

 

 But I get an error:

Unable to Access Page Invalid parameter value "" for parameter "id". Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information.

 


 

 

Any ideas?

 

 

Hi

 

I am trying to do something very simple, but it seems simple things are difficult with APEX.  Or I am completely not understanding.  Probably the latter.

 

I have a Custom Object named Junction Object with an Account as the detail in a master detail relationship.

 

On a trigger ALL i am trying to do is set the Account's website name to www.google.com.

 

I wrote the following code to do so:

 

trigger InsertionTrigger on Junction_Object__c (before insert)
{
  for(Junction_Object__c jo: Trigger.new)
  {
      jo.Account__r.Website = 'www.google.com';
  }
}

 

Ok, this code seems straightforward.  So I go and create a Junction Object tab and then using the tab I try to create a new Junction Object.  So I insert the required fields for the new Junction Object and hit "save".  Well it tells you that you cannot de-reference a null value.  How can Account__r be null if I just inserted data for it? 

 

I don't get it.  Time to continue banging my head against the desk.

I have a custom object with an Account setup as the detail in a master-detail relationship where the custom object is the master.

 

All I am trying to do is access the Account from the Custom Object.

 

How come I cannot just say CustomObject.Account?

Should I be using a query instead?

If I am going to use a query do I need to create a foreign key in the Account to link to the proper CustomObject?

 

Thanks in advance.

Hi

 

I am trying to do something very simple, but it seems simple things are difficult with APEX.  Or I am completely not understanding.  Probably the latter.

 

I have a Custom Object named Junction Object with an Account as the detail in a master detail relationship.

 

On a trigger ALL i am trying to do is set the Account's website name to www.google.com.

 

I wrote the following code to do so:

 

trigger InsertionTrigger on Junction_Object__c (before insert)
{
  for(Junction_Object__c jo: Trigger.new)
  {
      jo.Account__r.Website = 'www.google.com';
  }
}

 

Ok, this code seems straightforward.  So I go and create a Junction Object tab and then using the tab I try to create a new Junction Object.  So I insert the required fields for the new Junction Object and hit "save".  Well it tells you that you cannot de-reference a null value.  How can Account__r be null if I just inserted data for it? 

 

I don't get it.  Time to continue banging my head against the desk.

I have a custom object with an Account setup as the detail in a master-detail relationship where the custom object is the master.

 

All I am trying to do is access the Account from the Custom Object.

 

How come I cannot just say CustomObject.Account?

Should I be using a query instead?

If I am going to use a query do I need to create a foreign key in the Account to link to the proper CustomObject?

 

Thanks in advance.