Hi all,

Does someone knows how to import product image in the xlsx file ?

I tried the image URL, the image encode in base64...

thank you

Like 0

Like

5 comments

Hello,

if we take a look at the table in DB where information on products is stored, you can see that the column which stores information on images is called "PictureId". This column takes information directly from "SysImage" table where all images are stored. The image itself is stored in "Data" column and it is stored as binary code there. Unfortunately there is no way to import data to SysImage table directly using data import tool. I will create a problem to our R&D team so to develop this functionality in future and I hope it will be implemented soon enough. As for now you need to update images manually via product page. Thank you for helping us to make our application better.

Best regards,

Oscar

thank you Oscar

Do you know how to encode Line feed in the excel import file for BPM multi-line fields ?

LÉZORAY Nicolas,

 I ve got it, i replace line feed by <br/> in my SQL results, next in the xlsx file, i replace <br/> with ALT+010

LÉZORAY Nicolas,

Are you saving this into a standard field or the Notes field? When I did importing of data into the Notes field, it has never worked.

Mark Roberts, into the Notes Field it works

Show all comments

Hi everyone!

I hope you help me!

I need that when I set up the Facebook profile in the employee's "CommunicationOptions", the profile photo will be uploaded to the Employee's Photo, which would implicitly be uploaded to the Contact's Photo. This functionallity only works when done from Contact. How could I replicate it in Employee? If the Employee's photo actually refers to the Contact's photo and in Contact works fine, it should appear, since the fields configured in Employee's "Communication Options" actually refer to the associated Contact.

I hope it was understood.

King regards,

Ezequiel

Like 0

Like

2 comments

Please use the following code on a replacing client module for an EmployeePage module

define("EmployeePage", [], function() {
	return {
		entitySchemaName: "Employee",
		messages: {
 
			"SearchResultBySocialNetworks": {
				mode: Terrasoft.MessageMode.BROADCAST,
				direction: Terrasoft.MessageDirectionType.SUBSCRIBE
			}
		},
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		methods: {
			subscribeSandboxEvents: function() {
				this.callParent(arguments);
				this.sandbox.subscribe("SearchResultBySocialNetworks", this.onSearchResultBySocialNetworks, this);
			},
			onSearchResultBySocialNetworks: function(config) {
				var collection = config.selectedItems;
				if (collection.isEmpty()) {
					return;
				}
				var socialContact = collection.getByIndex(0);
				this.setPhotoFromSocialNetworks(socialContact);
			},
			setPhotoFromSocialNetworks: function(socialContact) {
				var contactPhoto = this.get(this.primaryImageColumnName);
				if (!this.Ext.isEmpty(contactPhoto) || this.Ext.isEmpty(socialContact)) {
					return;
				}
				var isDefaultPhoto = socialContact.get("IsDefaultPhoto");
				var photoUrl = socialContact.get("Photo");
				if (isDefaultPhoto === true || this.Ext.isEmpty(photoUrl)) {
					return;
				}
				this.Terrasoft.ConfigurationFileApi.getImageFile(photoUrl, this.onPhotoChange, this);
			},
			onPhotoChange: function(photo) {
				if (!photo) {
					this.set(this.primaryImageColumnName, null);
					return;
				}
				this.Terrasoft.ImageApi.upload({
					file: photo,
					onComplete: this.onPhotoUploaded,
					onError: this.Terrasoft.emptyFn,
					scope: this
				});
			},
			onPhotoUploaded: function(imageId) {
				var imageData = {
					value: imageId,
					displayValue: "Photo"
				};
				this.set(this.primaryImageColumnName, imageData);
				var contactId = this.get("Contact") ? this.get("Contact").value : null;
				this.setContactPhoto(contactId, imageData);
			},
			setContactPhoto: function(contactId, imageData) {
				if (contactId) {
					var update = Ext.create("Terrasoft.UpdateQuery", {
						rootSchemaName: "Contact"
					});
					update.filters.addItem(update.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Id",
						contactId));
					update.setParameterValue("Photo", imageData.value, Terrasoft.DataValueType.IMAGELOOKUP);
					update.execute();
				}
			}
		},
		rules: {},
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
	};
});

 

Hi Eugene! I appreciated your help! It was very useful form me. Regards!

Show all comments

Hi everyone!

How are you? I hope you can help me.

I need the default image of the employee to change dynamically depending if gender is Female O Male when the Photo not is set. I saw that the attribute Photo on Employee refers to Contact.Photo in attributes section of EmployeePage(Base)

How can I do this?

 

 

 

 

 

 

 

 

 

King Regards,

Ezequiel

 

Like 0

Like

2 comments

Dear Ezequiel,

 

You can achieve such task by applying some code modifications to the ContactPageV2. Please create or open ContactPageV2. Go to localizable strings (menu on the right) and add to Images your icon for female contacts.

Afterwards, please use this example to apply code modifications:

define("ContactPageV2", ["ContactPageV2Resources"],
	function(resources) {
		return {
			entitySchemaName: "Contact",
			attributes: {
				"DefaultImage": {
					dataValueType: Terrasoft.DataValueType.TEXT,
					type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN
				}
			},
			methods: {
				onEntityInitialized: function() {
					this.callParent(arguments);
					this.setPhoto();
				},
				setPhoto: function() {
					var primaryImageColumnValue = this.get(this.primaryImageColumnName);
					if (!primaryImageColumnValue) {
						var gender = this.get("Gender").value;
						if (gender === "fc2483f8-65b6-df11-831a-001d60e938c6") {
							document.getElementsByClassName("ts-image-edit-full-size-element ts-image-style-rectangular")[0]
								.setAttribute("src",
									Terrasoft.ImageUrlBuilder.getUrl(resources.localizableImages.DefaultPhotoFemale));
						} else {
							document.getElementsByClassName("ts-image-edit-full-size-element ts-image-style-rectangular")[0]
								.setAttribute("src",
									Terrasoft.ImageUrlBuilder.getUrl(resources.localizableImages.DefaultPhoto));
						}
					}
				}
			},
			diff: /**SCHEMA_DIFF*/[
			]/**SCHEMA_DIFF*/
		};
	}
);

Here you can see, that based on the gender of the contact, the icon is set. Also, you can improve the code by adding onChange statement, which can change the icon if gender changes in runtime. 

Regards,

Anastasia

Anastasia Botezat,

one question

How can set image when onentityinitialized event is not triggered?

Show all comments