PMF Workflow Script APIs

PMF Workflow Script APIs

*It is able to run C# script in Workflow nodes.

Example 1 – Send Email:

SendEmail(“[email protected]”, null, null, “Test Email”, “This is a test email”, false);
return true;

Example 2 – Write form data into a database table:

Database.Row row = new Database.Row();
row.Add(“company”, “Scilligence”);
row.Add(“website”, “www.scilligence.com”);
InsertDB(“Data Source=(local);Initial Catalog=CompanyDB;User ID=sa;Password=;”, “Companies”, row);
return true;

Example 3 – Call SOAP Web Service:

Database.Row row = new Database.Row();
row.Add(“company”, “Scilligence”);
row.Add(“website”, “www.scilligence.com”);
string ret = CallSoap(“http://server/app/service.asmx”, “http://namespace.company.com”, “AddCompany”, row);
return ret;

Properties:

  1. this.data (Database.Row): contains workflow form data
  2. this.requestid (long): the current requestid
  3. this.CurrentUserID: the current user ID
  4. this.CurrentUserEmail: the current user email

Methods supported:

  1. bool SendEmail(string to, string cc, string bcc, string subject, string body, bool html)
  2. long CreateRequest(string form, Database.Row data, bool submit, string notes)
  3. long CreateRequestCopyData(string form, string keys, bool submit, long userid)
  4. bool SetFieldValues(Database.Row data)
  5. bool InsertDB(string connectionstring, string table, Database.Row row)
  6. bool UpdateDB(string connectionstring, string table, Database.Row row, string where)
  7. Database.Row ReadDB(string connectionstring, string sql)
  8. string ReadFile(string path, string credential)
  9. void WriteFile(string path, string contents, string credential)
  10. string CallWebService(string url, Database.Row postdata, string username, string password, int timeout)
  11. string CallSoap(string url, string ns, string method, Database.Row data)
  12. byte[] ReadFileStore(string s, string source)
  13. string ReadFileStoreAsText(string s, string source)
  14. string GetProjectCode()
  15. string GetCompanyCode()
  16. long CreateProject(string company, string parentproject, string projectcode, string name, Database.Row row)
  17. long CreateTask(string projectcode, long parenttaskid, string title, Database.Row row)
  18. bool DoAction(long requestid, string cmd, Database.Row items)
  19. bool SetFieldValue(string key, string value)
  20. bool SetFieldValues(Database.Row data)