Hi, I would like to find a way to override a cancel and confirm button on the status of process management.
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.
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
Thanks, I figured it out.
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 error property in the event object and returning it. The string in the error property will be displayed as an error message.
Where should I put a error message?
I tried to add "error" attribute to the object directly, however, the service just return a message that it is incorrect. They only show
Error occurred
Invalid event object.
Try :
kintone.events.on("app.record.detail.process.proceed",(events)=>{
var event = events.record;
console.log(events);
return event['Status']['error'] = "Wrong"
});
And It didn't work.
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)=>{
var event = events.record;
console.log(events);
return events['action']={'error': "Wrong"}
});
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.
@Yuzo Arai
Thank you for your answers. I’ve tested and It works perfectly.