Store image URL in the sales order.

Create Transaction body field in the sales order. When the image uploaded this image url stored in the sales order ..

in Entry file (.js file)


define(
	'JJ.upload.check'
	, [
		 'OrderHistory.Details.View', 'jj_upload_check.tpl', 'Utils', 'JJ.upload.check.Model',
		"JJ.upload.check.View"
	]
	, function (
		 OrderHistoryDetailsView, jj_upload_check_tpl, Utils, uploadCheckModel, uploadCheckView
	) {
		'use strict';

		return {
			mountToApp: function mountToApp(container) {
				// using the 'Layout' component we add a new child view inside the 'Header' existing view 
				// (there will be a DOM element with the HTML attribute data-view="Header.Logo")
				// more documentation of the Extensibility API in
				// https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/index.html

				/** @type {LayoutComponent} */
				var layout = container.getComponent('Layout');
				_.extend(OrderHistoryDetailsView.prototype, {
					template: jj_upload_check_tpl
					,
					events: _.extend({}, OrderHistoryDetailsView.prototype.events, {
						
						'click [data-action="btn-data-action"]': 'showcheckmodal'
					}),
				
					showcheckmodal: function showcheckmodal() {
					
						var view = new uploadCheckView({
							application: container,
							salesorderID: this.model.id

						});
						view.showInModal();
					}
				})
			}
		};
	});

in Suitescript

StoreUrl: function StoreUrl(checkImageId, salesOrderId) {
				try {
					nlapiLogExecution('debug', 'checkImageId', checkImageId);
					var record = nlapiLoadRecord('salesorder', salesOrderId)
					nlapiLogExecution('debug', 'record', record);
					record.setFieldValue('custbody_jj_imageurl', checkImageId);
					return nlapiSubmitRecord(record);
				} catch (error) {
					console.log(error);
					return false
				}
			}

Leave a comment

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