Opening a Form in a Modal
The OpenModal command instructs the frontend to open another form inside a modal dialog (or a new tab). Use it to drill into related records, create child records, or open a confirmation/detail screen without leaving the current form.
When your handler calls OpenModal(), the command is returned in the /runevent response. The SDK receives it and opens the specified form.
Command structure
{
"command": "OpenModal",
"args": {
"id": "unique-request-id",
"pluginCode": "INTRA",
"formCode": "ORDERFORM",
"guid": "new",
"pGuid": "project-guid",
"prefillData": {
"customerId": "cust-123"
}
}
}
C# implementation
OpenModal(new OpenModalArgs
{
Id = Guid.NewGuid().ToString(),
PluginCode = "INTRA",
FormCode = "ORDERFORM",
Guid = "new",
PGuid = Context.Guid,
PrefillData = new Dictionary<string, string>
{
{ "customerId", record.GetField("customerId")?.ToString()! },
{ "customerName", record.GetField("customerName")?.ToString()! }
}
});
Opening an existing record
// Open a specific order for editing
OpenModal(new OpenModalArgs
{
Id = Guid.NewGuid().ToString(),
PluginCode = "INTRA",
FormCode = "ORDERFORM",
Guid = orderId, // existing record GUID
PGuid = Context.Guid
});
Common patterns
Create child record from table row action
public async Task Form_onClick(string widgetName)
{
if (widgetName == "addlineitembtn")
{
OpenModal(new OpenModalArgs
{
Id = Guid.NewGuid().ToString(),
FormCode = "LINEITEMFORM",
Guid = "new",
PGuid = Context.Guid,
PrefillData = new Dictionary<string, string>
{
{ "orderId", Context.Guid },
{ "orderDate", record.GetField("orderDate")?.ToString()! }
}
});
}
}
Edit a record selected from a table
public async Task orderlines_onTableRunActionEvent(string action, object rowData)
{
if (action == "edit")
{
string rowId = ((JObject)rowData).Value<string>("_id")!;
OpenModal(new OpenModalArgs
{
Id = Guid.NewGuid().ToString(),
FormCode = "LINEITEMFORM",
Guid = rowId
});
}
}
Parameters reference
| Parameter | Required | Description |
|---|---|---|
Id | Yes | Unique identifier for this modal request — use Guid.NewGuid().ToString() |
PluginCode | Yes | Plugin code (usually same as the parent) |
FormCode | Yes | Form code of the form to open |
Guid | Yes | "new" for new record, or an existing record GUID |
PGuid | No | Project GUID — available as Context.PGuid in the child form |
PrefillData | No | Dictionary of field values to pre-fill in the child form |
IsFormEditorMode | No | Set to true to open in editor mode |
Originator | No | Information about the widget that triggered the open |
FolderData | No | Folder context for hierarchical forms |