Question

Add Manager Mood from Opportunities to Accounts

I would like to add the Manager Mood functionality to the Account's section from the Opportunity Section, I followed instructions on a previous post here with no luck. Step by Step instructions would be helpful.

Like 0

Like

8 comments

Hi Michael,

So according to this article next steps should be done:

1. Create a lookup with image link column

2. Add a custom edit page for that lookup

3. Add a container for image editing on that lookup page (described in comments here)

4. Add a mood container to your section (Account in your case) (also described in comments here)

Regards,

Dmytro

Dmytro Smishchenko,

I have followed the steps that you have given here and have created and registered the LookupEdit Page to the db. In my requirement, was able to place the image in the lookup edit page but while setting column, I don't find that field. I have tried generating all schemas after the implementation and compiled the package. 

 

I would need to add the lookup to LeadPageV2 in Profile Container but the lookup should display the image instead of the Name field value/ Kindly suggest! Thanks

 

Link to the files are included here -

 

Contents:

1. UsrPriorityLookupEditPageV2.j

2. UsrPriorityLookupSectionV2.js

3. LeadPageV2.js

 

Appreciate your valuable comments. 

 

 

Anupama,

 

Please specify if the lookup like this one will work for you:

Thank you!

 

Best regards,

Oscar

Not exactly Oscar Dylan. but partly where in the lookup would have only one column and it shouldn't be editable and the UI should be similar to Prediction Score.

 

For my requirement, there is a check box and on click of that checkbox, the image icon should be displayed. I see this part is quite straightforward using the image container but the second part of the request is, on the section page, to which all record the check box is checked, it should also display the icon. 

 

I was not able to enable the Image/ImageLink datatype column using Column setup and so with the customization of lookup, i am checking if I could render the image both in edit and section page.

 

Can you please let me know how can that be brought in. 

Anupama,

 

Hi,

 

As for the section page - not sure how it can be handled, but as for the edit page - I was able to display the same "Opportunity mood", but on the AccountPageV2:

To do that on your side you need to:

 

1) Create an object called "UsrAccountManagerMood" in configurations (parent object is "BaseLookup")

 

2) In the created object add two columns:

2.1) "UsrImage" column that is an "Image link" data type

2.2) "UsrPosition" column that is an "Integer" data type

 

3) In the created object select the "UsrImage" column as an "Image" property value

4) Save and publish the created object

 

5) In the replaced "Account" object add the "UsrAccountManagerMood" column that references the created "UsrAccountManagerMood" object

 

6) On the AccountPageV2 (or on the edit page of the "Accounts" section in your system) add the following attribute:

"UsrAccountManagerMood": {
				lookupListConfig: {
						orders: [{columnPath: "UsrPosition"}]
					}
			}

7) In the methods of the AccountPageV2 add the following methods (the feature is added in case you need to hide this container for some users or completely hide it. For this use the AdminUnitFeatureState table and SysAdminUnitId and FeatureState columns):

getLookupQuery: function(filter, columnName) {
					var esq = this.callParent(arguments);
					if (columnName === "UsrAccountManagerMood") {
						esq.addMacrosColumn(Terrasoft.QueryMacrosType.PRIMARY_IMAGE_COLUMN, "primaryImageValue");
					}
					return esq;
				},
 
isUsrAccountMetricsContainerVisible: function() {
					return this.getIsFeatureEnabled("UsrAccountMetrics");
				},

8) In the diff array on the AccountPageV2 add the following objects (after applying this you will see the container in the wizard and will be able to drag it to another place in the profile container):

{
				"operation": "insert",
				"parentName": "ProfileContainer",
				"propertyName": "items",
				"name": "UsrAccountMetricsContainer",
				"values": {
					"layout": {"column": 0, "row": 0, "colSpan": 24},
					"itemType": Terrasoft.ViewItemType.CONTAINER,
					"classes": {"wrapClassName": ["ts-metrics-container"]},
					"items": [],
					"visible": {"bindTo": "isUsrAccountMetricsContainerVisible"}
					}
			},
			{
				"operation": "insert",
				"parentName": "UsrAccountMetricsContainer",
				"propertyName": "items",
				"name": "UsrMoodContainer",
				"values": {
					"items": [],
					"itemType": this.Terrasoft.ViewItemType.CONTAINER,
					"classes": {"wrapClassName": ["ts-metric-item", "ts-mood-container"]}
				}
			},
			{
				"operation": "insert",
				"parentName": "UsrMoodContainer",
				"propertyName": "items",
				"name": "UsrAccountMood",
				"values": {
					"generator": "ImageListGenerator.generateImageList",
					"bindTo": "UsrAccountManagerMood",
					"id": "MoodImageList",
					"schemaName": "UsrAccountManagerMood",
					"schemaColumn": "UsrImage",
					"caption": {"bindTo": "Resources.Strings.UsrMoodListCaption"},
					"controlConfig": {
						"wrapClasses": ["opportunity-mood-image-list image-list"],
						"modalBoxClasses": ["opportunity-mood-image-list"]
					},
					"markerValue": "UsrAccountMood",
					"tips": []
					},
				"alias": {
					"name": "UsrAccountManagerMood",
					"excludeProperties": ["layout"],
					"excludeOperations": ["remove", "move"]
				}
			},
			{
				"operation": "insert",
				"parentName": "UsrMoodContainer",
				"propertyName": "items",
				"name": "UsrMoodCaption",
				"values": {
					"itemType": Terrasoft.ViewItemType.LABEL,
					"caption": {
						"bindTo": "Resources.Strings.UsrMoodCaption"
					},
						"classes": {
							"labelClass": [
								"ts-metric-item-caption"
							]
						}
				}
			},

Add the UsrMoodCaption and UsrMoodListCaption localizable strings.

 

9) Add the OpportunityCommonCSS schema as a dependency to the AccountPageV2 module:

define("AccountPageV2", ["css!OpportunityCommonCSS"], function() {

10) Execute the following SQL query in the database:

DECLARE @featureCode varchar(max) = 'UsrAccountMetrics',
 @featureId uniqueidentifier;
set @featureId = (select top 1 Id from Feature where Code = @featureCode);
IF @featureId is null
BEGIN
 insert into Feature
  (Name, Code)
 values
  (@featureCode, @featureCode);
 set @featureId = (select top 1 Id from Feature where Code = @featureCode);
END;
delete from AdminUnitFeatureState where FeatureId = @featureId;
insert into AdminUnitFeatureState
 (SysAdminUnitId, FeatureState, FeatureId)
values
 ('A29A3BA5-4B0D-DE11-9A51-005056C00008', 1, @featureId);

11) Relogin to the app and check the result. The container can be dragged on the page using the standard section wizard.

 

As for the values in the UsrAccountManagerMood object: I've used already existing images from the OpportunityMood table. So just for tests I've also inserted one record into the UsrAccountManagerMood table using data from the OpportunityMood table:

SELECT * FROM OpportunityMood;
INSERT INTO [UsrAccountManagerMood] ([Name], [UsrPosition], [UsrImageId]) VALUES ('Confident',0, '2F2DE6B3-4732-4562-A1A7-31DC2C432060');

As for the section itself you need to use tile view as in opportunity section after applying changes in the AccountPageV2 using the logic described above. As a result you will see the mood as needed:

The final thing - the checkbox you are referring to. Why do you need to click the checkbox if you can directly manage mood using the image container itself? Maybe it's better to use the image list directly in the container?

 

Best regards,

Oscar

Oscar Dylan,

Thanks for the details. The checkbox is a separate column that the end user require where in the display of the image should depend on the boolean value of the checkbox. They want to display a national flag if the checkbox is checked and the image should also be displayed on the section page as well. 

Oscar Dylan,

 

I have followed the steps given above and have inserted a record in lookup object to display the primaryimagevalue. In the edit page, it is shown as below - with the default image icon instead of the Image set in the lookup. For instance, the Confident image as per the steps shared by you. 

 

 

Also on the section page, the tile view is enabled with the column added using column settings. 

 

Kindly suggest what is missing and appreciate your comment.

 

Thanks

Anupama K

Oscar Dylan,

It worked like a charm. Thanks for the detail steps. Where it was stuck is with the cache and once everything was cleared, things fell in space as required.

Show all comments