Hello ,
I think that it is not the same. In my AIP Assit, we can find this with “createEditBatch “
Inline Edits with TypeScript Functions in Foundry
In Foundry, you can create inline edits using TypeScript functions by building function-backed actions that can be used in Workshop widgets and other applications. Here’s how to implement this:
Creating TypeScript Functions for Inline Edits
TypeScript v2 Function Structure
To create a TypeScript function that supports inline editing, you need to define an Ontology edit function using the createEditBatch approach [_mnV1]:
import { Client } from "@osdk/client";
import { Employee } from "@ontology/sdk";
import { Edits, createEditBatch } from "@osdk/functions";
type OntologyEdit = Edits.Object<Employee>;
export default function updateEmployeeProperty(
client: Client,
employee: Employee,
newValue: string
): OntologyEdit[] {
const batch = createEditBatch<OntologyEdit>(client);
// Update the property
batch.update(employee, { propertyName: newValue });
return batch.getEdits();
}
Key Requirements for Inline Edit Functions
For a TypeScript function to work with inline edits, the resulting action must meet specific criteria [_MGMv]:
- Single object modification: May only modify a single object of a single object type
- Default values enabled: Default values must be enabled and come from the object reference parameter
- No static mappings: Properties being changed cannot be mapped to static values or special values like “Current User” or “Current Time”
- No side effects: Side effect webhooks or notifications cannot be enabled
Configuration Process
1. Create the Function-Backed Action
After creating your TypeScript function, configure it as a function-backed action in the Ontology Manager [_mnV1]. This is required for the edits to actually be applied to objects.
2. Configure Inline Editing
For Object Explorer
Navigate to the Properties tab of your object type in Ontology Manager, then to the Interaction tab. Select a property and configure the Inline edit option to use your function-backed action [_MGMv].
For Workshop Widgets
No additional configuration is required in Workshop itself - the inline edit capability is automatically available once the action is properly configured [_MGMv].
Advanced TypeScript Function Examples
Updating Multiple Properties
export default function updateEmployeeDetails(
client: Client,
employee: Employee,
firstName: string,
lastName: string
): OntologyEdit[] {
const batch = createEditBatch<OntologyEdit>(client);
batch.update(employee, {
firstName: firstName,
lastName: lastName
});
return batch.getEdits();
}
Working with Struct Properties
interface Address {
street: string;
city: string;
state: string;
zipcode: string;
}
export default function updateEmployeeAddress(
client: Client,
employee: Employee,
newAddress: Address
): OntologyEdit[] {
const batch = createEditBatch<OntologyEdit>(client);
batch.update(employee, { address: newAddress });
return batch.getEdits();
}
Important Considerations
Validation and Submission
- Bulk submission: Inline edits are validated and submitted in bulk rather than sequentially [_MGMv]
- Parameter validation: Each edit is validated individually, but submission criteria that reference shared or linked objects are not compatible with inline edits [_MGMv]
- Default values: Every parameter is optional and defaults to the existing value of the object [_MGMv]
Limitations
- No conflicting edits: Multiple actions cannot write to the same object [_MGMv]
- No aggregate consistency: Actions that attempt to keep aggregate values consistent are not suitable for inline edits [_MGMv]
- Search limitations: Changes are propagated to object search APIs after function execution, so
Objects.search() may not reflect recent edits [_mnV1]
Testing Your Functions
You can test your TypeScript edit functions in the functions helper in Authoring without actually applying edits to objects. The edits will only be applied when the function is executed through a properly configured action [_mnV1].
This approach allows you to create powerful inline editing capabilities in your Foundry applications while maintaining data integrity and providing a smooth user experience.