V8 Pre-upgrade Check Script
Activate Web Forms are composed with a series of Web Controls.
All previous Activate Web Controls were based on ASP.NET WebForms technology and have been completely rewritten in .NET core. This technology rendered standard HTML + Javascript to web browser and then posts back an HTML form to the server which then emulates events and binds the data into the Job that is kept in session memory on the server.
The new controls render an XML document and a set of bindings to the client where the Activate React Client displays these controls for the user. The controls update the data model and the client which is then submitted to a web service. Server Events are not supported in this environment.
While every effort has been used to try and maintain compatibility this is sometimes not possible especially with a complete change of underlying architecture.
The following outlines the process for converting the forms.
Deprecated Controls
The following controls are no longer supported
V7 Controls | Replacement |
|---|---|
SelectMultipleProvisioningObjects | This control is no longer necessary as the underlying controls now support multiple selections. |
WorkflowTreeView This control is used to select a step from a running job. | SelectWorkflowStep This is a control based on the standard SelectXXX controls and is more consistant. |
AutoSearchControl and SearchResultsPanel These controls were used to show suggestions and help during Log a Call style tasks. This has been standardized on a more standard Search control. | <Search ActivateBind="......" /> |
CustomValidator This is a server based control that allow custom validation to be performed on the server. This control can be replaced with an ExpressionValidator or setting a page error. For example:- V7 Version | |
ActivateUsageDataSource This control has been renamed to better represent what it does. | ActivateDataSource Rename the control to ActivateDataSource. The DataSourceID has been retired. The ActivateDataSource now adds a global variable to the evaluator with the name that is the same as it's ID property. This means the datasource can now be "=//[ID]" in the web grids datasource. <ActivateWebGrid id="serv1" DataSource="=//TopTasks" Height="300px" SelectType="None" TItle="Top Requests"> |
FileUpload Binding has changed to binding/item style. |
|
AssetUniqueValidator No longer exists | CustomValidator or ExpressionValidator Use a WebForm Form_Submit/SetControlError server script to run your validation logic. |
<SelectMultipleProvisioningObjects ID="SelectMultipleProvisioningObjects1" ActivateBind="users" Label="Users"> <Controls> <SelectUser ID="SelectUser1" ActivateBind="" /> </Controls> </SelectMultipleProvisioningObjects> <SelectUser ID="SelectUser1" ActivateBind="users/user" Multiple="1" /><CustomValidator ID="CustomValidator1" /> public void Form_Submit(object sender, EventArgs a) { Innovation.Activate.Web.Controls.CustomValidator val = (Innovation.Activate.Web.Controls.CustomValidator)GetControl("CustomValidator1"); if(error) val.ErrorMessage = "Please select at least one user to request information from." }V8 Version public void Form_Submit(ActivateHttpRequest request) { if(error) { request.Page.SetPageError( "Please select at least one user to request information from."); } }<ActivateWebGrid id="serv1" DataSourceID="TopTasks" Height="300px" SelectType="None" TItle="Top Requests">
</ActivateDataSource>
<ActivateDataSource ID="TopTasks" Type="CurrentTopTasks" MaxRows="10">
<FileUpload ID="fileUp" Label="File to Import" MaxInputs="1" IsRequired="True" ActivateBind="fileUp/item">
FileUpload
Server Events
The previous ASP.NET web form event handlers are no longer supported. These event handlers were designed to make it easy for users coming from a desktop background to move to the web. However, more modern techniques are now available. These events are now handled during the Form_Submit event.
The following is a form from V7 that has a Click Event that sends an email. The highlighted sections are the event handlers that need to be changed.
<?xml version="1.0" encoding="utf-16"?>
<WebForm>
<Panel Width="100%" Form.Load="Form_Load" Form.Submit="Form_Submit">
<Controls>
<RibbonPanel>
<Controls>
<RibbonGroup Text="Email">
<Controls>
<RibbonButton Link="/" Click="OnSend" Text="Send" ImageUrl="mail">
</RibbonButton>
</Controls>
</RibbonGroup>
</Controls>
</RibbonPanel>
<Break ID="Break1" />
<TextBox ID="txtEmail" Label="Email Address" Width="800px" Text="=/user/emailaddress" />
<TextBox ID="txtSubject" Label="Subject" Width="800px" Text="=eval(=//Job, "")" />
<HTMLEditor ID="txtBody" Label="Message" Width="800px" Html="=eval(=//Job, "")" />
</Controls>
</Panel>
<ServerScript>
<Text><![CDATA[using System;
using System.Web.UI;
using Innovation.Activate;
using Innovation.Activate.Utilities;
using Innovation.Activate.Web;
using Innovation.Activate.Forms.Xaml;
using Innovation.Activate.Web.Controls;
class Script : WebFormScript
{
public void Form_Load(object sender, EventArgs e)
{
}
public void Form_Submit(object sender, EventArgs a)
{
}
public void OnSend(object sender, MenuLinkClientEventArgs a)
{
TextBox txtEmail = (TextBox)GetControl("txtEmail");
TextBox txtSubject= (TextBox)GetControl("txtSubject");
HTMLEditor txtBody = (HTMLEditor)GetControl("txtBody");
MailUtilities.SendEmail(txtEmail.Text, txtSubject.Text, txtBody.Html);
WebUtils.GotoReturnPage();
}
}
]]></Text>
</ServerScript>
</WebForm>The new version based on V8.
<?xml version="1.0" encoding="utf-16"?>
<WebForm>
<Panel Width="100%" Form.Load="Form_Load" Form.Submit="Form_Submit">
<RibbonPanel>
<RibbonGroup Text="Email">
<RibbonButton ID="btnSend" Text="Send" ImageUrl="mail">
</RibbonButton>
</RibbonGroup>
</RibbonPanel>
<Break ID="Break1" />
<TextBox ID="txtEmail" Label="Email Address" Width="800px" Text="=/user/emailaddress" ActivateBind="email/emailAddress" />
<TextBox ID="txtSubject" Label="Subject" Width="800px" Text="=eval(=//Job, "")" ActivateBind="email/subject" />
<HTMLEditor ID="txtBody" Label="Message" Width="800px" Html="=eval(=//Job, "")" ActivateBind="email/body" />
</Panel>
<ServerScript>
<Text><![CDATA[using System;
using Innovation.Activate;
using Innovation.Activate.Utilities;
using Innovation.Activate.Web;
using Innovation.Activate.Forms.Xaml;
using Activate.Web.Controls;
using Innovation.Activate.Web.Controls;
class Script : WebFormScript
{
public void Form_Load(object sender, EventArgs e)
{
}
public void Form_Submit(ActivateHttpRequest request)
{
if (request.IsEventSource("btnSend"))
{
string email = Job.Arguments.GetString("email/emailAddress");
string subject = Job.Arguments.GetString("email/subject");
string body = Job.Arguments.GetString("email/body");
MailUtilities.SendEmail(email,subject, body);
Page.ReturnToPreviousPage("Email Sent");
}
}
}
]]></Text>
</ServerScript>
</WebForm>Explanation:
- RibbonButton
- Removed Click="" handler. This property could be left but would not do anything.
- Added an 'ID'. This ID is used to identify what button was clicked on the server.
- Form_Submit
- Now returns a value
- This value tells the system what the result of the action is.
- For example, valid return results could be
- Set a Page Error and return
- return Page.DefaultAction();
- return Page.NextPage();
- Can have an ActivateHttpRequest object as a parameter.
- The ActivateHttpRequest object allows access to information about the request.
- The previous Form_Submit arguments are still valid and will still work. The request object can be obtained from Page.Request.
Form_Submit(object sender, EventArgs a)
{
Page.Request....
}Control bindings
- The 'Controls' are no longer available during a form submit. Instead, all values must be bound into the job.
- The Script can then read these values from the job.
- The Form_Submit could update the job with information and then regenerate the form by returning Page.DefaultAction();