Skip to main content

Hi, 
We do have CPQ Cloud application integrated into salesforce.com via installed package.
This tool is used by our sales team to generate new quotes on the oppty in SF.com.
We use a skuid oppty page.
So far I was not able to find a way to replicate on our oppty skuid page CPQ Cloud “Set as Primary” button.
When I click on the button there is no URL link I can use to copy/replicate into Skuid button.
In salesforce.com “Set as primary” button is type “list button” and content source “OnClick JavaScript”.
I am not a JavaScript expert.
I have tried to insert “set as primary” javascript code in salesforce into a snipet button but it did not work.
May I ask for some support or good advise to find a way to replicate CPQ Cloud “set as primary” button into our company opportunity skuid page ?
Thank you
Cyril   

Former Big Machines user here!


Here’s how we did it. On our Opportunity detail page we had a table of related quotes - one of which should be the primary.


Using a table mass action, the user would select ONE quote, and then click the table Mass Action “Set as Primary.” This then calls the Big Machines apex class that does all the background stuff - like making the Opportunity quote products match the primary quote products,


Here’s our table action:


And here is the javascript snippet for SetQuoteAsPrimary. Be sure you have the Id fields selected in your Big Machines Quote model and your Opportunity Products model.


var params = argumentsr0],

$ = skuid.$;


OppLineModel = skuid.model.getModel(‘LineItems’), // this is your Opp Products, not quote Products

OppLine = OppLineModel.getFirstRow();


OppLineId = OppLineModel.getFieldValue(OppLine,‘Id’,true);


var setAsPrimary = false;


list = params.list,

selectedItems = params.item ? =params.item] : list.getSelectedItems();


if (selectedItems.length === 1) {

if (OppLineId !== ‘’) { // checking if there are products on the Opp already


setAsPrimary = true;  
}

if (setAsPrimary) {


//alert("Calling Big Machines API.");

var result = sforce.apex.execute("BigMachines/BigMachinesFunctionLibrary", "setQuoteAsPrimary", {quoteId:selectedItemsu0].row.Id});

}

}

else

{

alert(‘Please select a single quote before executing this action.’);

}


Thank you very much Chandra for your quick help. I am still trying to make it work reading your instructions. Our oppty line item model is called “OpportunityLineItem” and includes Id, opptyid,product2id fields. Our Big Machines Model is called “QuoteMachines” and includes record id, Bigmachines_transactioni_id fields.
Do I needs to change some of the javascript snipet code to reflect our models names ?
Thanks again,
Cyril  


Looks like you’d only need to change line 3:

From: OppLineModel = skuid.model.getModel(‘LineItems’),  // this is your Opp Products, not quote Products

To: OppLineModel = skuid.model.getModel(‘OpportunityLineItem’),  // this is your Opp Products, not quote Products



Reply