• Andrew Day
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hey Guys,

I hope spmepne can help, we have developed a visual force page the allows users to upload and image crop it then we save it as an attachment and this seems to work well.
 
public PageReference SaveImage() 
    {    
        
        System.debug('>>>> Start: SaveImage');
        
		DELETE [SELECT Id FROM Attachment WHERE parentId =:CurrentStudentBio.Id and Name = 'ProfileImage.png'];  
         
        //Attachment
        Attachment attachment = new Attachment();
 		attachment.Body = Encodingutil.base64Decode(imageData.substring(imageData.indexOf(',') + 1));
        attachment.ContentType='image/png';
  		attachment.Name = 'ProfileImage.png';
  		attachment.ParentId = CurrentStudentBio.Id;
  		insert attachment;
        
        System.debug('>>>> End: SaveImage');
        
        return new PageReference('/apex/StudentBio');   
        
}
I am certin this is working correctly as we are able to display this image back to the user on another page using
<apex:image url="/servlet/servlet.FileDownload?file={!BioImage}" style="visibility: {!If(BioImage == null, "hidden", "visible") }"/>
with no issues.

The problem I am now having is when I try and retrive the image using the Rest API i keep getting this error:

{"The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "}

This is what my query looks like
await client.QueryAsync<sforce.Attachment>("select ParentId, Body, ContentType FROM Attachment WHERE ParentId IN ('a2118000000O56a') AND Name = 'ProfileImage.png'");
I am not sure why I am getting this error I can only think the issue is when I save the image but salesforce has no issues displaying it, any help would be appreciated.

Thanks






 
Hey guys,

I want to run a report and get the results server side in c#, but I am not sure how. Has anyone done this?

I maybe wrong here but it sound like I can do this with the analytics API but not sure how.

Does anyone have an example of this?or and idea's?

I was reading that you can access the analytics api via the apex api? but not surte how.

Hey Guys,

I am try to put together my first vf page and I have a question.

The page I am creating is a page where the user can select some contacts from the contact page then pust a button called 'Create Event' that will take then to a page where that can fill out the event info and the selected contacts will be assigned then saved.

So right now I have a button then when clicked will take them to the new page with the selected Id's in the URL.

ex:  &type=whoid&Ids=003e000000IidjU%2C003e000000Iidji%2C003e000000HkFlA

I would like to display a list of the selected contacts in the new page but I am not sure how to get a list a contact objects form the Id's in the URL.

Here is my event page: (note: this is just a start)

<apex:page standardController="Event" extensions="CreateEvent_Controller" >
  <h1>Create Event With Selected Contacts</h1>
  <apex:sectionHeader title="Event" subtitle="New Event" help="/help/doc/user_ed.jsp?loc=help&target=creating_tasks.htm&section=Activities"/>
 <apex:form >
     <apex:pageMessages ></apex:pageMessages>
     <apex:pageBlock title="Event Edit"  mode="edit">
         <apex:pageBlockSection columns="1" title="Event Information"  >
        
                <apex:inputField value="{!Event.Subject}" />
                <apex:inputField value="{!Event.Location}" />
                <apex:inputField value="{!Event.StartDateTime}" />
                <apex:inputField value="{!Event.EndDateTime}" />
               
         </apex:pageBlockSection>
        
         <apex:pageBlockSection columns="1" title="Description Information" >
                 <apex:inputTextarea value="{!Event.Description}" cols="75" rows="5" richText="false"/>
         </apex:pageBlockSection>
        
         <apex:pageBlockSection columns="1" title="Description Information" >
            <apex:dataList value="{!contacts}" var="contact">
                <apex:outputText value="{!contact.Name}"/>
            </apex:dataList>
         </apex:pageBlockSection>  
           
         <apex:pageBlockButtons >
             <apex:commandButton value="Save" action="{!save}" immediate="true" />
             <apex:commandButton value="Cancel" action="{!cancel}" immediate="true" />
         </apex:pageBlockButtons>
     </apex:pageBlock>
    
 </apex:form>
</apex:page>

And here in my controller:

public with sharing class CreateEvent_Controller
{

   
    public ApexPages.StandardController myUserController {get; set;}
    public List<Contact> contacts {get; set;}


    public ApexPages.StandardController standardContactController;
   
    public CreateEvent_Controller(ApexPages.StandardController cntrl)
    {
   
        standardContactController = cntrl;
       
        /*contacts = (Contact)cntrl.getRecord();*/
   
    }
   
}

Any help on how to get the contact object list would be great, and any overall suggestions after that would be helpfull






Hey Guys,

I am try to put together my first vf page and I have a question.

The page I am creating is a page where the user can select some contacts from the contact page then pust a button called 'Create Event' that will take then to a page where that can fill out the event info and the selected contacts will be assigned then saved.

So right now I have a button then when clicked will take them to the new page with the selected Id's in the URL.

ex:  &type=whoid&Ids=003e000000IidjU%2C003e000000Iidji%2C003e000000HkFlA

I would like to display a list of the selected contacts in the new page but I am not sure how to get a list a contact objects form the Id's in the URL.

Here is my event page: (note: this is just a start)

<apex:page standardController="Event" extensions="CreateEvent_Controller" >
  <h1>Create Event With Selected Contacts</h1>
  <apex:sectionHeader title="Event" subtitle="New Event" help="/help/doc/user_ed.jsp?loc=help&target=creating_tasks.htm&section=Activities"/>
 <apex:form >
     <apex:pageMessages ></apex:pageMessages>
     <apex:pageBlock title="Event Edit"  mode="edit">
         <apex:pageBlockSection columns="1" title="Event Information"  >
        
                <apex:inputField value="{!Event.Subject}" />
                <apex:inputField value="{!Event.Location}" />
                <apex:inputField value="{!Event.StartDateTime}" />
                <apex:inputField value="{!Event.EndDateTime}" />
               
         </apex:pageBlockSection>
        
         <apex:pageBlockSection columns="1" title="Description Information" >
                 <apex:inputTextarea value="{!Event.Description}" cols="75" rows="5" richText="false"/>
         </apex:pageBlockSection>
        
         <apex:pageBlockSection columns="1" title="Description Information" >
            <apex:dataList value="{!contacts}" var="contact">
                <apex:outputText value="{!contact.Name}"/>
            </apex:dataList>
         </apex:pageBlockSection>  
           
         <apex:pageBlockButtons >
             <apex:commandButton value="Save" action="{!save}" immediate="true" />
             <apex:commandButton value="Cancel" action="{!cancel}" immediate="true" />
         </apex:pageBlockButtons>
     </apex:pageBlock>
    
 </apex:form>
</apex:page>

And here in my controller:

public with sharing class CreateEvent_Controller
{

   
    public ApexPages.StandardController myUserController {get; set;}
    public List<Contact> contacts {get; set;}


    public ApexPages.StandardController standardContactController;
   
    public CreateEvent_Controller(ApexPages.StandardController cntrl)
    {
   
        standardContactController = cntrl;
       
        /*contacts = (Contact)cntrl.getRecord();*/
   
    }
   
}

Any help on how to get the contact object list would be great, and any overall suggestions after that would be helpfull