Hi Everyone, I am trying to copying a deployment(S...
# general
t
Hi Everyone, I am trying to copying a deployment(Scheduled status) for Map/Reduce script using suitelet. However I am able to copying it but the fields under Schedule subtab(start date and start time) are not same as original deployment. Please see the attached screenshots. I used below sample code to copy the deployment.
Copy code
newDeploymentRecord = record.copy({
  type: record.Type.SCRIPT_DEPLOYMENT,
  id: oldDeploymentRecord.id,
  isDynamic: true,
});

var deploymentTitle = oldDeploymentRecord.getValue({ fieldId: 'title' }) || '';
if (deploymentTitle) {
  // Adding a suffix to the deployment title.
  newDeploymentRecord.setValue({ fieldId: 'title', value: deploymentTitle + '[New]' });
}
newDeploymentRecord.setValue({ fieldId: 'status', value: oldDeploymentRecord.getValue({ fieldId: 'status' }) });
newDeploymentRecord.setValue({ fieldId: 'loglevel', value: oldDeploymentRecord.getValue({ fieldId: 'loglevel' }) });
newDeploymentRecord.setValue({ fieldId: 'startdate', value: oldDeploymentRecord.getValue({ fieldId: 'startdate' }) });
newDeploymentRecord.setValue({ fieldId: 'starttime', value: oldDeploymentRecord.getValue({ fieldId: 'starttime' }) });
return newDeploymentRecord.save();
Can anyone help me out to copy these values ?
b
t
Thanks, This is helpful