English
triggerAddDetail
About 211 wordsLess than 1 minute
2025-09-22
Triggers the default logic for adding detail objects.
Parameters
Description of param properties
| Parameter | Description | Type |
|---|---|---|
| apiName | Required, apiName of the target detail object | String |
| recordType | Business type of the target detail object | String |
| index | Business-type index of the target detail object, default is 0 | Number |
| button | Specifies the detail-object add button to trigger | Object |
| addOpt | Pass-through parameters for the add action | Object |
Return Value
None
Code Example
{
event: "form.render.end",
functional: function (pluginExecResult, options) {
console.log("custom plugin: form.render.end exec");
let {bizApi}=options;
// Example 1: trigger adding the preset business type of order products
bizApi.triggerAddDetail({
apiName: "SalesOrderProductObj",
recordType: "default__c",
})
// Example 2: trigger the add logic under the first order-product card (index=0)
bizApi.triggerAddDetail({apiName: "SalesOrderProductObj"})
// Example 3: trigger adding the preset business type of order products from product name
bizApi.triggerAddDetail({
apiName: "SalesOrderProductObj",
recordType: "default__c",
button: {action:"Batch_Lookup_Add",lookup_field_name:"product_id"}
})
// Example 4: trigger the add logic from the button whose api_name is Single_Add_button_default
bizApi.triggerAddDetail({
apiName: "SalesOrderProductObj",
recordType: "default__c",
button: {api_name:"Single_Add_button_default"}
})
}
}Notes
- Do not call the logic that adds the business type belonging to the same detail object inside the onClick function of that detail object's add button, to avoid infinite loops.
