Skip to main content
added 18 characters in body
Source Link
Rao
  • 16.8k
  • 13
  • 69
  • 108

How do I get the server URL from a visual force page?

I am using conga and when I invoke from a button the code it passes the server URL as:

ServerUrl=https%3A%2F%2F***cs9.salesforce.com***%2Fservices....

When I use {!$Action.Partner_Server_URL_210} I get:

ServerUrl=https%3A%2F%2F***c.cs9.visual.force.com***%2Fservices ....

How do I get the actual server URL ?

Can I go ahead and hard code the URL ? Is there any time the Prod server URL would change?

Please let me know!!!

Update : Though I was able to get the params the serverURL and the sessionID in multiple ways,finally I ended up taking a different route I went over conga documentation and ended up taking approach 3 from the conga support page: (Thanks to Andrew) http://knowledge.appextremes.com/appextremes/ext/kb73-how-to-create-a-visualforce-button-to-call-conga-composer

Different approaches I tried : Approach 1: (FAILED)

  1. Session Id and Server URL code was

  2. (FAILED) Controller:

    string href_string{get;set;} string sessionid = userinfo.getsessionID(); string serverurl = URL.getSalesforceBaseUrl().toExternalForm(); href_string = 'https://www.appextremes.com/apps/Conga/Composer.aspx?'+ '\n'+ 'SessionId='+sessionid + '\n'+ '&ServerUrl='+serverurl+ '\n'+ '&Id='+{!someaccountId}+ '\n'+ '&TemplateId='+something_id+ '\n'+ '&FP0=1'+ '\n'+ '&ReportId='+something_id;

Approach 3 : (PASSED)

<apex:commandButton value="Create PDF Quote"
onclick="openConga()"/>
<Script Language="JavaScript">
function openConga() { window.open('{!URLFOR($Action.Account.Conga_Composer_temp,Account_Id)}', '','scrollbars=yes,menubar=no,height=800,width=700,resizable=yes, toolbar=no,location=no,status=yes'); }
</Script>

controller :

public string Account_Id{get;set;}

Account_id = 'query accounts get accountid based on picklist name/Id combination';

I was able to get it done but the grudge of not having found what went wrong with the apexy approach will always remain :(

URL that the button and VF generated were the same except for the session ID ( I doubt that could be the culprit,because the session Id if invalid the page would fail to load ): HERE IS THE COMPARE IT SCRESHOT :

Thanks to all who helped me solve this issue !!!

enter image description here

How do I get the server URL from a visual force page?

I am using conga and when I invoke from a button the code it passes the server URL as:

ServerUrl=https%3A%2F%2F***cs9.salesforce.com***%2Fservices....

When I use {!$Action.Partner_Server_URL_210} I get:

ServerUrl=https%3A%2F%2F***c.cs9.visual.force.com***%2Fservices ....

How do I get the actual server URL ?

Can I go ahead and hard code the URL ? Is there any time the Prod server URL would change?

Please let me know!!!

Update : Though I was able to get the params the serverURL and the sessionID in multiple ways,finally I ended up taking a different route I went over conga documentation and ended up taking approach 3 from the conga support page: http://knowledge.appextremes.com/appextremes/ext/kb73-how-to-create-a-visualforce-button-to-call-conga-composer

Different approaches I tried : Approach 1: (FAILED)

  1. Session Id and Server URL code was

  2. (FAILED) Controller:

    string href_string{get;set;} string sessionid = userinfo.getsessionID(); string serverurl = URL.getSalesforceBaseUrl().toExternalForm(); href_string = 'https://www.appextremes.com/apps/Conga/Composer.aspx?'+ '\n'+ 'SessionId='+sessionid + '\n'+ '&ServerUrl='+serverurl+ '\n'+ '&Id='+{!someaccountId}+ '\n'+ '&TemplateId='+something_id+ '\n'+ '&FP0=1'+ '\n'+ '&ReportId='+something_id;

Approach 3 : (PASSED)

<apex:commandButton value="Create PDF Quote"
onclick="openConga()"/>
<Script Language="JavaScript">
function openConga() { window.open('{!URLFOR($Action.Account.Conga_Composer_temp,Account_Id)}', '','scrollbars=yes,menubar=no,height=800,width=700,resizable=yes, toolbar=no,location=no,status=yes'); }
</Script>

controller :

public string Account_Id{get;set;}

Account_id = 'query accounts get accountid based on picklist name/Id combination';

I was able to get it done but the grudge of not having found what went wrong will always remain :(

URL that the button and VF generated were the same except for the session ID ( I doubt that could be the culprit,because the session Id if invalid the page would fail to load ): HERE IS THE COMPARE IT SCRESHOT :

Thanks to all who helped me solve this issue !!!

enter image description here

How do I get the server URL from a visual force page?

I am using conga and when I invoke from a button the code it passes the server URL as:

ServerUrl=https%3A%2F%2F***cs9.salesforce.com***%2Fservices....

When I use {!$Action.Partner_Server_URL_210} I get:

ServerUrl=https%3A%2F%2F***c.cs9.visual.force.com***%2Fservices ....

How do I get the actual server URL ?

Can I go ahead and hard code the URL ? Is there any time the Prod server URL would change?

Please let me know!!!

Update : Though I was able to get the params the serverURL and the sessionID in multiple ways,finally I ended up taking a different route I went over conga documentation and ended up taking approach 3 from the conga support page: (Thanks to Andrew) http://knowledge.appextremes.com/appextremes/ext/kb73-how-to-create-a-visualforce-button-to-call-conga-composer

Different approaches I tried : Approach 1: (FAILED)

  1. Session Id and Server URL code was

  2. (FAILED) Controller:

    string href_string{get;set;} string sessionid = userinfo.getsessionID(); string serverurl = URL.getSalesforceBaseUrl().toExternalForm(); href_string = 'https://www.appextremes.com/apps/Conga/Composer.aspx?'+ '\n'+ 'SessionId='+sessionid + '\n'+ '&ServerUrl='+serverurl+ '\n'+ '&Id='+{!someaccountId}+ '\n'+ '&TemplateId='+something_id+ '\n'+ '&FP0=1'+ '\n'+ '&ReportId='+something_id;

Approach 3 : (PASSED)

<apex:commandButton value="Create PDF Quote"
onclick="openConga()"/>
<Script Language="JavaScript">
function openConga() { window.open('{!URLFOR($Action.Account.Conga_Composer_temp,Account_Id)}', '','scrollbars=yes,menubar=no,height=800,width=700,resizable=yes, toolbar=no,location=no,status=yes'); }
</Script>

controller :

public string Account_Id{get;set;}

Account_id = 'query accounts get accountid based on picklist name/Id combination';

I was able to get it done but the grudge of not having found what went wrong with the apexy approach will always remain :(

URL that the button and VF generated were the same except for the session ID ( I doubt that could be the culprit,because the session Id if invalid the page would fail to load ): HERE IS THE COMPARE IT SCRESHOT :

Thanks to all who helped me solve this issue !!!

enter image description here

added 2133 characters in body
Source Link
Rao
  • 16.8k
  • 13
  • 69
  • 108

How do I get the server URL from a visual force page?

I am using conga and when I invoke from a button the code it passes the server URL as:

ServerUrl=https%3A%2F%2F***cs9.salesforce.com***%2Fservices....

When I use {!$Action.Partner_Server_URL_210} I get:

ServerUrl=https%3A%2F%2F***c.cs9.visual.force.com***%2Fservices ....

How do I get the actual server URL ?

Can I go ahead and hard code the URL ? Is there any time the Prod server URL would change?

Please let me know!!!

Update : Though I was able to get the params the serverURL and the sessionID in multiple ways,finally I ended up taking a different route I went over conga documentation and ended up taking approach 3 from the conga support page: http://knowledge.appextremes.com/appextremes/ext/kb73-how-to-create-a-visualforce-button-to-call-conga-composer

Different approaches I tried : Approach 1: (FAILED)

  1. Session Id and Server URL code was

  2. (FAILED) Controller:

    string href_string{get;set;} string sessionid = userinfo.getsessionID(); string serverurl = URL.getSalesforceBaseUrl().toExternalForm(); href_string = 'https://www.appextremes.com/apps/Conga/Composer.aspx?'+ '\n'+ 'SessionId='+sessionid + '\n'+ '&ServerUrl='+serverurl+ '\n'+ '&Id='+{!someaccountId}+ '\n'+ '&TemplateId='+something_id+ '\n'+ '&FP0=1'+ '\n'+ '&ReportId='+something_id;

Approach 3 : (PASSED)

<apex:commandButton value="Create PDF Quote"
onclick="openConga()"/>
<Script Language="JavaScript">
function openConga() { window.open('{!URLFOR($Action.Account.Conga_Composer_temp,Account_Id)}', '','scrollbars=yes,menubar=no,height=800,width=700,resizable=yes, toolbar=no,location=no,status=yes'); }
</Script>

controller :

public string Account_Id{get;set;}

Account_id = 'query accounts get accountid based on picklist name/Id combination';

I was able to get it done but the grudge of not having found what went wrong will always remain :(

URL that the button and VF generated were the same except for the session ID ( I doubt that could be the culprit,because the session Id if invalid the page would fail to load ): HERE IS THE COMPARE IT SCRESHOT :

Thanks to all who helped me solve this issue !!!

enter image description here

How do I get the server URL from a visual force page?

I am using conga and when I invoke from a button the code it passes the server URL as:

ServerUrl=https%3A%2F%2F***cs9.salesforce.com***%2Fservices....

When I use {!$Action.Partner_Server_URL_210} I get:

ServerUrl=https%3A%2F%2F***c.cs9.visual.force.com***%2Fservices ....

How do I get the actual server URL ?

Can I go ahead and hard code the URL ? Is there any time the Prod server URL would change?

Please let me know!!!

How do I get the server URL from a visual force page?

I am using conga and when I invoke from a button the code it passes the server URL as:

ServerUrl=https%3A%2F%2F***cs9.salesforce.com***%2Fservices....

When I use {!$Action.Partner_Server_URL_210} I get:

ServerUrl=https%3A%2F%2F***c.cs9.visual.force.com***%2Fservices ....

How do I get the actual server URL ?

Can I go ahead and hard code the URL ? Is there any time the Prod server URL would change?

Please let me know!!!

Update : Though I was able to get the params the serverURL and the sessionID in multiple ways,finally I ended up taking a different route I went over conga documentation and ended up taking approach 3 from the conga support page: http://knowledge.appextremes.com/appextremes/ext/kb73-how-to-create-a-visualforce-button-to-call-conga-composer

Different approaches I tried : Approach 1: (FAILED)

  1. Session Id and Server URL code was

  2. (FAILED) Controller:

    string href_string{get;set;} string sessionid = userinfo.getsessionID(); string serverurl = URL.getSalesforceBaseUrl().toExternalForm(); href_string = 'https://www.appextremes.com/apps/Conga/Composer.aspx?'+ '\n'+ 'SessionId='+sessionid + '\n'+ '&ServerUrl='+serverurl+ '\n'+ '&Id='+{!someaccountId}+ '\n'+ '&TemplateId='+something_id+ '\n'+ '&FP0=1'+ '\n'+ '&ReportId='+something_id;

Approach 3 : (PASSED)

<apex:commandButton value="Create PDF Quote"
onclick="openConga()"/>
<Script Language="JavaScript">
function openConga() { window.open('{!URLFOR($Action.Account.Conga_Composer_temp,Account_Id)}', '','scrollbars=yes,menubar=no,height=800,width=700,resizable=yes, toolbar=no,location=no,status=yes'); }
</Script>

controller :

public string Account_Id{get;set;}

Account_id = 'query accounts get accountid based on picklist name/Id combination';

I was able to get it done but the grudge of not having found what went wrong will always remain :(

URL that the button and VF generated were the same except for the session ID ( I doubt that could be the culprit,because the session Id if invalid the page would fail to load ): HERE IS THE COMPARE IT SCRESHOT :

Thanks to all who helped me solve this issue !!!

enter image description here

Tweeted twitter.com/#!/StackSalesforce/status/268575379495723008
Source Link
Rao
  • 16.8k
  • 13
  • 69
  • 108

serverurl and visualforce

How do I get the server URL from a visual force page?

I am using conga and when I invoke from a button the code it passes the server URL as:

ServerUrl=https%3A%2F%2F***cs9.salesforce.com***%2Fservices....

When I use {!$Action.Partner_Server_URL_210} I get:

ServerUrl=https%3A%2F%2F***c.cs9.visual.force.com***%2Fservices ....

How do I get the actual server URL ?

Can I go ahead and hard code the URL ? Is there any time the Prod server URL would change?

Please let me know!!!