• pintu francis qburst
  • NEWBIE
  • 0 Points
  • Member since 2013

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

I need to get Current Logged in User 'Name' in the Homepage component.

I tried creating a VF page and included through an IFRAME in Home Page Component and successfully got result. But I don't prefer using this method coz using IFRAMES is not so appreciated.

 

I thought of creating an Apex Webservice to pull the required info, but some issue.

 

Apex Class:

global class myClass{ 
   webService static String getContextUserName() {
       System.debug('@@@'+UserInfo.getFirstName());
        return UserInfo.getFirstName();
   }
}

 Home Page Component:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"> </script> 
<script src="/soap/ajax/19.0/connection.js" type="text/javascript"> </script> <script src="/soap/ajax/15.0/apex.js" type="text/javascript"> </script> <script> $(document).ready(function(){ var contextUser = sforce.apex.execute("myClass","getContextUserName",{});
alert(contextUser); }); </script>

 

But I got the following errors in Firebug

 

"NetworkError: 500 Server Error - https://ap1.salesforce.com/services/Soap/package/myClass"

 

uncaught exception: {faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', }

 


Thanks,

Pintu Francis

I am trying to pass a string representing a data category to a controller and then filter my SOQL query for knowledge based on that.

 

Ideally I would like to do something like:

 

 

    public String release { get; set; }
    
    public List<FAQ__kav> getFAQsForRelease()
    {
        List<FAQ__kav> faqlist = [select id, Title, Answer__c from FAQ__kav WHERE PublishStatus = 'Online' WITH DATA CATEGORY Releases__c ABOVE release];  
        return faqlist;
    }

 

but I can't figure out if there is any possible way to convert the string object 'release' into an datacategory type. Maybe a helper function or something?

 

I realize a big block of if / else if statements would do the trick, but I am hoping there is a cleaner solution. Thanks in advance.

  • April 20, 2010
  • Like
  • 0

Hopefully I'm missing something really simple here. I created a "Home Page Component" with the following body:

 

 

<iframe src="/apex/test" width="100%" frameborder="0" height="100"></iframe>

 

 

Where "test" is my VisualForce page. When I configure this to display on my home page, I see the source code as opposed to my VF page? Any help is greatly appreciated!

 

Regards

Hello,

I have a visual force custom search developed, can I use it a home page component.

Here is the simple code for my Visual Force page and I want this to be a homepage component.

Code:
<apex:page showHeader="false" controller="quichSeachController">
<apex:form target="_top"> 
<apex:panelGrid columns="2" style="width:100%;height:100%;background:#e8e8e8"> 
<apex:outputLabel value="SSN" for="SSN"/> 
<input id="ssn" name="ssn" size="10" /> 
<apex:outputLabel value="DOB" for="DOB"/>
<input id="dob" name="dob" size="10" /> 
<apex:outputLabel value="TN" for="TN"/> 
<input id="tn" name="tn" size="10" /> 
<apex:commandButton action="{!go}"  value="Go!" styleClass="btn"/> 
</apex:panelGrid> 
</apex:form>
</apex:page>

I currently embed it using an iframe here is the code for that:
Code:
<P><IFRAME style="Z-INDEX: 220; WIDTH: 179px; 
POSITION: relative; HEIGHT: 100px" src="/apex/QuickSearch" 
frameBorder=0 scrolling=no target="_top">
</IFRAM><P></IFRAME></P>

 However I don't want to do that as it would make the page loading slower as this would load separately from the main page.

Any advice will be greatly appreciated.

Regards,
Girish Suravajhula.