For instance, I've crafted a function to generate a contact:
void InsertContact(string contactName) {
UserConnection userConnection = Get("UserConnection");
contactName = contactName ?? "Unknown contact";
var ins = new Insert(userConnection)
.Into("Contact")
.Set("Name", Column.Parameter(contactName))
.Set("JobTitle", Column.Parameter("Consultant"))
.Set("Notes", Column.Parameter("C# Script Test"));
var affectedRows = ins.Execute();
}
However, I desire the function to be more versatile:
void InsertObject(string contactName, string ObjectName, var Object) {
UserConnection userConnection = Get("UserConnection");
// Generate a query dynamically using Object Name, Contact Object Columns, and Values
var ins = new Insert(userConnection)
.Into(ObjectName)
.Set(Object["key"], Column.Parameter(Object["value"]));
var affectedRows = ins.Execute();
}
This enhanced function can be dynamically utilized within the Script Element.
Is it possible to create the dynamic functions in Creatio like this?