This topic contains 2 replies, has 0 voices, and was last updated by klnpd 7 years, 10 months ago.

  • Author
    Posts
  • #10324

    klnpd

    I’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.

  • #10325

    krobinson98

    I’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.

  • #10326

    klnpd

    I’ll give it a try, thanks!

You must be logged in to reply to this topic.