Publishing a model creates a hosted tool item that can be run as a custom web tool.
The following steps are required to publish a model:
- Create a model.
- Add variables for inputs that need to be configurable for the web tool.
- Set the variables as model parameters.
- Manage the parameters to customize how they appear in the custom web tool.
- Run and save the model.
- Publish the model.
Licensing requirements
Publishing a model requires the licensing and configurations to use ModelBuilder, plus the Publish web tools privilege.
Set variables as model parameters
Variables that are set as model parameters appear as tool parameters when the model is published and opened as a custom web tool, allowing you to specify different data or values than what was specified when the model was created.
Output hosted data variables are automatically set as model parameters, whereas input data and value variables must be manually set as parameters. Output intermediate data variables cannot be set as model parameters.
To set input data and value variables as model parameters, complete the following steps:
- Complete the steps to create or open a model and connect to an analysis session.
- Add data, tools, and variables if necessary.
- Click a variable element to select it.
The element toolbar appears above the selected variable.
- Click Add or remove parameter
.A parameter icon
appears on the variable, indicating the variable is set as a model parameter.
Once the necessary variables are set as model parameters, you are ready to manage the web tool parameters.
Manage web tool parameters
The Manage web tool parameters window is used to reorder and update settings for parameters in the custom web tool.
To manage the web tool parameters, complete the following steps:
- Complete the steps to create or open a model that has data, tools, variables, and model parameters.
- If you haven't already, connect to an analysis session.
- On the action toolbar, click Manage web tool parameters
.The Manage web tool parameters window appears. The parameters from the model are listed in the order they were added. Each parameter has a name and alias. The alias is linked to the Parameter label setting.
Note:
You cannot add or remove parameters from the Manage web tool parameters window. For information about adding and removing parameters, see Set variables as model parameters.
- Click Expand
to show the settings for a parameter. - Update the following settings as necessary:
- Parameter label—A short label for the tool parameter. This text will appear as the parameter name in the tool pane for the custom web tool. The label should be short, descriptive of the purpose of the parameter, and written in plain language.
- Pop-up help text—A short description for the tool parameter. This text will appear when you click the help button
next to the parameter in the tool pane for the custom web tool. Include a description of what the parameter does, how different values impact the tool results, the supported inputs, and the default values as necessary. - Required—Indicates whether the parameter is required to validate and run the tool. If the model parameter is connected to one or more required tool parameters, this value will be turned on and will not be editable. If all connected tool parameters are optional, the model parameter can be turned on to make the parameter required or turned off to make the parameter optional. Making a parameter required will force the user to provide an input before the web tool can be run.
- Data type—Indicates which inputs are compatible with the parameter. This value is based on the variable data type and cannot be changed.
- Filter—Determines limits or restricts the input values or data that can be specified for the parameter. The options depend on the data type as follows:
- Double—A minimum and maximum value
- Feature layer—A list of allowable feature types, including multipoint, point, line, and polygon
- Field—A list of allowable field types
- Integer—A minimum and maximum value
- String—A list of unique values
- Include default value—Indicates whether the tool parameter has a default value. When turned on, the parameter will use a default value based on the variable value. When turned off, the parameter will be empty by default. A default value can be used to guide the user's inputs or simplify the web tool because the user does not need to update the parameter manually. This setting should be used for parameters that have a menu of accepted values, such as units, and parameters in which the same input value is expected to be used frequently without needing to be updated.
Note:
Default values are not appropriate for most text, number, or feature layer inputs.
Default values should also not be used for parameters you may want to leave empty, such as an optional feature layer input. The default value will be used when the tool is run, even if the value is cleared manually from the tool pane of the published web tool.
- Default value—Indicates the default value for the tool parameter. To change the default value, update the value of the variable in the model diagram. The default value should be a value that will give an accurate or preferred result in most cases. This setting is only available if Include default value is enabled.
- Click Collapse
to hide the parameter settings. - Repeat the previous three steps for each of the remaining parameters.
You can also change the order of the parameters if necessary.
- Click Reposition
next to a parameter name, and drag the parameter to a different position.Alternatively, click Reposition, and choose an option from the menu. Depending on the position of the parameter, the options will include Move up, Move down, Move to top, and Move to bottom.
- Click Save.
The web tool parameter settings are saved and the Manage web tool parameters window closes. You are now ready to publish the model.
Publish a model
Publishing a model creates a tool item, which can be shared and run as a custom web tool.
To publish a model, complete the following steps:
- Complete the steps to create or open a model that has data, tools, variables, and parameters.
Note:
Models that meet all required publishing criteria can be published without connecting to an analysis session. If you have a model that is ready to publish, open the model and proceed to step 6.
- If you haven't already, connect to an analysis session.
- Run the model.
Running the model is not required, but helps ensure the web tool will run successfully.
- Save the model.
The published web tool will be based on the saved analysis model item. The model must be saved before it can be published. If any changes are made to the model, you must save it again.
Before you publish the model, preview the web tool to ensure that the correct web tool parameters have been set.
- On the model toolbar, click Preview web tool
.A preview of the web tool appears in the Analysis pane. If changes to the web tool are required, return to the workflows to set and manage parameters. Click Preview web tool again to update the preview.
Once the preview shows all the parameters and configurations you want in the web tool, you can publish the model.
- On the model toolbar, click Publish
.The Publish as web tool window appears. If the publishing requirements are not met, review the remaining requirements, close the Publish as web tool window, and complete the requirements before returning to this workflow.
Learn more about publishing requirements
If the publishing requirements are met and you are connected to an analysis session, you can close the Publish as web tool window, disconnect from the analysis session, and repeat this step in view-only mode.
- Do the following for the new item:
- Provide a title.
The title cannot include spaces. You can update the title for the tool item after it is published from the item page.
- Choose a folder in My content where you want to save the item.
- Provide tags and a summary that describe the item.
- Provide a title.
- Click Publish.
The model is published and a tool item is created.
- Click Open web tool item to open the details for the tool item, or close the Publish as web tool window.
You can open the custom web tool from the Tools pane by clicking Open custom web tool. You can also share the tool item with your organization or groups from the details page.
Note:
You cannot share tool items with the public.
Overwrite a web tool
When a model has already been published, the Publish button is replaced with the Overwrite button. You can make changes to the existing web tool by updating the model, and completing the steps to publish the model using the Overwrite button.
Publishing requirements
All of the requirements described below must be met to enable publishing an analysis model as a web tool.
Publishing user privileges
Your user account must meet the licensing requirements to publish analysis models as web tools. If your account does not meet the licensing requirements, the Publish button will not be available.
To update your user account privileges, contact your organization administrator.
Create a hosted output
An analysis model must create a hosted feature layer or table layer output before it can be published as a web tool. By default, all tools added to a model create intermediate outputs, rather than hosted outputs.
To meet this requirement, ensure that one tool has the Result layer parameter set to Create hosted layer or Overwrite existing layer. The hosted outputs will be set as model parameters and added to the web map after the model or web tool is run. Create a hosted layer for the output you want to visualize as a result of the analysis, such as the last tool in the model. For best results, only create hosted outputs for one tool in the model.
Manage web tool parameters
Errors in the web tool parameters must be resolved in the Manage web tool parameters window.
The The default value is outside the filter range message appears if the default value and filter range are not compatible (for example, the filter values are numbers between 1 and 10 and the default value is 11). The default value for the model parameter is based on the variable parameter and the filter values are set in the Manage web tool parameters window. To resolve the error, update the filter values in the Manage web tool parameters window, or change the variable value to update the default parameter value.
Tools are ready to run
All tools and required inputs and outputs must be in a ready-to-run or has-been-run state. If one or more required elements is not ready to run, this requirement will not be met. To resolve this issue, open the tool element to review errors or set required parameters. You must be connected to an analysis session and the model must be active before you can make updates to the model.
Save the model changes
Pending changes to the model must be saved. The published web tool is based on the saved analysis model item. If the model has unsaved changes, publishing will not be enabled.
Run the model
It is recommended that you run the complete model successfully before it is published as a web tool to ensure the web tool will function correctly and create the expected outputs.
Limitations
Field information cannot be obtained for web tool parameters created from field variables where the input dataset is an output from an analysis tool or when the same field variable is used for multiple input datasets. As a result, the following limitations apply to the web tool parameter:
- The web tool parameter will not have a menu of field options. Instead, a text box will be available to type the field name.
- Field type filters set in the Manage web tool parameters window will not be honored.