• dj_saaspoint
  • NEWBIE
  • 0 Points
  • Member since 2009

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

I want to expose some content on a sites VF page. There are some complex business rules to determine which users get access to which content, so I can't use any standard functionality.

 

Here's the VF page

 

<apex:page action="{!showContent}" contentType="application/octet-stream" controller="MyDocsController" showHeader="false" sidebar="false">
<apex:outputText value="{!contentBody}" escape="false"/>
</apex:page>

 

<apex:page action="{!showContent}" contentType="application/octet-stream" controller="MyDocsController" showHeader="false" sidebar="false">

<apex:outputText value="{!contentBody}" escape="false"/>

</apex:page>

 

Here's the relevant part of the controller:

 

 

public pageReference showContent() {

...

ContentVersion theDoc = [select id, VersionData from contentVersion where id = :docId];

contentBody = theDoc.VersionData;

...

 

 

 

When I invoke this page from  .../apex/ShowContent?docId=068... my browser downloads a file called "ShowContent".

The body of this file is the text core.filemanager.FileBlobValue@1e74039

 

I have 2 questions:

1) Is there any way for me to change the file to something sensible, such as the filename in the contentVersion object

2) How can I get at the actual BLOB as a stream of bytes instead of a pointer reference.

 

 

Thanks,

David.

I'm writing a VF page to implement the following business requirement.

 

Allow user to select multiple partner accounts.

For each line item associated with the current opportunity, allow user to enter a percentage split to a partner.

 

If the line items on the current opp are {foo, bar} and the partners selected are {acme, widgetCo} this implies generating a table such as this

 

Partner: acme     Prod   Split %

                                 foo        10

                                 bar         0

 

Partner: widgetCo Prod   Split %

                                 foo        20

                                 bar        25

 

Where split % numbers are entered by the user. I can render it as a datatable inside a datatable, but I the product split information about the partner "acme"

 

How do I do this in VF?

 

 

Message Edited by dj_saaspoint on 10-15-2009 08:13 AM

Hi all-

 

I'm wondering if there is a way to define a proxy in the HTTPRequest methods?  I'm trying to access a web service that requires authentication.  Perhaps I can authenticate using the setHeader? 

 

Here is an example of the service i'm trying to hit... 

 

http://findv3.staging.mappoint.net/Find-30/FindService.asmx?wsdl

 

 

Cheers, 

 

BW

Message Edited by savvyboarder on 04-01-2009 02:46 PM
Hi all,

I am new for Apex development. So please help me out. Any help will be appreciable.
Currently I am using a function in our application in which I am retrieving data from external web services and storing it in Salesforce database. I am calling this function in a ‘for’ loop because this is getting called multiple times based on the selection of checkboxes. At 1st time, this function is working properly but 2nd time, It's giving exception which is as follows:
ERROR: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.

Below is the function which is getting called multiple times:
WebService static void getContent(String id)
{
    String response = '';
    Http h = new Http();
    HttpRequest req = new HttpRequest();
    String url = 'url of the web service';
    req.setEndpoint(url);
    req.setMethod('GET');
    HttpResponse res=null;
    try {
        res= h.send(req);
    } catch(System.CalloutException e) {
    System.debug('ERROR: '+ e);
}

Thanks,
Manjiri