I have a one click javascript custom button on my opportunity page and I want to add that button on salesforce1. Please help to add this button urgently.
ONE CLICK JAVASCRIPT code of that button is as follows:-
{!REQUIRESCRIPT("/soap/ajax/23.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/23.0/apex.js")}
var cOpp = new sforce.SObject("Opportunity");
var QuoteRecord = sforce.connection.query("Select Opportunity__c,Id From Opportunity_Product__c where Opportunity__c='{!Opportunity.Id}'");
var records = QuoteRecord.getArray("records");
cOpp.Sales_Area__c = "{!Opportunity.Sales_Area__c}";
cOpp.NPD_Required__c = "{!Opportunity.NPD_Required__c}";
if(records[0] != null)
{
if(!((cOpp.Sales_Area__c == null) || (cOpp.Sales_Area__c == ''))){
if((cOpp.NPD_Required__c == true) || (cOpp.NPD_Required__c == 'true'))
window.open('apex/sendInquirytoSAP?id={!Opportunity.Id}&rNPD=1&scontrolCaching=1','_self');
else
window.open('apex/sendInquirytoSAP?id={!Opportunity.Id}&rNPD=0&scontrolCaching=1','_self');
}
else
alert('Before trigger to SAP, Please select a SalesArea first.');
}
else
{
alert('You cannot send Opportunity to SAP as no Opportunity Product is associated with it');
}