executeAddToCollection method

void executeAddToCollection(
  1. String modelName,
  2. String collection
)

Implementation

void executeAddToCollection(String modelName, String collection) {
  LMAction lmAction = LMAction.fromJson({
    "type": "execute-service",
    "lucyAction": {
      "app": "Lucy",
      "service": "AddNewDocument",
      "params": {
        'event': '1',
        'document': jsonEncode(fieldValues.map),
        'collection': collection,
        'modelName': modelName,
      },
      "dialogTitle": widget.uiProps?['title']?['text'] ?? "Form",
      "executionMsg": localizedText("Saving Data..."),
      "postExecution": {
        "success": {
          "msg": localizedText("Submitted Successfully"),
          "goToHome": true,
          "buttonTitle": localizedText("Back to Home")
        },
        "error": {
          "msg": localizedText("Oops something went wrong"),
          "goToHome": true,
          "buttonTitle": localizedText("Back to Home")
        },
      }
    },
  });

  lmAction.execute(context);
}