ebs.massInsert
Inserts multiple records to one or more entities.
Syntax
Copy
massInsertEbs(modifyRequest: IModifyRequestCollection, callback: any, errorCallback: any): void
Where IModifyRequestCollection has the following syntax:
Copy
{
{
EntityName: "<parent_entity>",
Values: [
{
Attribute: "<attribute_name>",
Value: "<attribute_value>"
},
...
{
Attribute: "<attribute_name>",
Value: "<attribute_value>"
},
]
},
{
EntityName: "<parent_entity>",
Values: [
{
Attribute: "<attribute_name>",
Value: "<attribute_value>"
},
...
{
Attribute: "<attribute_name>",
Value: "<attribute_value>"
},
]
},
]}
| Parameter | Description |
|---|---|
parent_entity
|
Name of the entity where you wish to insert the record. |
attribute_name
|
Attribute name of the record you wish to insert. |
attribute_value
|
The value you wish to insert for the record's attribute. |
Response
| Key | Description |
|---|---|
Id
|
Unique identifier of one of the records you inserted. |
Message
|
Indicates the number of records that were inserted. |
IsSuccess
|
Indicates if the record insert was successful. |
Examples
In this example:
- We create two new businessunits.
- The name and primaryattributedisplayname of the first business unit is Marketing.
- The name and primaryattributedisplayname of the second business unit is Sales.
- The parentBusinessUnitId for both records is a3d2909b-df67-49d6-b7e0-2dc912c12484. This is the unique identifier of the root business unit in our setup.
- The request is successful (the Record inserted: 2 message is returned and the IsSuccess key is set to true).
- The unique identifier of one of the new records (6dc8cada-08b4-4072-9711-6a34c172c2be) is returned. This is the ID of the new Sales business unit.
Request
Copy
ebs.massInsertEbs({
Requests: [
{
EntityName: "businessunit",
Values: [
{
Attribute: "primaryattributedisplayname",
Value: "Marketing"
},
{
Attribute: "parentBusinessUnitId",
Value: "a3d2909b-df67-49d6-b7e0-2dc912c12484"
},
{
Attribute: "name",
Value: "Marketing"
}
]
},
{
EntityName: "businessunit",
Values: [
{
Attribute: "primaryattributedisplayname",
Value: "Sales"
},
{
Attribute: "parentBusinessUnitId",
Value: "a3d2909b-df67-49d6-b7e0-2dc912c12484"
},
{
Attribute: "name",
Value: "Sales"
}
]
}
]
}, function(e){
console.log(e.IsSuccess);
console.log(e.Message);
}
);