How do I connect fields - e.g. Part to supplier and container?

Step-by-step guide


  1. Click on Modules.
  2. Select the Module with the appropriate form field.
  3. Select the Forms tab.
  4. Select Field List button "Create/Update Fields".
  5. Use the filter to find relevant field.
  6. Select Edit on the field.
  7. Select Custom JavaScript tab.
  8. As depicted in the picture below
  9. Paste or type JavaScript to be added to, in this case, the part field.
  10. NOTE the /lookup/872/ has to match the form number of the Lookup.


  var partDescriptionField = fieldScope.getColumnFromDisplay("Part Description");

  var containerTypeField = fieldScope.getColumnFromDisplay("Container Type");

  var partName = formScope.formdata["customString3"].trim();

  var url = 'api/tenant/' + userInfo.id + '/module/' + formScope.formdata["moduleId"] + '/lookup/872/entities?name=' + escape(partName );

         http({

               url: url

           }).success(

           function (data, status, headers) {

if (data.length > 0) {

 formScope.formdata[partDescriptionField.name] = data[0].customLongText1;

 formScope.formdata[containerTypeField.name] = data[0].customString4;

formScope.alert = {};

 

} else {

formScope.formdata[partDescriptionField.name] = undefined;

formScope.formdata[containerTypeField.name] = undefined;

var msg = "Could not find details for part '"+partName + "'";

formScope.alert = {};

formScope.alert.msg = msg;

formScope.alert.type='warning';

}

})