# Override button of process management

**URL:** <https://forum.kintone.dev/t/override-button-of-process-management/382>\
**Category:** General\
**Created:** [June 11, 2021, 8:59am UTC](https://forum.kintone.dev/t/override-button-of-process-management/382 "2021-06-11T08:59:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [June 11, 2021, 8:59am UTC](https://forum.kintone.dev/t/override-button-of-process-management/382/1 "2021-06-11T08:59:41Z")

</div>

Hi, I would like to find a way to override a cancel and confirm button on the status of process management.&nbsp;

&nbsp;for example, before the user can change the status I can pop up a input box for the user to input or request them to input some data before proceed with the next step.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [June 13, 2021, 11:22pm UTC](https://forum.kintone.dev/t/override-button-of-process-management/382/2 "2021-06-13T23:22:54Z")

</div>

Hello!

In Kintone API, the process management has an action event. In the action event, if you set up an error property to an event object and return it, the string set up in the error will be displayed as an alert, and the action will be canceled.

So if there is any field with no value input, you can use this to do a similar thing.

Kintone Developer Program - Get Process Management Settings  
[https://developer.kintone.io/hc/en-us/articles/115005238087-Get-Process-Management-Settings](https://developer.kintone.io/hc/en-us/articles/115005238087-Get-Process-Management-Settings)

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [June 14, 2021, 1:25am UTC](https://forum.kintone.dev/t/override-button-of-process-management/382/3 "2021-06-14T01:25:52Z")

</div>

Thanks, I figured it out.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [June 14, 2021, 6:46am UTC](https://forum.kintone.dev/t/override-button-of-process-management/382/4 "2021-06-14T06:46:21Z")

</div>

I tried to add "error" message to action event, however, I don't know the object structure.

> Actions can be cancelled including an error message, by setting an&nbsp;error&nbsp;property in the event object and returning it. The string in the&nbsp;error&nbsp;property will be displayed as an error message.

&nbsp;Where should I put a error message?&nbsp;

&nbsp;I tried to add "error" attribute to the object directly, however, the service just return a message that it is incorrect. They only show&nbsp;

> Error occurred
> 
> Invalid event object.

&nbsp;

Try :&nbsp;

> kintone.events.on("app.record.detail.process.proceed",(events)=\>{
> 
> &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;event&nbsp;=&nbsp;events.record;
> 
> &nbsp;&nbsp;&nbsp;&nbsp;console.log(events);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;event['Status']['error']&nbsp;=&nbsp;"Wrong"
> 
> });

And It didn't work.

&nbsp;

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [June 14, 2021, 6:50am UTC](https://forum.kintone.dev/t/override-button-of-process-management/382/5 "2021-06-14T06:50:51Z")

</div>

Ok. I've figure it. It has to add in the action. The code below is work normally.

> kintone.events.on("app.record.detail.process.proceed",(events)=\>{
> 
> &nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;event&nbsp;=&nbsp;events.record;
> 
> &nbsp;&nbsp;&nbsp;&nbsp;console.log(events);
> 
> &nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;events['action']={'error':&nbsp;"Wrong"}
> 
> });

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [June 15, 2021, 11:09pm UTC](https://forum.kintone.dev/t/override-button-of-process-management/382/6 "2021-06-15T23:09:29Z")

</div>

The script you wrote seems to be: if an error value is returned, an error message will display, and the action will be canceled.

If you return when an error property is set up to an event object, a string set up in the error will display and the action will be cancelled. Hence, you should set up a string in the event.error like the following:

```
kintone.events.on("app.record.detail.process.proceed",(event)=>{
var record = event.record;
console.log(event);
if (!record['str'].value){
event.error = 'Wrong';
};

return event;

});

```

\*In the above script, an error message will display, and the action will be canceled when the str field is null.

---

<div class="post-metadata">

**Author:** ![legacy\_user](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.kintone.dev/legacy_user/32/25_2.png) [@legacy\_user](https://forum.kintone.dev/u/legacy_user)\
**Post date:** [June 17, 2021, 10:25am UTC](https://forum.kintone.dev/t/override-button-of-process-management/382/7 "2021-06-17T10:25:29Z")

</div>

@Yuzo Arai

Thank you for your answers. I’ve tested and It works perfectly.

&nbsp;
