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.
Complete the following steps to set input data and value variables as model parameters:
- 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.
Complete the following steps to manage the web tool parameters:
- 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 on 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.
- 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 where the same input value is expected to be used frequently without needing to be updated. Default values are not appropriate for most text, number, or feature layer inputs.
- 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 your model.
Publish a model
Publishing a model creates a Tool item, which can be shared and run as a custom web tool.
Complete the following steps to publish a model:
- Complete the steps to create or open a model that has data, tools, variables, and parameters.
- If you haven't already, connect to an analysis session.
- Run the model.
Running the model will help ensure the web tool will run successfully.
Before you publish the model, you should preview the web tool to ensure the correct web tool parameters have been set.
- Save the model.
The published web tool will be based on the saved analysis model item. The model must be run and saved before it can be published. If any changes are made to the model, you must run and save it again.
- 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.
- Do the following for the new item:
- Provide a title.
- Choose a folder in My content where you want to save the item.
- Provide tags and a summary that describe the item.
- 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.
Publishing requirements
All of the following requirements 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.
Model supports web tool publishing
Only one web tool can be published per analysis model item. Therefore, if the analysis model has already been published to create a web tool, the Model supports web tool publishing requirement will not be met.
You must also have editing permission for an analysis model to publish it, meaning you must be the model owner or an administrator of the organization where the analysis model is hosted.
You can resolve this publishing requirement by either deleting the existing published Tool item or creating a copy of the model. If you delete an existing Tool item and the recycling bin is enabled in your organization, you must also remove the Tool item from the recycling bin before this requirement will be met.
To create a copy of a model that was already published or was shared with you, complete the following steps:
- On the model toolbar, click Save as.
- Do the following for the new item:
- Provide a title.
- Choose a folder in My content where you want to save the item.
- Provide tags and a summary that describe the item.
- Click Save.
The new analysis model is created and opens in view-only mode. You can now activate the model and make changes if necessary, then publish it to create a web tool.
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. A hosted layer should be created 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 message The default value is outside the filter range will appear 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.
Run the model
The complete model must be run successfully before it can be published as a web tool to ensure the web tool will function correctly. If additional changes are made to the model following the successful run, you must rerun the tool before publishing will be enabled.
Save the model changes
The model must be saved following a successful run. The published web tool is based on the saved analysis model item. If the model has unsaved changes, publishing will not be enabled.