Hello,

 

I have a problem when trying to modify a lookup value in a Business Process. I have a Source field in Opportunity and when I first select the lookup it displays all of the values. After I click on anything else this happens:

The problem is that there are values in the lookup. I don't know what is happening.

 

Thank you!

Like 0

Like

1 comments

Hello,

 

It`s seems to be an issue that our support should take a look. Please send us an email at support@creatio.com

 

Best regards,

Serhii

Show all comments

Hi community,

I have a list of warehouses that contains the "Primary" field. It's only one of them that can be a primary warehouse.

When a user creates an order, I want the "Warehouse" field can be set automatically to the primary warehouse.

How to do this?

 

Thank you.

Like 1

Like

6 comments
Best reply

I has solved this problem by adding parameter "this" into the "result.collection.each()".

It will be shown as "result.collection.each(function(), this)"

esq.getEntityCollection(function(result) {
	debugger;
	if (!result.success) {
		// For example, error processing/logging.
		this.showInformationDialog("Can't set the location.");
		return;
	}
	result.collection.each(function(item) {
		var primaryWarehouse = {value: item.get("Id"), displayValue: item.get("SceName")};
		this.set("SceWarehouse", primaryWarehouse);
		return;
	}, this)
}, this);

 

You can Use Business Rule for auto populating Some fields. 

https:/academy.creatio.com/docs/user/customization_tools/ui_and_business_logic_customization/business_logic/setup/set_up_a_new_business_rule

 

Hi smit suthar,

 

I have tried to use the "Set field value" action, but it's too simple.

I want to set the value of "Warehouse" with a primary warehouse.

Note: The "Warehouse" section has the "Primary" (boolean) field.

So, for example; I have 2 warehouses, "A" and "B". And, I set the warehouse "B" primary field as TRUE. Then, when the user creates an order, the "Warehouse" field of the order will be filled by "B" automatically.

 

Do you have any other ideas?

Hello David Chandra,

 

Based on the shared information I can assume that your business task can be fully covered with a help of business rules functionality. 

If you'd like to expand the customization you can consider designing the custom business process that will read the needed columns from a page and apply changes with a Modify data element or even with script-task element where you can specify the custom logic with code. 

Alternatively, you can implement your business task with a help of additional development, but we do not have a specific ready to use example of such implementation. 



Best regards,

Anastasiia

Hello Anastasiia,

If we use the Business Rule means, we have to save the order and then use "added data trigger" to set the warehouse value.

Do you know how to set the warehouse value before we save the new order?

 

Regards,

David

Hello Anastasiia,

 

I managed to create a function in the page source code as below:

 

/* Overload the base Terrasoft.BasePageV2.onEntityInitialized method that is called after Creatio initializes the schema of the record page object. */
onEntityInitialized: function() {
	/* Call the parent implementation of the method. */
	this.callParent(arguments);
	/* Call the handler method that sets the [Location] column value. */
	this.setWarehouse();
},
/* The handler method that sets the [Warehouse] column value. */
setWarehouse: function() {
	/* The [Warehouse] column value. */
	var location = this.get("SceWarehouse");
	/* Checks whether the mode of the new record is set. */
	var newmode = this.isNewMode();
	// * If the value is not set and the mode of the new record is set. */
	if (!location && newmode) {
		/* Get the contact's location by using ESQ */
		const userContactId = Terrasoft.SysValue.CURRENT_USER_CONTACT.value;
		const esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
			rootSchemaName: "SceWarehouse"
		});
		esq.addColumn("Id");
		esq.addColumn("SceName");
		esq.addColumn("Primary");
		const esqFirstFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,
				"Primary", true);
		esq.filters.add("esqFirstFilter", esqFirstFilter);
		esq.getEntityCollection(function(result) {
			debugger;
			if (!result.success) {
				// For example, error processing/logging.
				this.showInformationDialog("Can't set the location.");
				return;
			}
			result.collection.each(function(item) {
				var primaryWarehouse = item;
				this.showInformationDialog(primaryWarehouse.get("SceName"));
				this.set("SceWarehouse", primaryWarehouse);
			})
		}, this);
	}
}

The "showInformationDialog" function is able to show the correct record.

But, the "SceWarehouse" is still not populated.

Note: "SceWarehouse" field is a lookup based on the "SceWarehouse" section.



Could you help?



Thank you.

I has solved this problem by adding parameter "this" into the "result.collection.each()".

It will be shown as "result.collection.each(function(), this)"

esq.getEntityCollection(function(result) {
	debugger;
	if (!result.success) {
		// For example, error processing/logging.
		this.showInformationDialog("Can't set the location.");
		return;
	}
	result.collection.each(function(item) {
		var primaryWarehouse = {value: item.get("Id"), displayValue: item.get("SceName")};
		this.set("SceWarehouse", primaryWarehouse);
		return;
	}, this)
}, this);

 

Show all comments

Hi Team,



The onLookupDataLoaded: function(config) is not triggered for a custom lookup field in the object. However, the same is triggering for the OOTB lookup columns.



When the control is passed to the lookup, the onLookupDataLoaded event has to trigger but it isn't triggering for custom/newly created lookup in objects.



Are any additional changes required for new lookup columns added to the object?



BR,

Bhoobalna Palanivelu.

Like 0

Like

1 comments

Hi Bhoobalan,

 

This method was triggered for the custom lookup added to the page on my side. Are you sure the method is not triggered?

 

Best regards,

Oscar 

Show all comments

hi all ,

 i need to know the difference between lookup default values 

  • Current user
  • Contact of the current user
  • Account of the current user

thanks 

Like 0

Like

2 comments

Dear Ibrahim, 



Current user pulls information from SysAdminUnit object regarding the user you are currently logged with into the website. 



Contact of the current user pulls information about the contact connected to your SysAdminUnit



Account of the current user gets information about Account specified in the Contact object connected to your SysAdminUnit. 



Kind regards,

Roman

Dear Ibrahim, 

 

1.- Current user is a User connected to a Creatio Instance

 

2.- In Creatio a user is connected to a contact, so "Contact of the current" is the contact you have connected with the "current user"

3.- Account of the current user is the account where the contact yuo get on the 2nd point belongs.

 

Best regards

 

Julio Falcón

Show all comments

With the new designer it is not possible to change the default value when the value is not anymore in the list of values of the lookup.

 

Create a lookup field, then add a value in the list of value and setup a default value in the field. Delete the lookup value in the list then when saving the record you get an integrity error : The INSERT statement conflicted with the FOREIGN KEY constraint ...

 

In earlier version you were able to change the default value in the designer but now it is not possible anymore when changing the value you got the load turning and you cannot change the default value.

 

It would be a great idea to apply a change and not to have to go in the db for changing the Foreign key.

12 comments

Dear Franck,

 

Thank you for your inquiry!

 

Please be advised that the "The INSERT statement conflicted with the FOREIGN KEY constraint ..." error message appears due to a deleted lookup value that was previously used in the system.

 

Please note that it is highly not recommended to delete the lookup value to reduce the risk of such errors.



As a workaround, we may suggest you renaming the lookup rather than deleting it.

 

If the issue with the error persists we would recommend using the SQL script below to find out to which entity the FK is attached and where it is located.

After executing the script, you would need to find the connection between the section where the record is added with the FK that prevents it from being added.

Most likely the section has a field with a removed DEFAULT VALUE from the system or, that same field was removed which may cause this error.

 

Please see the SQL script:

 

SELECT

OBJECT_NAME(constraint_object_id) AS FKName,

OBJECT_NAME(parent_object_id) AS TableName,

COL_NAME(parent_object_id, parent_column_id) AS ColumnName,

OBJECT_NAME(referenced_object_id) AS RefTableName,

COL_NAME(referenced_object_id, referenced_column_id) AS RefColumnName

FROM

sys.foreign_key_columns

where OBJECT_NAME(constraint_object_id) = 'FK0ptyMLPUPcuuJ4DXFRngaggXnqcL'

ORDER BY

FKName,

constraint_column_id

 

 

Hope this helps!

 

Thank you!

 

Regards,

Danyil

Yes but before the release 7.17 you were able to correct this in the designer. With 7.17 and upwards, it is not possible to change the value in the interface. My request is to restablish the feature in the designer.

Best regards,

Franck

Dear Franck,

 

Thank you for your patience!

 

Please be advised that we have requested a demo instance of 7.16.2 version of Creatio for testing purposes.

 

Could you please login and provide us with the descriptive information you are referring to in your last message about changing the value in the designer in prior Creatio versions please?

 

You may use this link, login and password below:

https://0967526-service-enterprise-demo.bpmonline.com/

Supervisor

Supervisor123!

 

Thank you for your cooperation!

Looking forward to hearing from you!

 

Regards,

Danyil

Danyil Onoprienko,

Created a new section UsrTest with a field Status populated some values and set as default value : "New".

Then I deleted the New value in the lookup.

Then I was able to change or delete the default value for the field Status in UsrTest.

I took the printscreen for more information if needed.

Feel free to come back to me.

Franck

Danyil Onoprienko,

I have noticed this behavior as well in 7.17 (which is different than previous versions). In 7.17 you cannot edit the default value so it no longer references the deleted item (it will just spin and not allow you to remove the now invalid default item)

Ryan

Franck Lehmann,

Please be advised that the Default value can be set up in 7.17 in the same way as in 7.16. Please refer to the screenshots below:

 

Could you please check this in your end and confirm?

 

Thank you!

 

Regards,

 

Danyil

Ryan Farley,

Thank you for providing additional information on this matter!

Please be advised that upon our testing on a local website we were able to add a Default value to a lookup. Please refer to the screenshot below:

 

Please be advised that if the issue persists on your end you may contact us at support@creatio.com for further assistance.

 

Thank you!

 

Regards,

Danyil

Danyil Onoprienko,

The issue I experienced (this was in 7.17.1, I've not yet retested this in 7.17.2) wasn't with setting the default value. The issue was when a default value for a lookup column had been set, then later that lookup item was deleted (so the default value referenced an Id from the lookup that no longer exists). In this case, I was unable to edit the default value to change or remove the default - I assume because it was trying to load the Name part of the default value which no longer existed.

The only way I could get around this and edit the default again was to insert a row into the lookup using the same Id as the deleted item (the Id for the default value of the lookup column)

Ryan

@Danyil,

Please execute the scenario I explained on 7.17 or upwards and you will be able to reproduce the issue.

Franck

Dear Franck Lehmann, Dear Ryan Farley,

 

Thank you for your patience and your dedication!

 

Please be advised that upon our testing we have confirmed the issue with an infinite loading after changing the Default Value in the Lookup in 7.17.0 version.

 

We may also confirm that this issue has been fixed in 7.17.2 - the system allows you to change the Default Value of the lookup after this exact value was deleted within the lookup list.

 

We appreciate your cooperation!

 

Please do not hesitate to contact the Support Team in case you have any additional questions!

 

Regards,

 

Danyil 

Danyil Onoprienko,

Thanks Danyil. Glad to hear it's fixed!

Ryan

Thanks Danyil, this is a good thing to fix it.

In the meantime you can remove the constraint of integrity in the settings for having the form working without issue.

 

You may get performance issue when trying to change the value several times it happened to us on Cloud.

Glad I helped.

Show all comments

I need to reset a page field to the state "not filled in", based on the value of some other fields values, in order to force the user to re-enter it.

Is it possible ?

Like 0

Like

3 comments
Best reply

Norton Lingard,

I have just written an tested the solution..

thanks for your attention.

...

attributes: {  

                 "NullLookup": {

                        "dataValueType": this.Terrasoft.DataValueType.LOOKUP,

                        "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                    "value": null

                    }

                    "FinMainCategory": {

                        dataValueType: Terrasoft.DataValueType.LOOKUP,

                        dependencies: [

                            {

                                columns: ["FinEntryType"],

                                methodName: "setMainCategoryToNull"

                            }

                        ]

                    },

...

methods: {

...

            // Handler method that sets Main Category to null

            setMainCategoryToNull: function() {

                var nullLookup = this.get("NullLookup");

                this.set("FinMainCategory", nullLookup);

            },

...

Dear Ricardo,

 

In order to implement the required functionality please use the “dependencies” property of an attribute and in a method-handler set the value of the field to the “not filled in” value. Please see the example of the code below (UsrTest, Dear and Phone are the attributes of a particular object):

 

attributes: {

       "UsrTest": {

            "dependencies": [

              {

                "columns": ["Dear", "Phone"],

                "methodName": "setUsrTest"

               }

            ]

          }

      }

 

setUsrTest: function(){

                if (this.get("Phone") === "111" && this.get("Dear") === "test"){

                    this.set("UsrTest", "not filled in"); 

                }

            }

 

 

Please find additional information in the article by the link below:

 

https://academy.creatio.com/documents/technic-sdk/7-16/attributes-attributes-property

 

Best regards,

Norton

Norton Lingard,

It is a lookup field. 

The goal is to force the user to clear the field value, in order to force the user to enter a new value, just like a field that has nor been filled in yet.

 

Norton Lingard,

I have just written an tested the solution..

thanks for your attention.

...

attributes: {  

                 "NullLookup": {

                        "dataValueType": this.Terrasoft.DataValueType.LOOKUP,

                        "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                    "value": null

                    }

                    "FinMainCategory": {

                        dataValueType: Terrasoft.DataValueType.LOOKUP,

                        dependencies: [

                            {

                                columns: ["FinEntryType"],

                                methodName: "setMainCategoryToNull"

                            }

                        ]

                    },

...

methods: {

...

            // Handler method that sets Main Category to null

            setMainCategoryToNull: function() {

                var nullLookup = this.get("NullLookup");

                this.set("FinMainCategory", nullLookup);

            },

...

Show all comments

Can you set a default value for a lookup field? 

Like 0

Like

1 comments

Dear Heather,

Default values can be set via configuration for all replaced objects. For example if I want to set default Account for Orders I create replaced object for Order and and specify it in default value field: http://prntscr.com/qqg9kp. it can be selected from existing value, system setting or variable: http://prntscr.com/qqga4r. Please note that if selected default value is removed from the system it can lead to different issues so do not select values that can or will be deleted. 

Best regards,

Angela

Show all comments

Greetings,



I am trying to change the default value of the dropdown in a lookup minipage.

https://prnt.sc/q0igzs





Example: Whenever I open the Owner lookup, it defaults to "Full name" but I want to change it to Account.



Is there a way to change the default value?



Before: https://prnt.sc/q0iq0e



After: https://prnt.sc/q0iqgy



Thank you in advance.

Like 0

Like

1 comments

Dear Yosef,

Yes, it is possible to do either via hard additional development or by changing "Displayed value" in object advanced settings for the object that is represented by the lookup http://prntscr.com/q50jbe. Please note that it is not preferred option since this value will be changed everywhere in the system where lookups based on "Contact" object are used.

Please also note that account field cannot be selected there since account is another lookup, but the system allows using only "String" data type fields when specifying "Displayed value", but you can add your custom hidden field and create a process that will fill this field in with the value of an account that is chosen for the contact specified.

Best regards,

Norton

Show all comments

Hi Community,

 

I want to open a look up which by default has already selected records, please see image below. Lets say, I have look up "Main Activity". I want record "Main Activity A" by default was checked upon opening the look up window. 

Thanks

 

 

Like 0

Like

1 comments

Dear Fulgen,

In order to add such functionality you will need to proceed with custom development to the basic functionality.

Overall, this would be a major development, and we highly do not recommend to interfere with basic functionality, since it can caused unexpected system behavior. 

If you decide to go for development within the system, you will need to do the following:

- Add the LookupUtilitiesV2 to the dependencies of the schema, where lookup is located;

- Override the basic schema BaseLookupPageV2;

- BaseLookupPageV2 contains various methods, which are responsible for opening of the lookup and processing user actions. It also contains an attribute  'SelectedRows', which you might need in your development.

- Override the basic method opening the lookup, so to retrieve the collection of objects, before they are rendered on the page. Modify or add the needed object to selected rows. 

- Add the clause, that your functionality will only execute for particular schema/lookup/section/page, since BaseLookupPageV2 is a parent schema for other lookups in the system.

Regards, 

Anastasia

Show all comments