I have a custom button that displays an alert message when some fields on my object are missing. I would like to now also display the fields that are missing as part of that alert. I tried the code below, but it only shows the last field missing. How can I get the 1st alert along with any of the other alerts that are applicable? For example, I would want the alert to read:
Please complete the Approval Request Information section before submitting this Quote for approval. The following fields are missing:
Missing Offer Scope Missing Justification for Discounting
Javascript Button:
{!RequireScript("/soap/ajax/38.0/connection.js")}
if('{!SBQQ__Quote__c.Offer_Scope__c }' == '' || '{! SBQQ__Quote__c.Justification_for_Discounting__c}' == '' || '{! SBQQ__Quote__c.Client_Background__c }' == '' || '{! SBQQ__Quote__c.Non_Standard_Terms__c }' == '' )
{
alert('Please complete the Approval Request Information section before submitting this Quote for approval. The following fields are missing:');
/* if('{!SBQQ__Quote__c.Offer_Scope__c }' == ''){
alert('Missing Offer Scope');
}
if('{!SBQQ__Quote__c.Justification_for_Discounting__c }' == ''){
alert('Missing Justification for Discounting');
}
if('{!SBQQ__Quote__c.Client_Background__c }' == ''){
alert('Missing Client Background');
}
if('{!SBQQ__Quote__c.Non_Standard_Terms__c }' == ''){
alert('Missing Non-Standard Terms Indicator');
}*/
}
else {
window.top.location.href = "{!URLFOR($Action.SBQQ__Quote__c.Submit, SBQQ__Quote__c.Id )}";
}