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

Created by Joshua Miller, Modified on Fri, 21 Mar at 11:02 AM by Joshua Miller

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/872has 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';

}

})

 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article