You need to sign in to do that
Don't have an account?

Button controlling field values then laucn a VFP pdf
Hello all,
I need some advice, help on a business requirement.
I will create a new custom button on opportunity object.
After clicking on this button the first step is to control a few fields and validate if they are filled in.
If some fields are empty we have to display a popup (or a VFP page) including error messages about the empty fields. If all the fields are filled in the system will display a VFP rendered as a PDF page.
How can achieve that? Maybe do you have some examples?
Many thanks,
Nuno.
I need some advice, help on a business requirement.
I will create a new custom button on opportunity object.
After clicking on this button the first step is to control a few fields and validate if they are filled in.
If some fields are empty we have to display a popup (or a VFP page) including error messages about the empty fields. If all the fields are filled in the system will display a VFP rendered as a PDF page.
How can achieve that? Maybe do you have some examples?
Many thanks,
Nuno.
If this helps you out, please mark as best answer...
Shawn
var naics = "{!Lead.NAICS_Code__c}";
var sltn = "{!Lead.Solution__c}";
var cmpny = "{!Lead.Company_Channel__c}";
if(naics == ''){
html = '<div id="dialog" style="display: none" title="Error"><p> INSERT ERROR MESSAGE HERE {!$Profile.Name} </p></div>';
dialogBox(html);
}else if(sltn == ''){
html = '<div id="dialog" style="display: none" title="Error"><p>INSERT ERROR MESSAGE HERE </p></div>';
dialogBox(html);
}else if(cmpny == ''){
html = '<div id="dialog" style="display: none" title="Error"><p> INSERT ERROR MESSAGE HERE </p></div>';
dialogBox(html);
}else{
window.location = '/INSERT VF Page HERE.jsp?retURL=%2F{!Lead.Id}&id={!Lead.Id}';
}
function dialogBox(){
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js')}
{!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js')}
var $g = jQuery.noConflict();
$g(function() {
$g('head').append('<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">');
$g('body').append(html);
$g("#dialog").dialog({
dialogClass: "no-close",
autoOpen: true,
buttons: [
{
text: "OK",
click: function() {
$g( this ).dialog( "close" );
}
}
]
});
});
}
Do you know another way to achieve the behaviour?
Shawn