Dominique,
This seems like an ideal opportunity to use RPC. RPC allows you to have any type of return object (e.g., void, string, array), not just a list of Business Objects.
You can find this information (I agree it's sparse and hard to find) in Reference Help under ServerRpcDelegate Delegate
Here is an email example:
| C# |
|
// Sample showing invocation of server method PersistenceManager pm = PersistenceManager.DefaultManager; int orderId = 10250; bool mailSent = (bool) pm.InvokeServerMethod(Order.EmailOrderInfo, orderId); // sample method defined in Order class public class Order : OrderDataRow { //... // ServerRpcDelegate method, called from client [AllowRpc] public static Object EmailOrderInfo(IPrincipal pPrincipal, DataSourceResolver pResolver, params Object[] pArgs) { int orderId = Convert.ToInt32(pArgs[0]); // build and send an email message string from = "sales@mycompany.com"; string to = "customer@yourcompany.com"; System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage(from, to); msg.Subject = "Order Information"; msg.Body = string.Format("Order id = {0} has been shipped", orderId); System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("localhost"); try { mailClient.Send(msg); } catch (Exception e) { TraceFns.WriteLine(e.Message); return false; } return true; } } |