# Controller switches to automatic mode when executing API.RAPID.setVariableValue

**URL:** <https://tech-community.robotics.abb.com/t/controller-switches-to-automatic-mode-when-executing-api-rapid-setvariablevalue/11859>\
**Category:** AppStudio\
**Tags:** r, rws2, setvariablevalue, automatic-mode, auto-mode\
**Created:** [April 2, 2025, 11:38am UTC](https://tech-community.robotics.abb.com/t/controller-switches-to-automatic-mode-when-executing-api-rapid-setvariablevalue/11859 "2025-04-02T11:38:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polyblank](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@Polyblank](https://tech-community.robotics.abb.com/u/Polyblank)\
**Post date:** [April 2, 2025, 11:38am UTC](https://tech-community.robotics.abb.com/t/controller-switches-to-automatic-mode-when-executing-api-rapid-setvariablevalue/11859/1 "2025-04-02T11:38:59Z")

</div>

I tried to change the value of a RAPID variable in an user defined function in AppStudio like so:  
In UI designer a TComponents.Select with the Option content  
text1|var1;  
text2|var2;  
was created. On the onChange event the following code will be invoked:

var self = this;  
await UserFunction.dropdown(self)

If the UserFunction dropdown is defined as

async (self) =\> {  
await API.RAPID.setVariableValue(“VISU”, “st\_UIselected”, self.value);  
}

and the value is changed by the user while the controller is in manual mode, the controller changes to automatic mode. The following events will be written in the event log:

“Automatic mode requested”, “Motors OFF state”, “Automatic mode confirmed”.

_Why is the automatic mode requested when using the API for setting a variable value?_  
_Is it possible to suppress the request?_

Howewer, it is possible to circumvent the problem with the following definition for dropdown, just using RWS2:

async (self) =\> {

let rapidVariable = await RWS.Rapid.getData(‘T\_ROB1’,‘VISU’,‘st\_UIselectedRecipe’);

await rapidVariable.setValue(self.value);  
}

---

<div class="post-metadata">

**Author:** ![yitong](https://avatars.discourse-cdn.com/v4/letter/y/3da27b/32.png) [@yitong](https://tech-community.robotics.abb.com/u/yitong)\
**Post date:** [April 3, 2025, 5:27am UTC](https://tech-community.robotics.abb.com/t/controller-switches-to-automatic-mode-when-executing-api-rapid-setvariablevalue/11859/2 "2025-04-03T05:27:29Z")

</div>

Hello,

We simplified the scenario into a webapp with one select component with onchange event as below:

 ![](https://europe1.discourse-cdn.com/flex005/uploads/robotics1/original/2X/e/e5b94b39d79b9b74d95570c5bca81f9d47208148.png)

We made a simple test as the attached video:

1. Turn to manual mode
2. Clear all event logs
3. Open the webapp and trigger a onchange event of the Select component
4. The variable value is changed correctly, no event logs mention operation mode has been changed into Auto, and apparently the controller is still in manual mode.

Please let us know if anything different from your scenario. That would be helpful if your appstudio project and the RobotWare version can be shared for further analysis.

[SetValueInManualMode.mp4](https://abbissp01sastaasblb0749.blob.core.windows.net/appstudioproduct/assets/forum-resources/14655_SetValueInManualMode.mp4)

---

<div class="post-metadata">

**Author:** ![Polyblank](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@Polyblank](https://tech-community.robotics.abb.com/u/Polyblank)\
**Post date:** [April 3, 2025, 8:30am UTC](https://tech-community.robotics.abb.com/t/controller-switches-to-automatic-mode-when-executing-api-rapid-setvariablevalue/11859/3 "2025-04-03T08:30:29Z")

</div>

Hi,

thanks for the response. I reproduced your test with a simple webapp and the controller still changes into automatic mode.

After clearing all event logs and changing the selected entry in the select component in manual mode the following is shown in the event log (in chronological order):

10010 Motors OFF state  
10012 Safety guard stop state  
10016 Automatic mode requested  
10010 Motors OFF state  
10017 Automatic mode confirmed

Here are infos about the system:  
RobotWare 7.14.3  
RobotOS 12.0.2  
RobotControl 7.14.3  
Robots 1.14.0  
FlexPendantSoftwareUpdate 1.15.3

---

<div class="post-metadata">

**Author:** ![yitong](https://avatars.discourse-cdn.com/v4/letter/y/3da27b/32.png) [@yitong](https://tech-community.robotics.abb.com/u/yitong)\
**Post date:** [April 29, 2025, 2:00am UTC](https://tech-community.robotics.abb.com/t/controller-switches-to-automatic-mode-when-executing-api-rapid-setvariablevalue/11859/4 "2025-04-29T02:00:40Z")

</div>

I think this is a complex issue, and you might need to contact the AppStudio support team directly through this mail [global-appstudiosupport@abb.com](mailto:global-appstudiosupport@abb.com) (this channel is also available on the AppStudio Help page).
