function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hideawayguyhideawayguy 

pass variables to home page component

hello,

 

is there anyway to pass variables to a home page component from data on the usr record? or from a url? i'm have an iframe on a home page component that displays an s control that displays a calendar for a certain group, and based on which group it needs a different id in the url for the iframe to render the proper data. 

 

thank you.

 

dustin

Best Answer chosen by Admin (Salesforce Developers) 
Arun MKArun MK

Hi,

 

You cannot pass variables. But What you can do is, using javascript u can query the desured values from the user record.

 

Find the sample code below. You can use this in your page component.

 

<SCRIPT type=text/javascript src="/soap/ajax/28.0/connection.js"></SCRIPT>

 

<SCRIPT type=text/javascript>

function getProfileId(){

    sforce.connection.sessionId = window.ApiUtils.getSessionId();

    sforce.connection.query(

                            "SELECT ProfileId FROM User WHERE Id = '" + window.UserContext.userId + "'",

                            {

                            onSuccess:

                                function(result){

                                    document.getElementById('lblProfileId').innerHTML = result.records.ProfileId;

                                    var profId= result.records.ProfileId;

                                    alert('Profile Id: ' + profId);

                                },

                            onFailure:

                                function(){ 

                                    document.getElementById('lblProfileId').innerHTML = '#ERROR'

                                } 

                            } 

                            ); 

 

getProfileId(); 

</SCRIPT>

 

Regards,

Arun

All Answers

Arun MKArun MK

Hi,

 

You cannot pass variables. But What you can do is, using javascript u can query the desured values from the user record.

 

Find the sample code below. You can use this in your page component.

 

<SCRIPT type=text/javascript src="/soap/ajax/28.0/connection.js"></SCRIPT>

 

<SCRIPT type=text/javascript>

function getProfileId(){

    sforce.connection.sessionId = window.ApiUtils.getSessionId();

    sforce.connection.query(

                            "SELECT ProfileId FROM User WHERE Id = '" + window.UserContext.userId + "'",

                            {

                            onSuccess:

                                function(result){

                                    document.getElementById('lblProfileId').innerHTML = result.records.ProfileId;

                                    var profId= result.records.ProfileId;

                                    alert('Profile Id: ' + profId);

                                },

                            onFailure:

                                function(){ 

                                    document.getElementById('lblProfileId').innerHTML = '#ERROR'

                                } 

                            } 

                            ); 

 

getProfileId(); 

</SCRIPT>

 

Regards,

Arun

This was selected as the best answer
hideawayguyhideawayguy

thank you very much arun, i'll give it a shot...

 

dustin