ASP.NET Membership

Labels
AJAX(112) App Studio(7) Apple(1) Application Builder(245) Application Factory(207) ASP.NET(95) ASP.NET 3.5(45) ASP.NET Code Generator(72) ASP.NET Membership(28) Azure(18) Barcode(2) Barcodes(3) BLOB(18) Business Rules(1) Business Rules/Logic(140) BYOD(13) Caching(2) Calendar(5) Charts(29) Cloud(14) Cloud On Time(2) Cloud On Time for Windows 7(2) Code Generator(54) Collaboration(11) command line(1) Conflict Detection(1) Content Management System(12) COT Tools for Excel(26) CRUD(1) Custom Actions(1) Data Aquarium Framework(122) Data Sheet(9) Data Sources(22) Database Lookups(50) Deployment(22) Designer(177) Device(1) DotNetNuke(12) EASE(20) Email(6) Features(101) Firebird(1) Form Builder(14) Globalization and Localization(6) How To(1) Hypermedia(2) Inline Editing(1) Installation(5) JavaScript(20) Kiosk(1) Low Code(3) Mac(1) Many-To-Many(4) Maps(6) Master/Detail(36) Microservices(4) Mobile(63) Mode Builder(3) Model Builder(3) MySQL(10) Native Apps(5) News(18) OAuth(8) OAuth Scopes(1) OAuth2(11) Offline(20) Offline Apps(4) Offline Sync(5) Oracle(10) PKCE(2) PostgreSQL(2) PWA(2) QR codes(2) Rapid Application Development(5) Reading Pane(2) Release Notes(180) Reports(48) REST(29) RESTful(29) RESTful Workshop(15) RFID tags(1) SaaS(7) Security(80) SharePoint(12) SPA(6) SQL Anywhere(3) SQL Server(26) SSO(1) Stored Procedure(4) Teamwork(15) Tips and Tricks(87) Tools for Excel(2) Touch UI(93) Transactions(5) Tutorials(183) Universal Windows Platform(3) User Interface(338) Video Tutorial(37) Web 2.0(100) Web App Generator(101) Web Application Generator(607) Web Form Builder(40) Web.Config(9) Workflow(28)
Archive
Blog
ASP.NET Membership
Wednesday, October 18, 2017PrintSubscribe
OAuth Wizards, RTF, DNN Integration, Enhanced Quick Find, New Folder Structure, and more.

Code On Time release 8.6.6.0 brings about a new folder structure, RTF support in Touch UI, OAuth registration wizards, built-in integration with DotNetNuke, enhanced Quick Find with history and auto-suggestions. User interface of the generated apps has also changed in subtle ways.New features of Code On Time 8.6.6.0

Keep reading to find out what’s new!

Native Client Apps

The release sets up the stage for the upcoming Native Client Apps (NCA). NCA is a hybrid app composed of HTML,  JavaScript, CSS, and native platform-specific executable that can be installed on a mobile device. NCA makes HTTP requests  to the sever-side components of the application to read-write data. Apps generated with the release 8.6.6.0 have a folder structure compatible with the platform-specific executables designed and developed by our team.

New folder structure of apps created with Code On Time release 8.6.6.0

Folders css, fonts, images, js, and pages are transferred as-is to the mobile device upon installation of the app directly from the server deployment. Various application framework components were added and enhanced to support self-updatable NCA executables.

Presently Code On Time generator produces apps composed of HTML, JavaScript, CSS, and server-side code written in C# or Visual Basic. Apps are hosted on a Microsoft IIS web server and can be accessed via modern web browsers from mobile and desktop devices. Starting with the release 8.7.0.0 (see notes at the end of the post) we will introduce generation of Native Client Apps for distribution via Apple App Store, Google Play Store, and Window App Store.  Also Chromium-based native Windows Apps will be supported for Windows 7 and all other compatible versions of Microsoft OS as alternative to Windows App Store.

Theme Enhancements

The release intoduces numerous subtle Light theme enhancements. The toolbar is now a little taller. The selection indication colors are borrowed from the theme accent. Feedback response is expressed via background color changes.

New “Dark” theme will become available soon to double the theming choices. We are also considering configurable “dark” theme variations to allow custom “main” themes.

All future themes will share the same color accents.

Simple Search With SuperPowers

Quick Find has been greatly enhanced to offer search history, auto suggestions, and field level search.

Auto-suggestions in Quick Find of apps created with Code On Time

Enter the first letters of the field name separated with a colon symbol from the search sample to limit the search scope.

Field-level search in the app created with Code On Time and Touch UI

RTF (Rich Text Format)

Built-in Rich Text editor without any external dependencies is now available in Touch UI. Simply set the Text Mode property of a data field to Rich Text to enable displaying and editing of formatted content.

Built-in Rich Text Editor in a Touch UI app build with Code On Time

“See All” to Fullscreen

Summary data views will open in “fullscreen” mode when “See All” option is selected. This screenshot shows a summary view of suppliers.

Summary view of records in an app with Touch UI

A fullscreen infinite “grid” of suppliers without paging is displayed when the user taps “See All” in the right top corner or when the user taps on the pager area.

Infinite view of records in the app created with Code On Time

Previously a modal view of data items was displayed instead.

User Avatars

App administrators can now upload user photos directly into the built-in conent management system of the app. First enable CMS for your project. Next ;ogin as administrator and navigate to Site Content. Upload a custom image and set its name to the name of the corresponding user and leave .PNG or .JPG extension. Set Path to sys/users. If the user logs out and logs in again, then the image is automatically displayed on the app toolbar.

Uploading a user photo into Content Management System on an app created with Code On Time

The same mechanism is automatically engaged upon Single Sign On (SSO) with Facebook, Google, Windows Live, DotNetNuke, etc.

Automatic Focus and Modal Fullscreen

Developers are now able to set a focus on an arbitrary field in a form by specifing focus-auto tag. The field will be focused in edit/new mode.

Frequently requested feature to display forms in “fullscreen” mode is now a part of the framework. Developers can specify modal-fullscreen tag on the form view to accomplish this effect.

A fullscreen editForm1 view in edit mode with the automatic focus on the second field is shown in the screenshot.

A fullscreen form view with the focus automatically set on the second field in an app created with Code On Time

CMS + OAuth Registration

Content Management System now supports OAuth Registration wizards to enable easy registration of external OAuth providers in the apps to enable SSO and optional communication services. Custom wizard forms are now available for Facebook, Google, Windows Live, Microsoft Graph, SharePoint, Identity Server, and DotNetNuke.

Open Registration Authentication for Microsoft SharePoint is displayed below.

OAuth registration form for Microsoft SharePoint integration of an app created with Code On Time

You will find implementation of the OAuth Wizards under ~/js/surveys/cms folder. Take a look to see how the wizards are working and build your own surveys.

We will be adding more custom editors for CMS content to enable easy runtime configuration of data controllers, pages, access control rules, workflow register, and much more.

Cloud On Time Connector for DotNetNuke

An app created with any edition of Code On Time can now be integrated with a popular content management system DotNetNuke. DNN allows easy deployment of customer-facing web portals built with Microsoft.NET. 

Just a few lines of code are now included in every generated app to allow easy integration with DotNetNuke portal instances. The portal administrator must install the free module Cloud On Time Connector for DNN available on our website. The application administrator will have to configure the app for integration. Integration with DNN is discussed in details if you follow the links.

We have also developed a collection of video tutorials to provide step-by-step guidance for the process of integrating DotNetNuke and apps created with Code On Time.

Watch a brief intro to learn how to rapidly build database forms, reports, apps for DotNetNuke portals. Use the links above to find the full details and instructions.

 

Applications generated with Unlimited edition can also be integrated with Microsoft SharePoint Online (Office 365) in a similar fashion.

You may not need a full featured portal as the front end for your app, but be assured that the technology making integration with DNN and SharePoint possible has singificant implications. Soon you will be able to use Code On Time to build your own apps that act as providers of identity information such as users, roles, and various custom data properties. It will be possible to create custom business applications that outsource user/role management to the identity provider app via OAuth. Apps acting as identity consumers will not have a built-in user management and will defer authentication and authorization decisions to the identity provider application created with Code On Time.  This will greatly simplify user management and enhance application security when large collections of apps are developed. This mechanism is the core component of the upcoming Cloud Edition of the v9, the next generation app builder of mobile and desktop apps. The new Cloud Identiy component of generated apps will become the default universal option for “Authentication and Membership” instead of ASP.NET Membership.

See Also

The following bug fixes, enhancements, and new features were introduced:

  • Light theme has been enhanced to use the “grey” background for visual response on click/touch with additional accent colors from to indicate the “selected” state of the elements of user interface.
  • There is no gap between modal pages and screen edge if the screen width is less than 480px.
  • Rich Text Formatting is now available in Touch UI when the Text Mode of a data field is set to Rich Text.
  • Read Only When expression works correctly when the field is specified in the Copy property of the lookup field.
  • List/Grid/Cards display a text-only tooltip limited to 300 characters.
  • Fixed. Model Builder sets up the sort expression of the baseline data controller view grid1 according to the order of the fields.
  • Enhanced rendering on Windows 10 tablets and horizontal touch-scrolling in grid view style.
  • Property Visible When of tabbed categories works correctly in Touch UI with container-level data views and DataView fields in forms. Tabs in forms will continuosly respond to changes to the fields used in Visible When expressions. Tabs of container-level data view fields will respond only to the initial values of the master row.
  • Switching between tabs will maintain the scroll position in forms even when the tabs reveal a small amount of content to prevent “jumping” effect.
  • Forms templates created by the framework at runtime will not include data-visibility attribute on field and category elements unless there is a Visible When expression on the corresponding object of the data controller.
  • JSON serialization of dates now uses String.Format method instead of DateTime.ToString to prevent culture related exceptions for some date values.
  • Globalization scripts are now included explicitly in the framework file set under ~/js/sys/culture folder of the app. If only the en-US culture is supported in the app, then the folder does not exist. New culture files are automatically generated when globalization settings of the project are changed. Calendars Hijri and UmAlQura are incuded directly in the corresponding globalization script as needed.
  • Controller MyProfile now includes culture-specific translated resources.
  • Added German membership translations - Thank you Peter Teutsch.
  • Fixed the double selection of auto-complete with the mouse in Touch UI on Mac OSX.
  • Fixed issue with custom session state with "DELETE * FROM..."
  • OAuth login using token in cookie and auto login causing redirect loop has been fixed.
  • Added check to fix issue with EnsureFieldValues when no values are submitted (Export, Download, etc).
  • Added JSON serialization support for the fields of type “Date” to work the same as “DateTime”.
  • Application framework now implements GetIdentity, GetManifest, GetManifestFile to support the native client apps.
  • Tag focus-auto will cause the form to set the focus on the corresponding data field in the form in new/edit mode on devices with a mouse pointer.
  • Tag modal-fullscreen will cause the form view to open as “fullscreen” modal view when the screen width allow “modal” presentation.
  • Ensured that the field outputs use the proper model name when available, instead of column name.
  • Added default user roles to user accounts created by external authentication.
  • Added new OAuth Registration Surveys to SiteContent.
  • Password recovery is denied if user has "Source: \w" in the comment (i.e. came from SSO source).
  • SiteContent is now sorted by FileName, Path.
  • Disabled ASP.NET request validation. Added RequestValidationService class as a replacement.
  • Client Framework now HTML-encodes the entire request. The server-side framework HTML-decodes the request to prevent HTML injection on HTTP level.
  • DotNetNuke integration via OAuth and Cloud On Time Connector for DotNetNuke is introduced in the apps. DNN tokens are now persisted in the database. OAuthHandler can now set email separately from the username.
  • Classic UI: Mandatory dropdownlist/radiobuttonlist/listbox will display NULL option if the field value is null. This will force the user to make a choice.
  • Touch UI: "N/A" text is not displayed in mandatory dropdownlist/radiobuttonlist/listbox when the field with null value is activated. Instead the placeholer is displayed in the empty input text box.
  • Fixed. Operation "$lastweek" missing from RowFilterOperations.
  • It is now possible to use culture-specific “comma” in decimal values on iOS devices when entering numbers.
  • Fixed left sidebar shifting with glyphicon icon.
  • New methods added to SiteContentFile: WriteAllBytes, WriteAllText, Exists, Delete.
  • User pictures (avatars) can now be saved in CMS as "sys/users/[UserName].(jpg|png)".
  • Quick Find now supports auto-suggestions, history, and field-level search. Improved search results for "search anywhere" and "search in field".
  • Universal Input: Refactored for speed the implementation of "change" function that monitors lookup input.
  • Ensured application name is "/" for apps using ASP.NET membership.
  • Publish will re-ask permissions if expired or incorrect.
  • Fixed. “Required” Tooltip shows up incorrectly when the field is on an inactive tab.
  • Search On Start works in Summary mode.
  • New tag search-on-start-simple will force search to be displayed in "simple" mode instead of "advanced". Advanced is the default mode for "Search On Start".
  • Client framework ignores HTTP error codes < 0 frequently causes by user navigating away when a data request is still in progress.
  • Ensure date picker closes after selection if no time component in Touch UI.
  • Context Values are passed as External Filters to enable additional server-side analysis and filtering similar to https://codeontime.com/learn/data-controllers/fields/context-field/implicit-lookup-filters-with-filter-expression.
  • It is now again possible to specify literal values on the right side of mappings in "Context Fields" expression in Touch UI.
  • Application Framework: Legacy security attribute legacyCasModel of "trust" element is restored to enable better performance of Report Viewer on more secure Windows Servers.
  • Folder structure of generated apps has changed:.
    • All javascript goes under ~/js with /js/sys and /js/daf folders.
    • All touch CSS goes under ~/css.
    • Lowercase pages, reports, controls.
    • Method sm_ResolveScriptReference has been removed from Site.cs(vb), and instead sm.AjaxFrameworkMode = Disabled for both ASPX and HTML projects.
  • Renamed import-1.0.0.0.js to touch-import.js. Included jQuery 2.2.4 into release.

Next

Monitor our roadmap 2017 updates over this weekend to see what is coming next (Native Client Apps for mobile devices, Chromium-based client for Windows, Offline Data Processor, etc.)

    Sunday, July 2, 2017PrintSubscribe
    Advanced Search 3.0, Integrated Deployment, Enhanced Baskets & Lookups

    Release 8.6.3.0 is here! While the revision number is minor, some major features are contained in this release.
     
    First on the headline is brand new Advanced Search 3.0 for Touch UI. Major upgrades were required for the Form Rendering Engine to support dynamically created forms. Survey capabilities have been greatly expanded in order to support the functionality required for Advanced Search. 
     
    One important aspect of every app is dealing with deployment. The new Publish capabilities introduced in 8.6.3.0 make it easy to get your apps running on the cloud or a dedicated server. Read on below for more information.
     
    A large number of other enhancements and fixes are also included in this release.

    Advanced Search 3.0

    The original implementation of Advanced Search for Touch UI was a custom solution. The introduction of modal pages in release 8.6.0.0 necessitated a rewrite of the functionality. The new implementation in release 8.6.3.0 brings integration with the latest features available in Touch UI - lookups, basket lookups, date inputs, modal forms, surveys, and custom form templates.
     
    The new default layout for Advanced Search will read a story to the user. Use Tab, Enter, or arrow keys to quickly navigate through field values. Push Enter key to perform the Search.
     
    Advanced Search 3.0 now correctly handles typed inputs. A date picker will be displayed for date fields. Lookups are used for every field to allow the user to select existing values.
     
    image
     
    For fields in a “Match All” group, the lookups will be cross-dependent on each other and apply filters to available values based on the current selection. This greatly helps the user explore and understand the dataset without having to perform searches.

    Integrated Publishing/Deployment

    A major step of every app is to deploy it to the web. Release 8.6.3.0 makes it easy to bring the app to your users with the push of a button.
     
    The “Publish” action in previous releases would simply compile the app and open the target folder. In the new release, the action will now display the list of options below.
      image

    The “File System” option allows publishing directly a folder in the file system.
     
    image
     
    The “FTP” option allows publishing the app directly to an FTP-enabled server.
     
    image

    Publishing to Microsoft Azure is covered in great details in the brand new tutorials at  

    https://www.youtube.com/playlist?list=PLy2g3SjvDe2YbSdvoXilUh9BvkllO50jh

    Integrated publishing to the cloud if the foundation of the mobile application deployment in the upcoming release 8.7.0.0.  Only Code On Time will allow creating a server-side application that becomes automatically mobile and capable of working entirely offline in the release 8.8.0.0. Consult our roadmap for more details at http://codeontime.com/roadmap.

    Each Publish option offers the ability to specify overrides for app settings that will be applied when Publish is complete. Here are some of the options:

    • Primary and membership connection strings
    • Enabling remote debug messages
    • Blob adapter configurations

    Support for Microsoft Visual Studio 2017

    The app generator now fully supports Visual Studio 2017.

    Rich Text Format

    Support for rich text has been now introduced in the grid, list, and cards presentation styles. Forms display a keyboard freindly rich text editor. We will be making a few enhancements in the follow-up releases (toolbar, formattings options, etc.) in the coming weeks.

    Identity Server OAuth Provider

    You can now use Identity Server 4 for the purpose of user authentication based on Microsoft Identity technology.

    Microsoft Graph OAuth Provider (Windows Live, Outlook, Office, SharePoint, Azure AD)

    This releases also introduces new options that allow authentication of users via Microsoft Azure Active Directory. We are preparing video tutorials that will explain how that works.

    Additional Enhancements

    • Baskets are now displaying the selected items inline with the text input for a more compact presentation. Selected options are eliminated from the list of options available for selection.
    • Powerful client-side caching in database lookups brings performance of applications to a new level.
    • Changing models will no longer rebuild data model from the database - much faster for users using remote database servers.
    • Project backups are now zipped, reducing Backup folder size by ~90%.
    • Published projects are now backed up and zipped.
    • New ServiceRequestHandler class allows extending “_invoke” API with new custom handlers.
      Web.config modification instructions now support “SetAttribute” command. See example below:
          SetAttribute: /configuration/system.web/pages
          validateRequest:false
    • Azure Blob Adapter updated to use API version 2015-12-11.
    • Sitemaps defined in CMS now support “CSS Class” property.
    • It is now possible to control default modal behavior using touch-settings.json file using “ui.modal.max” and “ui.modal.when” properties.. See example below:
      {
        "ui": {
          "modal": {
            "max": "lg",
            "when": "sm"
          }
        }
      }
    • Added ability to set thumbnail size in touch-settings.json using the “ui.thumbnail.width” and “ui.thumbnail.height” properties.
    • New icons in the app generator.
    • Warning shown under connection string when it differs from the membership connection string.
    • Only one connection string is created in web.config if primary and membership connection string are equal.
    • Updated translations for Portuguese - thank you Nielsen Batista!
    • Updated translations for German - thank you Peter Teutsch!
    • Added tag “lookup-collapsible” to automatically collapse ListBox and RadioButtonList controls when the user makes a selection. A  chevron is displayed to expand the lookup again.
    • Custom button support in surveys.
    • ExportBase.ToClientUrl() is now overridable to allow customization of IQY files.
    • Calendar Input will focus next field after the date is selected on DateTime fields on desktop devices.
    • Basket lookups will hide values that have already been selected.
    • Lookup controls will expand faster to ensure text does not scroll as the user types.
    • Enhanced support for conversion of strings to date values. For example, type in “011215” to get Jan 12, 2015.
    • Close button added to Calendar Input when mouse is primary pointer.
    • Blob Adapter values are stored in the web.config as app settings.
    • Many-to-many field processing is moved before “After” business rules, and after “Before” business rules, to ensure rules use the correct values.
    • Tag “open-on-tap” will open a lookup dropdown instead of focusing on text input.
    • Tag “lookup-distinct” allows reducing the available lookup options to distinct values.
    • Custom JavaScript files will now be read and appended to the framework when placed under ~/js folder. ApplicationServices.ConfigureScripts() allows controlling which scripts are included.
    • Custom Cascading Stylesheet files (CSS) will be read and appended to the library when placed under ~/css folder.
    • Surveys are now loaded from ~/js/surveys folder. When using survey called “mysurvey”, API will pick up files in this order:
    • Survey definition: mysurvey.min.js, mysurvey.js
    • Survey rules: mysurvey.rules.min.js, mysurvey.rules.js
    • Survey template: mysurvey.html
       

    Miscellaneous Fixes:

    • Fixed dedicated login redirect issue with projects using ASPX page implementation.
    • Fixed issue “Error 500: Dangerous request in form” when a form is submitted with HTML formatted values.
    • Fixed issue with Membership Manager not updating LoweredRoleName column.
    • Fixes with page sizing after device rotation.
    • Custom Membership supports optional PasswordQuestion/Answer.
    • Charts are now supported with custom controllers.
    • Blob Adapters with Source Field value containing spaces is now supported.
    • MyProfileBusinessRules properly inherits from SharedBusinessRules when the feature is enabled.
    • Fixed “Unable to get property ‘1’ of undefined” error in Project Designer.
    • Disabled discard changes prompt in MyProfile controller.
    • Fixed issue with Model class objects using Turkish “i” in field names.
    • Export action ignores DataView fields.
    • Tag “action-call-disabled” now works.
    Saturday, August 16, 2014PrintSubscribe
    Sending Emails with SQL Business Rules

    Email business rules offer a simple and effective mechanism of creating email notifications for various workflow tasks. For example, a simple notification can be sent out when a new customer account is created. Another example is a notification with attached PDF reports triggered by an update of a product category record.

    An email business rule is a static text-based template with placeholders matched to a data controller action command name and execution phase. The template may also include XML-based attachment instructions. A single email notification is generated by application framework when an email business rule is matched to a command activated by application user. Template placeholders are replaced with the field values of the affected data row. If the multiple selection mode is enabled, then a separate notification is generated for each selected data row. Here is an email business rule that produces a notification with two attachments for Categories controller.

    An email business rule selected in Project Designer of Code OnTime app generator.

    The text of the email business rule script template is shown next. The data value placeholders are highlighted.

    Host: smtp.gmail.com
    Port: 587
    UserName: YOUR_EMAIL_ADDRESS@gmail.com
    Password: PASSWORD
    EnableSSL: true
    
    From: "Sales Admin" <your_email_address@gmail.com>
    To: RECIPIENT@northwind.com
    Subject: Category "{CategoryName}" has changed!
    
    Dear Admin,
    
    This product category has been changed.
    See attachment for category product details.
    
    System Monitor
    
    <attachment type="report">
        <name>{CategoryName}</name>
        <controller>Categories</controller>
        <view>editForm1</view>
        <filter>
            <item>
                <field>CategoryID</field>
                <operator>=</operator>
                <value>{CategoryID}</value>
            </item>
        </filter>
    </attachment>
    <attachment type="report">
        <name>{CategoryName} Products</name>
        <controller>Products</controller>
        <sortExpression>UnitPrice desc</sortExpression>
        <filter>
            <item>
                <field>CategoryID</field>
                <operator>=</operator>
                <value type="Int32">{CategoryID}</value>
            </item>
        </filter>
    </attachment>

    If a specific notification cannot be expressed with a static text template, then consider using SQL business rules to compose an email by writing notification text in the programming language of the database engine.  Database programming languages, such as T-SQL of Microsoft SQL Server, offer enough flexibility to compose a notification of any complexity.

    SQL business rules are text-based scripts executed by the database engine. The scripts may include references to data controller fields, properties of BusinessRules class associated with the data controller, URL arguments, and session variables. Developers reference any of these resources as parameters that do not have to be explicitly declared in the scripts.

    Application framework binds these “pre-defined” parameters to the corresponding resources, executes the script, collects the output parameter values, and ignores any datasets that may have been produced when the script was executed.

    A special mechanism exists in the application framework to force it to pay attention to the output of the SQL business rule script. The developer must supply two business rules that are matched to the same command. The first business rule triggers the “awareness” mode of the application framework. The second business rule produces a dataset that will be captured by the framework. Application framework copies the output data to an instance of System.Data.DataTable class and assigns it to BusinessRules.EmailMessages property. The property implementation iterates over the data table rows and treats each row as a notification that must be sent out. The column names of the table, such as “Port”, “To”, “From”, “Subject”, and “Body” allow the framework to compose correct email messages. The message “awareness” mode is automatically turned off when the last email has been sent.

    Here is an example of data controller with two SQL business rules that will generate an email with report attachments when a product category has been updated.

    A data controller with two SQL business rules that will generate email notifcations in Touch UI application created with Code On Time.

    The first SQL business rule is very simple

    Property Value
    Type SQL
    Command Name Update
    Phase After
    Script
    set @BusinessRules_EnableEmailMessages = 1

    The script of the this rule assigns value True to the BusinessRules.EnableEmailMessages property of Boolean type and does nothing else. The implementation of the script may do any other type of processing if needed.

    The mode of email message awareness is activated now!

    The second SQL business rule will produce a singe data row. The script has a “debug” section that declares parameter values used for testing. Application framework will remove this section at runtime  before asking the database server to execute the script. The highlighted fragments are the output column names.

    Property Value
    Type SQL
    Command Name Update
    Phase After
    Script
    -- debug
    declare @CategoryID int
    declare @CategoryName nvarchar(5)
    select @CategoryName = 'Confections', @CategoryID = 1
    -- end debug
    
    declare @CrLf as varchar(2)
    select @CrLf = char(13)+ char(10)
    
    select 
        -- from 
        'YOUR_EMAIL_ADDRESS@gmail.com' "From",
        -- to
        'RECIPIENT@nothwind.com' "To",
        -- subject
        'Category "' + @CategoryName + '" has changed' "Subject",
        -- body
        'Dear Admin' + @CrLf + @CrLf +
        'This product category has been changed.' + @CrLf +
        'See attachment for category product details.' + @CrLf + @CrLf +
        'System Monitor' + @CrLf  +
        -- attachment 1
        '<attachment type="report">' + 
        '<name>' + @CategoryName + '</name>' +
        '<controller>Categories</controller>' + 
        '<view>editForm1</view>' +
        '<filter>' + 
            '<item>' +
                  '<field>CategoryID</field>' +
                  '<operator>=</operator>' + 
                  '<value>' + cast(@CategoryID as varchar) + '</value>' +
            '</item>' +
        '</filter>' +
        '</attachment>' +    
        -- attachment 2
        '<attachment type="report">' + 
        '<name>Products in ' + @CategoryName + '</name>' +
        '<controller>Products</controller>' + 
        '<sortExpression>UnitPrice desc</sortExpression>' +
        '<filter>' + 
            '<item>' +
                  '<field>CategoryID</field>' +
                  '<operator>=</operator>' + 
                  '<value type="Int32">' + 
    cast(@CategoryID as varchar) +
    '</value>' + '</item>' + '</filter>' + '</attachment>' "Body"

    Note that STMP parameters, such as Port and Password are omitted from the script. Application framework will use default SMTP settings from the application configuration file. If any of these parameters are needed to be in the message definition, then make sure that the values are included as the corresponding column names (for example, Host, UserName, etc.)

    This particular implementation uses @CrLf parameter to inject end-of-line characters in the message. The entire message body is a single concatenated string of text. A real-world implementation may compose the text by iterating through cursors and executing multiple select statements.

    If an HTML output is desired then the corresponding tags should be included in the “Body”.

    Developers can return any number of “messages” in the output when needed. This may be accomplished by creating a temporary database table and populating it with the messages. The contents of the temporary table are selected when the job is done. Another alternative is to use UNION of several SELECT statements to send a fixed number of messages at once.

    This is a sample email notification produced by SQL business rules from the example above.

    An email notification with two report attachments produced by Touch UI app created with Code On Time.

    Continue to Watermark Property