rbv_api.detachAsync()
Purpose
This Object Script method schedules a background job to remove any relationship with multiple records. Optionally, it takes a valid input script snippet - runExpression
, and evaluates it once the scheduled job is executed.
Formulas used in runExpression
and Object Script triggers can include other API methods and regular Platform template functionality, such as loops. Object Script methods are not affected if called outside the update triggers.
Syntax
rbv_api.detachAsync (relName
, objName1
, objId1
, objName2
, objIds2
, runExpression
)
Parameters
relName
Integration name of the relationship.
objName1
Integration name of the first object.
objId1
ID of the first object record.
objName2
Integration name of the second object.
objIds2
Array of numeric IDs of the second object record.
runExpression
(Optional) A string containing formula that can include other API methods.
Permissions required
Edit permission for the selected object types.
Example
In the input, ensure the array ids
constitutes only the number type valid record IDs.
var selResult = rbv_api.selectQuery2("SELECT ID, PRICE FROM LineItem where PRICE<=0", 0, 10, null, null);
var ids = [];
for(var i=0; i<selResult.length; i++)
{
ids[i] = Number(selResult[i][0]);
}
var codeSnippet = 'rbv_api.runTrigger("Invoice", {!id}, "GenerateInvoice", false, false)';
rbv_api.detachAsync("R36189", "Invoice", {!id}, "LineItem", ids, codeSnippet);