Activate the select entity account plugin
- Create a global plugin interface that implements
zqu.SelectEntityComponentOptions.SelectEntityPlugin - Register and activate the plugin .
- Navigate to Zuora Config > Quote Studio Settings > Plugins .
- Enable the Select Entity Plugin toggle and add the class name of your custom plugin.
- Click Save .
The sample code below returns the default entity id of an account and sets the autoSubmit to true so that users cannot change the default billing entity on quotes.
-
Add a custom field, DefaultEntity__c, on the Account object.
-
Populate the DefaultEntity__c field with an entity Id.
-
Use the following code to implement the custom SelectEntity plugin.
-
Register the plugin . See step 2 under the Procedure section.
-
Create a new quote and see the entity field pre-populated with the default entity you gave in Step #2.
global without sharing class MySelectEntityPlugin implements
zqu.SelectEntityComponentOptions.ISelectEntityPlugin {
global zqu.SelectEntityComponentOptions.SelectEntityPluginResponse
selectEntityForNewQuote(String accountId, String opportunityId) {
zqu.SelectEntityComponentOptions.SelectEntityPluginResponse resp =
new zqu.SelectEntityComponentOptions.SelectEntityPluginResponse();
Account acc =
[SELECT Id,DefaultEntity__c FROM Account WHERE Id=:accountId LIMIT 1];
if(acc.DefaultEntity__c != null) {
resp.selectedId = acc.DefaultEntity__c;
resp.autoSubmit = true;
}
return resp;
}
}