Adding to a Detail From a Lookup in Creatio (formerly bpm’online)

When having a detail with only one lookup, using a whole new edit page for it isn’t really needed, a lookup pop up is all you’d need. The academy has already gone over this but I thought I would just simplify the article. For my example I will create a case subscription detail where you can select contacts in a pop up lookup. Whens it’s all done it will look like this.

First step is making a detail the normally way you would, create the object and use the detail wizard.

All the code from this article will go in the detail schema and not the page. The detail wizard usually names this something like “UsrSchema37442371Detail”.

Open up your detail schema and there isn’t a lot in there it will look like this.

define("UsrSchema37442371Detail", ["LookupMultiAddMixin"], function() {
	return {
		entitySchemaName: "UsrCaseSubscription",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {}
	};
});

We’ll paste in the code to make it look something like this.

define("UsrSchema37442371Detail", ["LookupMultiAddMixin"], function() {
	return {
		entitySchemaName: "UsrCaseSubscription",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		mixins: {
			LookupMultiAddMixin: "Terrasoft.LookupMultiAddMixin"
		},
		methods: {
			init: function() {
				this.callParent(arguments);
				this.mixins.LookupMultiAddMixin.init.call(this);
			},
			getAddRecordButtonVisible: function() {
				return this.getToolsVisible();
			},
			onCardSaved: function() {
				this.openLookupWithMultiSelect();
			},
			addRecord: function() {
				this.openLookupWithMultiSelect(true);
			},
			getMultiSelectLookupConfig: function() {
				return {
					rootEntitySchemaName: "Case",
					rootColumnName: "UsrCase",
					relatedEntitySchemaName: "Contact",
					relatedColumnName: "UsrContact"
				};
			}
		}
	};
});

Here’s what I added to the original detail schema. You’ll paste in the code exactly how it is (this is the same code from the academy article with comments cleaned out) – no need to make any changes to the code.

  1. The “LookupMultiAddMixin” string in the top, between the square brackets
  2. The mixins section
  3. The methods section

Be sure to replace an existing section so you don’t end up with duplicates. Also, be sure you don’t replace the line for entitySchemaName and also the first string in the file after “define” (the name of the detail schema).

This last part is important. At the end of that code, you need to change 4 things:

  • rootEntitySchemaName – This is the parent object type. Whatever is the parent object of your detail needs to go here. This is usually the object of the page your detail is on, so if it’s on the Case page, this would be “Case”
  • rootColumnName – The column on the detail object that relates to the parent object goes here.
  • relatedEntitySchemaName – Whatever you are trying to lookup goes here.
  • relatedColumnName – The column on the detail to put the lookup results in goes in here.

If you test this and the lookup is empty it’s probably because these last parts are filled in wrong.

Submit a Comment

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

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!