1

I want to display flows in lead object direct button no need to use visualforce pages,i think it is possible in javascript can you please suggest me...

Thanks, Bhaskar

2

Something like this should work. You will obviously have to substitute in your values like your flow name, and the parameters, if any, you want to pass in, but this should get you started.

{!RequireScript("/soap/ajax/29.0/connection.js")}

String base = URL.getSalesforceBaseUrl();
var url = {!base}+encodeURI('/flow/FLOW_NAME&SOME_PARAM={!sObject.Id}&retURL=/{!sObject.Id}');

window.open(url);
| improve this answer | |
  • Shouldn't the code be var url = base+encodeURI(...) without the {}s around base? – Richard Durrant Sep 25 '14 at 11:05
0

It work me fine

{!RequireScript('/soap/ajax/34.0/connection.js')}

var url = encodeURI('/flow/FLOW_NAME?SOME_PARAM={!sObject.Id}&retURL={!sObject.Id}');

window.open(url);
| improve this answer | |
-1

I'm trying to use this and get an error stating the there is no field called Base.. Any ideas what I could be doing wrong?

{!RequireScript("/soap/ajax/29.0/connection.js")}

String base = URL.getSalesforceBaseUrl();
var urlToOpen = {!base}+encodeURI('/flow/Opportunity_Closed_Won_Create_Service_Contract?var_Oppty_Id={!Opportunity.Id}&retURL=/{!Opportunity.Id}');
var Stage = "{!Opportunity.StageName}";
var RecordTypeId = "{!Opportunity.RecordType}";
var WelcomeCallCompleted = "{!Opportunity.Welcome_Call_Completed__c}";

if (Stage ! 'Won') 
{ 
alert('You cannot create a Service Contract unless the Opportunity is 'Won' - please review the Opportunity Stage in order to proceed'); 
} 
else if (Stage == 'Won' && RecordTypeId == '01211000000CxLW') && WelcomeCallCompleted == '')
{ 
alert('You cannot create a Service Contract for a New Customer Opportunity unless the Welcome Call has been completed -  please review the Opportunity Welcome Call field in order to proceed';

}
 else  
 {
  window.open(urlToOpen);
}
| improve this answer | |
  • I did as suggested, and now I'm getting an 'Unexpected Identifier' error..any one can help me? – Marchandoj Sep 28 '14 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.