In short, IF a field is TRUE then the button should create a new Quote (CPQ) record like it would when using the default button. When false it shoudl open a visual workflow I am putting together. I'm definately struggling with the javascript element to create a new Quote record. Heres what I have so far (which isnt working):
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
{!IF( Opportunity.Customer_PO__c = 1,
var records = sforce.connection.query("SELECT Id, FROM Opportunity Where id = '{!Opportunity.Id}'";
var newQuote = new sforce.SObject("Quote");
newQuote.SBQQ__Opportunity2__c = "{!SBQQ__Quote__c.SBQQ__Opportunity2__c};
,https://thomsons--uat.cs84.my.salesforce.com/flow/Opp_Flow?varOppid={!Opportunity.Id}&varNCountries={!Opportunity.Number_of_Countries__c}&varNofusers={!Opportunity.varNofusers__c}&varAccname={!Opportunity.varAccname__c}&varHeadcountbreakdown={!Opportunity.varHeadcountbreakdown__c}&varMoreinfo={!Opportunity.varMoreinfo__c}&retURL=https://thomsons--uat.cs84.my.salesforce.com/{!Opportunity.Id})}
Any advice much appreciated.
Hi Deepak,
So Yes, if the Customer_PO__c is true the run the flow, if false create a quote record and ideally open that quote record.
Thanks