There is a requirement in mobile application. Client wants me to add save button instead of Add button. Now add button is also for save the data. So, could you please suggest how to do that.
please find the attachment below for reference.
Thank you in advance
Page 1 / 1
HI @aishwarya
You could add a custom field and make it of type button.
Then attach a client script to the control event.
Cheers!
Hi @Shneor Cheshin
Thank you so much for your response. Let me try this
Hi @Shneor Cheshin
I have tried and i added custom filed and written a client script. But the problem is data is not inserting into the table. below added my script. Please suggest any changes required or else suggest me the correct query.
var user_def12 = getControlValue("Escalation", "user_def12"); var user_def5 = getControlValue("Escalation", "user_def5"); var user_def7 = getControlValue("Escalation", "user_def7"); var user_def8 = getControlValue("Escalation", "user_def8"); var user_def9 = getControlValue("Escalation", "user_def9"); var user_def22 = getControlValue("Escalation", "user_def22"); var user_def23 = getControlValue("Escalation", "user_def23"); var user_def11 = getControlValue("Escalation", "user_def11"); var user_def13 = getControlValue("Escalation", "user_def13"); var user_def24 = getControlValue("Escalation", "user_def24"); var escId = getCurrentKeys("Escalation", "esc_id"); var rowId = getDBValue(stringFormat("select metrix_row_id from escalation where esc_id = '{0}'", escId)); var taskTrans = generateDataTransaction("Escalation", "UPDATE", stringFormat("metrix_row_id = '{0}'", rowId));
Add sucess validation at the end of the script. This will help you to understand more. For example
var saved = saveDataTransaction(taskTrans, getMessage("Escalation", "LABEL")); if (saved == true) { alert('Saved'); } else { alert('Error Updating the Record!'); }
Change your methods to lowercase. Instead of var user_def22 = getControlValue("Escalation", "user_def22"); Do var user_def22 = getControlValue("escalation", "user_def22");
Change syntax in generateDataTransaction. I never saw wrapping the parameter with quotes. var taskTrans = generateDataTransaction("Escalation", "UPDATE", stringFormat("metrix_row_id = '{0}'", rowId)); To var taskTrans = generateDataTransaction("Escalation", "UPDATE", stringFormat("metrix_row_id = {0}", rowId));
Are there any errors on the server side? Check server logs. Increase the log level if necessary.
Add debug points with the ‘alert’ method. For example
var escId = getCurrentKeys("Escalation", "esc_id"); if (isNullOrEmptyString(escId)){ alert('escId ' + is empty); }
I hope this will help.
Cheers!
HI @aishwarya
A few things.
Add sucess validation at the end of the script. This will help you to understand more. For example
var saved = saveDataTransaction(taskTrans, getMessage("Escalation", "LABEL")); if (saved == true) { alert('Saved'); } else { alert('Error Updating the Record!'); }
Change your methods to lowercase. Instead of var user_def22 = getControlValue("Escalation", "user_def22"); Do var user_def22 = getControlValue("escalation", "user_def22");
Change syntax in generateDataTransaction. I never saw wrapping the parameter with quotes. var taskTrans = generateDataTransaction("Escalation", "UPDATE", stringFormat("metrix_row_id = '{0}'", rowId)); To var taskTrans = generateDataTransaction("Escalation", "UPDATE", stringFormat("metrix_row_id = {0}", rowId));
Are there any errors on the server side? Check server logs. Increase the log level if necessary.
Add debug points with the ‘alert’ method. For example
var escId = getCurrentKeys("Escalation", "esc_id"); if (isNullOrEmptyString(escId)){ alert('escId ' + is empty); }
I hope this will help.
Cheers!
Hi @Shneor Cheshin
Below is the updated query but still data is not saving. in client script i have tested and found a error .Could you please suggest what i need to change here to insert data from mobile save button. When i am clicking on save button alert is comming but data is not inserting
var escId = getCurrentKeys("Escalation", "esc_id");
var user_def12 = getControlValue("escalation", "user_def12"); var user_def5 = getControlValue("escalation", "user_def5"); var user_def7 = getControlValue("escalation", "user_def7"); var user_def8 = getControlValue("escalation", "user_def8"); var user_def9 = getControlValue("escalation", "user_def9"); var user_def22 = getControlValue("escalation", "user_def22"); var user_def23 = getControlValue("escalation", "user_def23"); var user_def11 = getControlValue("escalation", "user_def11"); var user_def13 = getControlValue("escalation", "user_def13"); var user_def24 = getControlValue("escalation", "user_def24"); var escId = getCurrentKeys("escalation", "esc_id"); //var rowId = getDBValue(stringFormat("select metrix_row_id from Escalation where esc_id = '{0}'", escId)); var rowId = getDBValue(stringFormat("select metrix_row_id from Escalation where esc_id = {0}", escId)); var taskTrans = generateDataTransaction("Escalation", "UPDATE", stringFormat("metrix_row_id = {0}", rowId));