> For the complete documentation index, see [llms.txt](https://inscada.gitbook.io/ins/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://inscada.gitbook.io/ins/en-1/programing/apis/confirmation-functions.md).

# Confirmation Functions

Confirmation functions are used to obtain confirmation from users via script/expression on the inSCADA platform.

## Getting Approval From Users

#### ins.confirm(String type,String title, String message, Object object)

Confirmation about actions to be taken from users provides information for events that are happening. For example, you can have the user enter an information message about why a system has stopped. In this way, you can get reports about the reasons for stopping the system from inSCADA.

inSCADA offers 8 different methods of obtaining approval or information. You specify these methods with the Type parameter. They are

* combo-text-yes
* combo-text-yesno
* combo-yes
* combo-yesno
* text-yes
* text-yesno
* yes
* yesno

Other parameters in ins.confirm method are;

* Title : Defines the title of the dialog to be opened.
* Message : Defines the message of the dialog to be opened.
* Object : It is an object that shapes the dialog window and defines the methods to be executed when the yes and no buttons are clicked.

Now let's examine how our dialog window for obtaining confirmation or information according to these parameters is formed.

```javascript
var obj = {};
            obj.options = [
                "HV Circuit Breaker Opened at Transformer Center",
                "HV Circuit Breaker Opened at Unit Cubicle",
                "HV Circuit Breaker Opened at Grid Cubicle",
                "Water Sold Out",
                "Operator Fail",
                "Mekanik Fail",
                "RTU/PLC Fail",
                "SCADA Fail"];
            obj.onScript =  function(a){
                ins.notify("info", "Reason for Stopping", a.comboValue+"-"+a.textValue);
                ins.writeLog("info", "Unit 01","Reason for Stopping", a.comboValue+"-"+a.textValue);
            };
            obj.offScript = function(a){
                ins.notify("info","Canceled","No any message"}; 
            };
    
        ins.confirm("combo-text-yes", "PLEASE ANSWER..", "WYH DID THE UNIT STOP?", obj);
```

When you examine the above code, you can see that the object that defines our dialog window with the object obj is defined.

* Object.options : Creates a list of options to be seen in Combobox.
* Object.onScript : Defines the script to be executed when the Yes button is clicked.
* Object.offScript : Defines the script to run when the No button is clicked.

The type, Title, Message, and object parameters are sent to the API on the line where the ins.confirm API is called.

![Figure 1 : combo-text-yes](/files/-LlX8eRcN4-WZogPq2pU)

![Figure 2 : combo-text-yesno](/files/-LlX8itr9ugI5M1t9Zgd)

![Figure 3 : combo-yes](/files/-LlX8phbkDDPcmP6i_1q)

![ Figure 4 : combo-yesno](/files/-LlX8wJ2uK7l-zWJny7v)

![Figure 5 : text-yes](/files/-LlX91qvTcy9ooAxOLDX)

![ Figure 6 : yesno](/files/-LlX96iLJDnodkJ_kTeQ)

![Figure 7 : yes](/files/-LlX9DCvh7URyMoXgrKR)

![Figure 8 : yesno](/files/-LlX9IEZhKxr3TnbmFfk)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://inscada.gitbook.io/ins/en-1/programing/apis/confirmation-functions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
