• yogesh goad
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 10
    Replies
Is it possible any how to make a custom object record undergo approval process before inserting it to object.
i get the following error while saving the below code in a apex class.
Error: Compile Error: Invalid type: ReadResult at line 5 column 9
 
public with sharing class MetadataController {
public void readCustomObjectSync() {
    try {
        ReadResult readResult = metadataConnection
                .readMetadata('CustomObject', new String[] {
                        'MyCustomObject1__c', 'MyCustomObject2__c' });
        Metadata[] mdInfo = readResult.getRecords();
        System.debug('Number of component info returned: '
                + mdInfo.length);
        for (Metadata md : mdInfo) {
            if (md != null) {
                CustomObject obj = (CustomObject) md;
                System.debug('Custom object full name: '
                        + obj.getFullName());
                System.debug('Label: ' + obj.getLabel());
                System.debug('Number of custom fields: '
                        + obj.getFields().length);
                System.debug('Sharing model: '
                        + obj.getSharingModel());
            } else {
                System.debug('Empty metadata.');
            }
        }
    } catch (ConnectionException ce) {
        ce.printStackTrace();
    }
 }
}

 
my question is, is there any way to create a apex class which fetches the details of validations ,datatypes and other info. of the fields related to a particular custom object and display them in a visual force page.
I am able to upload and retrieve the list of attachments to my custom object in a table.
clicking on the attachment id in the table takes me to the page in the below image.

 User-added image

 The problem is with the "Viewfile" link on this page. it downloads the uploaded file without extension instead of displaying it in  browser.
Is there a problem with my browser or its a problem with salesforce.

This same link works fine with Documents but size constraint does'nt allow to upload files larger than 5 mb with Document object.

The "viewfile" link with which i have problems was working previously for other users . i was suggested to use the above link to display pdf attachment on the browser by previos users. here is something which i came through searching for a solution to my problem and the pictures show it worked fine for him.http://salesforce.stackexchange.com/questions/28268/rendering-attachment-on-visualforce-page
i have uploaded a pdf file using document object in salesforce. i am using the below code to display that file in a pop up window in my browser. my requirement is to show only the first two pages of that file and not the whole document in the browser.

<apex:repeat var="dc" value="{!details}">
  <tr>
  <td><a target="_blank" href="https://c.ap1.content.force.com/servlet/servlet.FileDownload?file={!dc.id}" onclick="return windowpop(this.href, 545, 433)"> {!dc.Name} </a></td>
    <td>{!dc.Type}</td>
  </tr> </apex:repeat>
I am able to upload and retrieve the attachments to my custom object in a table.
clicking on the attachment id takes me to the page in the below image.User-added image

The problem is with the "Viewfile" link on this page. it downloads the uploaded file without extension instead of displaying it in  browser.
Is there a problem with my browser or its a problem with salesforce.

This same link works fine with Documents but size constraint does'nt allow to upload files larger than 5 mb with Document.
Is it possible any how to make a custom object record undergo approval process before inserting it to object.
i get the following error while saving the below code in a apex class.
Error: Compile Error: Invalid type: ReadResult at line 5 column 9
 
public with sharing class MetadataController {
public void readCustomObjectSync() {
    try {
        ReadResult readResult = metadataConnection
                .readMetadata('CustomObject', new String[] {
                        'MyCustomObject1__c', 'MyCustomObject2__c' });
        Metadata[] mdInfo = readResult.getRecords();
        System.debug('Number of component info returned: '
                + mdInfo.length);
        for (Metadata md : mdInfo) {
            if (md != null) {
                CustomObject obj = (CustomObject) md;
                System.debug('Custom object full name: '
                        + obj.getFullName());
                System.debug('Label: ' + obj.getLabel());
                System.debug('Number of custom fields: '
                        + obj.getFields().length);
                System.debug('Sharing model: '
                        + obj.getSharingModel());
            } else {
                System.debug('Empty metadata.');
            }
        }
    } catch (ConnectionException ce) {
        ce.printStackTrace();
    }
 }
}

 
I am able to upload and retrieve the list of attachments to my custom object in a table.
clicking on the attachment id in the table takes me to the page in the below image.

 User-added image

 The problem is with the "Viewfile" link on this page. it downloads the uploaded file without extension instead of displaying it in  browser.
Is there a problem with my browser or its a problem with salesforce.

This same link works fine with Documents but size constraint does'nt allow to upload files larger than 5 mb with Document object.

The "viewfile" link with which i have problems was working previously for other users . i was suggested to use the above link to display pdf attachment on the browser by previos users. here is something which i came through searching for a solution to my problem and the pictures show it worked fine for him.http://salesforce.stackexchange.com/questions/28268/rendering-attachment-on-visualforce-page
i have uploaded a pdf file using document object in salesforce. i am using the below code to display that file in a pop up window in my browser. my requirement is to show only the first two pages of that file and not the whole document in the browser.

<apex:repeat var="dc" value="{!details}">
  <tr>
  <td><a target="_blank" href="https://c.ap1.content.force.com/servlet/servlet.FileDownload?file={!dc.id}" onclick="return windowpop(this.href, 545, 433)"> {!dc.Name} </a></td>
    <td>{!dc.Type}</td>
  </tr> </apex:repeat>
I am able to upload and retrieve the attachments to my custom object in a table.
clicking on the attachment id takes me to the page in the below image.User-added image

The problem is with the "Viewfile" link on this page. it downloads the uploaded file without extension instead of displaying it in  browser.
Is there a problem with my browser or its a problem with salesforce.

This same link works fine with Documents but size constraint does'nt allow to upload files larger than 5 mb with Document.
Hi there,
 
I Save my email attachment(a smal pdf file) into the attachment object, now i want to display the attachment body in my VisualForce Page,
 
<apex: outputfield value="{!Attachment.Body}" /> Not works coz it is base64 field...
 
 
 
any way to display the pdf file in my page? any code example of that, like 's-control' or something
 
 
Thanks in advance
 


Message Edited by Feng on 05-25-2008 05:09 PM
  • May 25, 2008
  • Like
  • 0