This topic contains 2 replies, has 0 voices, and was last updated by klnpd 7 years, 10 months ago.
-
AuthorPosts
-
December 21, 2016 at 11:05 am #10324
klnpdI’ve created a requisition approval/rejection workflow based on employee purchase limit.
Approvals and Rejections are triggered by buttons added within a workflow state.
Is there any way to add a dialog with an input field (long text) for comment when a user clicks the Reject button? The inputted texts need to then set to update a custom body field on the requisition.
Thank you for any help!!
This is a cached copy. Click here to see the original post. -
December 29, 2016 at 3:30 pm #10325
krobinson98I’ve developed a solution in suitescript 1.0 to get around this.
first: create a user event to add the reject button to the recordtype. You will want to add conditional logic to only display this button in a pending approval state.
form.addButton(‘custpage_buttonreject’, rejectButtonText, ‘onclick_clientReject()’); form.setScript(‘customscript_clientscript’); Second: create a clientscript function which will fire when the button is clicked. This will launch a SUITELET in a popup.
function onclick_clientReject(){
var url = nlapiResolveURL(‘SUITELET’, ‘customscript_suiteletrejectcomments’, ‘customdeploy1′)+’&entity=’ + nlapiGetRecordId() + ‘&recordType=’ + nlapiGetRecordType(); nlExtOpenWindow(url, ”, 500, 220, ”, false, ‘Reject’); } Third: the SUITELET will contain the field to add comments and when the reject button is clicked you will save the data to the body field and switch the approval status to rejected. your workflow will then switch states based on the status changing. this will need to be added to the workflow transition
if (request.getMethod() == ‘GET’) {
recordId = request.getParameter(“entity”); var form = nlapiCreateForm(‘Reject Comments’, true); form.setScript(‘customscript_quotehelper’); var field = form.addField(‘rejectcomments’, ‘textarea’, ‘Comments’); field = form.addField(‘entityid’, ‘text’); field.setDisplayType(‘hidden’); field.setDefaultValue(recordId); field = form.addField(‘button’, ‘text’); field.setDisplayType(‘hidden’); field.setDefaultValue(‘customerreject’); form.addSubmitButton(‘Reject’); form.addButton(‘close’,’Close’,’closeButton()’); response.writePage(form); } else { //on post save the reject comments in your transaction body field. }
Hope this helps.
-
January 5, 2017 at 11:52 am #10326
klnpdI’ll give it a try, thanks!
-
AuthorPosts
You must be logged in to reply to this topic.