Hi
Have a send mail button, and when I push that one I want to update a status field as sent.
In the Javascript workflow is says clearly not to mess with that function
If I make a second button with a custom javascript for changing the field value I can not make a combination button is seems?
Do I dare to set the update code in to the _RAGIC_AUTOGEN_SEND_CUSTOM_MAIL_42346 function?
function _RAGIC_AUTOGEN_SEND_CUSTOM_MAIL_42346(nodeId){
// WARNING: Please DO NOT edit auto-generated script.
var result = db.sendCustomEmail(JSON.stringify(
{"THIS_PATH":"/ekonomi/1","THIS_NODE_ID":nodeId,"type":"actionButton","key":"3","asyncSend":false,"IS_SHOW_SUCCESS_MESSAGE":true,"IS_CUSTOM_SUCCESS_MESSAGE":false,"CUSTOM_SUCCESS_MESSAGE":""}
), response);
}//END_RAGIC_AUTOGEN_SEND_CUSTOM_MAIL_42346
function setStatusAsSent(recordId) {
var query = db.getAPIQuery("/ekonomi/1"); //get the query object for a sheet with path to sheet
var entry = query.getAPIEntry(recordId); //get the record object for the current record
entry.setFieldValue(1000460, "Sent");
entry.save();
}
I added some code to the function and it behaves as I want to.
Please give a heads up if this is an absolute no go
function _RAGIC_AUTOGEN_SEND_CUSTOM_MAIL_42346(nodeId){
// WARNING: Please DO NOT edit auto-generated script.
var result = db.sendCustomEmail(JSON.stringify(
{"THIS_PATH":"/ekonomi/1","THIS_NODE_ID":nodeId,"type":"actionButton","key":"3","asyncSend":false,"IS_SHOW_SUCCESS_MESSAGE":true,"IS_CUSTOM_SUCCESS_MESSAGE":false,"CUSTOM_SUCCESS_MESSAGE":""}
), response);
var query = db.getAPIQuery("/ekonomi/1"); //get the query object for a sheet with path to sheet
var entry = query.getAPIEntry(nodeId); //get the record object for the current record
entry.setFieldValue(1000460, "Sent");
entry.save();
entry.lock();
}//END_RAGIC_AUTOGEN_SEND_CUSTOM_MAIL_42346
My colleague tried similar method before, but this has the risk of the AUTOGEN function and code been changed by the system without you noticing.
So we avoid using this after the code got unintended changes.
Thanks for sharing
So basically, since combine buttons is not available for custom made buttons the solution is to do the send mail function in the JavaScript editor myself and not using the “ready made” one
Since manually created buttons will not appear in the “Combine Buttons” option.
You can set up an Action Button to update values (e.g., update a status field as “sent”). After setting up this button, you can then combine it with the “Send Mail” button.
You can add a lock record action button with this method if needed.
Please note that the Combine Buttons is only applicable to action buttons created from Custom Buttons under Form Tools, so the lock record action button cannot be combined.