Reputation: 281
I created a Button through UE script in Purchase Order. On hitting an alert/prompt would let the user write the text and on hitting OK in prompt box , that text would be saved in a custombody field.
I tried to do submitFields
but it doesn't do anything. Can anyone help me with this?
User event code:
context.form.addButton({
id: 'custpage_reject',
label: 'Reject With Reason',
functionName: 'rejectButton()'
})
context.form.clientScriptModulePath = 'SuiteScripts/mx_rejectionReason_cs.js';
Client script function:
function rejectButton() {
rejectReasonValue = window.prompt("Reason for Rejection ?");
console.log('prompt:', rejectReasonValue)
nsCurrentRecord.submitFields({
type: recType,
id: recId,
values: {
custbody_reasonof_rejection: rejectReasonValue,
},
options: {
enableSourcing: true,
ignoreMandatoryFields: true
}
});
}
Upvotes: 0
Views: 339
Reputation: 812
Hi
I think your submitFields wouldn't work on the currently loaded record.
Try setting the field value on the current record like so:
currentRecord.setValue('custbody_reasonof_rejection', rejectReasonValue);
Hope this works for you!
Upvotes: 1