Form component showing form section twice in UI Builder

gjz
Giga Sage

I am trying to solve a gap in ServiceNow mobile functionality and I have run into an issue that I can't figure out.

 

To get our IT staff to use Now Mobile Agent while they are in the field, they need to be able to update catalog task variables.  ServiceNow does not have any OOB functionality, but I think I can do it based on an old post from someone who had the same requirement and using Mobile App Bridge and the documentation.

 

The first thing I needed to do was create a page in UI Builder for the form component and a button for the Mobile App Bridge to communicate with the mobile app.  I created a new view called mobile_variables that has just the variable formatter on it.  It works fine in the core UI.  However, in UI Builder, it displays twice and I don't know why.  I'm not finding any documentation or posts on using the Form Controller that are helping me understand, hopefully someone has used it and can help me.  

 

New view in Form Builder:

 

gjz_0-1793227779682.png

 

 

Core UI mobile_variables view:

 

gjz_0-1793226820983.png

 

UI Builder mobile_variables view:

 

gjz_1-1793227010487.png

 

As you can see, my UI Builder page is pretty basic:

 

gjz_2-1793227066312.png

When I added the Form component to the page, I kept the preset that comes with it and all I did was change the view in the Form Controller data resource.

 

gjz_3-1793227158900.png

 

Can anyone help me figure out why the variable formatter displays twice?

7 REPLIES 7

Sanjay191
Kilo Patron

Hi @gjz 
what is the business requirement and what do you want to achieve ?
As per understanding you want the functionality that field agent will update the catalog task variable right ?

Thank you

Hii Sanjay, Yes, they need to update any catalog variable from the mobile app.  The issue, however, is why the variables display twice in the UI Builder page when the variables formatter is only added once in the view.

Hi @gjz 

I am not sure why you are configuring the Workspace for this requirement. If your objective is to allow users to update catalog variables directly from the Now Mobile Agent application, I would suggest implementing this functionality using a custom button in the Mobile Agent application instead.

You can achieve this by creating a custom function that allows users to update the catalog item variables by providing the required inputs directly from the Mobile Agent application.

Suggested Approach

1. Create a Function to Update Catalog Variables

First, create a custom function that will be responsible for updating the catalog item variables. This function will accept the required inputs from the Mobile Agent application, such as the variable values that users want to modify.

2. Configure a Script-Based Action Inside the Function

Within the function, create a Script-Based Action that will handle the actual variable update logic. The action should receive the input parameters provided by the Mobile Agent application and use them to update the corresponding catalog variables on the requested item.

For example, the logic would look something like this:

ritm.variables.your_field_name =
    parm_input['your_input_field_name'];

Here:

  • ritm represents the Requested Item record whose variables need to be updated.

  • your_field_name represents the catalog variable name that you want to update.

  • parm_input['your_input_field_name'] represents the input value received from the Mobile Agent application.

3. Configure the Input Fields in the Mobile Agent Application

Once the function is created, configure the required input fields in the Mobile Agent application so that users can provide the values they want to update.

The inputs should be mapped to the corresponding parameters defined in the function.

4. Execute the Function from the Mobile Agent Button

Finally, configure a custom button in the Mobile Agent application to execute the function. When the user clicks the button, the function will receive the provided inputs, execute the Script-Based Action, and update the corresponding catalog variables on the Requested Item.

This approach allows users to update catalog variables directly from the Mobile Agent application without requiring them to navigate to Workspace or modify the catalog item through another interface.
Note: This configuration is applicable on the sc_req_item containing DATA ITEM in Mobile Agent app.


If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You

Sanjay,

I appreciate you trying, but your answer isn't correct for a few reasons.

1. It doesn't address my question - why the variables formatter appears twice when it should appear once.

2. You can't update catalog items variables on a mobile device unless they already have a value in them.  In my case, they do not so they don't appear on the mobile screen.  If you search the community, you will see updating variables on a mobile device is not supported and the workaround is to create a core UI page or a UI Builder page that is called from the mobile app.  I chose UI Builder because it is the future, where a core UI page is legacy.

 

As an example - the catalog item I'm working on is for hardware replacement.  When the catalog item is entered, the old asset tag is known and entered before submitting the request but the replacement tag is not known.  Since the replacement tag doesn't have a value, it doesn't display on the mobile screen, but the staff need to enter the value when it is pulled from the stockroom.  I'm setting it up so it can be scanned instead of entered, but they can't do either with the OOB functionality because it isn't available on the mobile screen.

 

In my case, I've already built the connection between the mobile app and the UI Builder page and can update the variables like I want, it's just the variables display twice instead of once.