# Screen Widgets

The pages that follow will help you build widgets in ASM.  Below, is a list of known issues and details for accessing the API Query Builder

## Widget Builder

You can build a string using the following interface:

```
https://[server]/[system]/InWidgetsTest.htm?widgetid=data-grid
e.g., 

https://hermes8-dev.alembacloud.com/production/InWidgetsTest.htm?widgetid=data-grid
```

* Replace \[server]/\[system] with your specific system URL.
* Replace \[widget name] with one of the following:
  * data-grid
  * call-activities
  * global-search

\*\*You will need some knowledge of the API to modify the string properties by screen/entity.

## Known Issues

<details>

<summary>Screen Designer</summary>

Even though you will see a resize option in screen designer, for widgets, this option is not viable. &#x20;

</details>

<details>

<summary>Grid Builder Syntax Error (10.6.7)</summary>

There is a Known Issue with syntax where if you use the API data-grid query builder, and then use the "copy code" button in 10.6.7, it puts in the incorrect syntax (Slashes and spaces) into the code breaking the widget on lower versions. It also stops any widgets showing on the page.&#x20;

Example:

Copied Code:   "pageFilters": <mark style="color:red;">"</mark>\[{<mark style="color:red;">\\</mark>"id<mark style="color:red;">\\</mark>":<mark style="color:red;">\\</mark>"REF<mark style="color:red;">\\</mark>",<mark style="color:red;">\\</mark>"apiId<mark style="color:red;">\\</mark>":<mark style="color:red;">\\</mark>"Holder.Ref<mark style="color:red;">\\</mark>"}]<mark style="color:red;">"</mark>,

Should be&#x20;

&#x20;  "pageFilters":\[{"id":"REF","apiId":"Holder.Ref"}],

</details>

<details>

<summary>Script Error when Clicking a row in Widget Results</summary>

There is a known issue with widgets wherein you will need to add the following to the widget properties to make the data in the widget "clickable":

<mark style="color:red;">**"navigationEntityType": "asset"**</mark>

Re&#x66;**:**<mark style="color:red;">**Target.Ref**</mark>

**Example:**

{\
&#x20;   "entityType": "person-to-asset-stakeholder-link",

&#x20;   <mark style="color:red;">**"navigationEntityType": "asset",**</mark>\
&#x20;   "columns": "Re&#x66;**:**<mark style="color:red;">**Target.Ref**</mark>,Asset:Target.Name,Type:Target.InfraEntityType.Name",\
&#x20;   "headers": "**,**&#x41;sset,Type",\
&#x20;   "filters": "!@IsDeleted",\
&#x20;   "sorting": "off",\
&#x20;   "pageFilters": "\[{\\"id\\":\\"REQUESTOR\_REF\\",\\"apiId\\":\\"Holder.Ref\\"}]",\
&#x20;   "orderBy": "Target.InfraEntityType.Name",\
&#x20;   "sortBy": "Type"\
}

</details>

<details>

<summary>Results Show Deleted Field Values</summary>

There is a known issue where the query results may return deleted field values and records since the query will pull everything.  To counter this, add the following to your widget properties:

**Status=='A'&\&Target.Status=='A'**

</details>

<details>

<summary>Failed to Open Tasks</summary>

The widgets don't handle opening tasks due to mismatch between the entity type (base-task) and the review url (task). This is a issue in portal as well. If you are on-prem, and you need a quick fix, you can make the below change in InNavigation.js (Cloud clients will need to contact Alemba Support):

{% code overflow="wrap" %}

```
function HandleWidgetNavigation(data/*: {viewType: 'details'|'cti'|'search', entityType: 'call'|'request'|string, entityId?: number, telephoneNo?: string, filters?: {UserId:number}*/) {
    switch (data.viewType) {
        case 'details':
/*Alemba custom - Fix for task widget starts*/
    {
      if(data.entityType === "base-task")
      {
        eWrapperEvent('review' + "task" + data.entityId);
      }
      else
    /*Alemba custom - Fix for task widget Ends*/      
            eWrapperEvent('review' + data.entityType + data.entityId);
            break;
/*Alemba custom - Fix for task widget Starts*/  
    }
    /*Alemba custom - Fix for task widget Ends*/
        case 'cti':
            return OpenMMA(101, data.telephoneNo, null);
        case 'search':
            var Builder = new DrilldownXmlBuilder();
            Builder.AddQDValue("USER_REF", CallRootTypeRef, data.filters.UserId, "cti user", true);
            Builder.AddRefValue("PARTITION", CallRootTypeRef, wrapper.CurrentPartition, true);
            Builder.AddRefValue("OPEN_FLAG", CallRootTypeRef, "1,2,3", true);
            var DrilldownXml = Builder.ToXml();
            return CallSearch(DrilldownXml, "", false, "LoggingUserId=" + data.filters.UserId);
        default:
            throw new Error("navigation type not supported");
    }
}
```

{% endcode %}

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.alemba.com/asm/asm-hermes/setup-and-configure-asm/configuring-your-system/configuring-screens/building-screens-in-asm-designer/screen-widgets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
