This article will help user to create an alternate solution for attaching a file via CSV import(enhancement 220827).
Sample script
function attach(type, form){
// declare a variable customfieldid to get the file's internal id
currentContext = nlapiGetContext();
if(currentContext.getExecutionContext() == 'csvimport' && type == 'edit'){
nlapiAttachRecord('file', nlapiGetFieldValue(customfieldid), nlapiGetRecordType(), nlapiGetRecordId());
}
}
1. Create a custom body field. Customization > Lists, Records, & Fields > Entity Fields > New
- Label: File ID
- Type: Document
- Store Value: checked
- Applies To: Customer
- Save
3. Enter information needed on the Basic Information:
- Name: (name of your script)
- Scripts > Script : Upload the sample script Below.
- After Submit Function: attach
- Deployments > Applies to: Customer
Status: Released
- Save
- The CSV file needs at least two columns, one for customer ID and one for the file ID (the file attachment).
Note: Please make sure that Run Server SuiteScript and Trigger Workflows is enabled in the CSV Import Preferences and the file is uploaded to file cabinet.
No comments:
Post a Comment