Make a copy of vendor or customer records using user event script.

To make a copy of vendor or customer records, the create context type can be used instead of copy context type in the user event script.

In the user event script, beforeSubmit(scriptContext) entry point is selected.

function beforeSubmit(scriptContext) {
            try {
                let newRecord = scriptContext.newRecord;
                if (scriptContext.type == 'create') {
                    newRecord.setValue({
                        fieldId: 'fieldId',
                        value: value,
                    });                  
                }
            }
            catch (e) {
                log.error("error@beforeSubmit",e)
            }
        }

It is because in the view mode of the record, “Make a copy” option is not available in the Actions menu.
We need to edit the record, and from Actions menu select “Make a copy” option.

Leave a comment

Your email address will not be published. Required fields are marked *