Hello!

how are you?

I hope your can help me!

I have a button in EmployeePage, when I press the button call to method "downloadFile" in property "click". I want call to this method from various bottons but passing a distinct parameter for each button. Example:

{
		"operation": "insert",
		"name": "DownloadFileButton",
		"values": {
			"itemType": 5,
			"imageConfig": {
				"bindTo": "Resources.Images.FilesImage"
			},
			"click": {
				"bindTo": "downloadFile"
                //Pass parameter
			},
			"visible": true
			"enabled": {
				"bindTo": "UsrClaveAltaTemprana"
			},
			//Button Tooltip
			"hint": {  
				"bindTo": "Resources.Strings.MensajeTooltipDownload" 	
			},
			"markerValue": "DownloadFileButton",
			"layout": {
				"colSpan": 1,
				"rowSpan": 1,
				"column": 11,
				"row": 0
			}
		},
		"parentName": "Taba317b6dcTabLabelGridLayout3826b978",
		"propertyName": "items",
		"index": 1
	},
{
		"operation": "insert",
		"name": "DownloadFileButton2",
		"values": {
			"itemType": 5,
			"imageConfig": {
				"bindTo": "Resources.Images.FilesImage"
			},
			"click": {
				"bindTo": "downloadFile"
                //pass parameter
			},
			"visible": true
			"enabled": {
				"bindTo": "UsrClaveBajaTemprana"
			},
			//Button Tooltip
			"hint": {  
				"bindTo": "Resources.Strings.MensajeTooltipDownload" 	
			},
			"markerValue": "DownloadFileButton2",
			"layout": {
				"colSpan": 1,
				"rowSpan": 1,
				"column": 11,
				"row": 1
			}
		},
		"parentName": "Taba317b6dcTabLabelGridLayout3826b978",
		"propertyName": "items",
		"index": 1
	},
//method
methods: {
//method with parameter
			downloadFile: function(parameter) {
             var p = parameter;
             if (p == "A")
               //do some thing
             else
               //do some thing
            }

I appreciated your help!

King Regards!

Ezequiel Gómez

Like 0

Like

4 comments

Dear Ezaquiel,

The code you've provided above will work in case you add the appropriate Set parameter to UsrClaveAltaTemprana and UsrClaveBajaTemprana.

We suggest you to add the virtual attribute ,though. You can find the example of the attribute in various schemas in the configuration. 

Lisa

Hello,

 

I have exactly the same request, but I don't understand the answer.

Can you explain this in a little more detail?

 

How can i pass a parameter to the downloadFile 

"click": {

                "bindTo": "downloadFile"

}

Hi Oliver, how are you? Below an script example. Let me know if it work for you:

{

                "operation": "insert",

                "name": "downloadTest",

                "values": {

                    "itemType": 5,

                    "imageConfig": {

                        "bindTo": "Resources.Images.IconoDescargar"

                    },

                    "click": {

                        "bindTo": "downloadTest"

                    },

                    "visible": {

                        "bindTo": "UsrdownloadTest"

                    },

                    "hint": {

                        "bindTo": "Resources.Strings.MensajeTooltipDownload"

                    },

                    "layout": {

                        "colSpan": 1,

                        "rowSpan": 1,

                        "column": 18,

                        "row": 6

                    }

                },

                "parentName": "Tabe14d1848TabLabelGridLayout4868277b",

                "propertyName": "items",

                "index": 25

            }

//////////////////////**////////////////////////////////////////

downloadTest: function() {

                var esqEmpDocument = this.Ext.create("Terrasoft.EntitySchemaQuery", {

                    rootSchemaName: "UsrEmployeeDocument"

                });

                esqEmpDocument.addColumn("Id", "IdDocumento");

                esqEmpDocument.addColumn("Name", "NombreDocumento");

                //Filtro por Empleado

                var filtroEmpleado = esqEmpDocument.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrEmpleado.Id", this.get("Id"));

                //Filtro por Id de empleado

                var filtroTipoDoc = esqEmpDocument.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrCodDocumento", "MA");

                //Agrego filtros a la consulta

                esqEmpDocument.filters.add("filtroEmpleado", filtroEmpleado);

                esqEmpDocument.filters.add("filtroTipoDoc", filtroTipoDoc);

                esqEmpDocument.getEntityCollection(function(result) {

                    if (result.success) {

                        result.collection.collection.items.forEach(this.descargar);

                    }

                }, this);

            },

            

            descargar: function(item) {

                var idDoc = item.values.IdDocumento;

                var nombreDoc = item.values.NombreDocumento;

                //this.showInformationDialog(idDoc);

                var link = "../rest/FileService/GetFile/" + "90e79bf7-1c3e-467b-aaf2-9f8cdb376ce9" + "/" + idDoc;

                

                var file = document.createElement("a");

                file.href = link;

                file.download = nombreDoc;// + ".pdf";

                document.body.appendChild(file);

                file.click();

                document.body.removeChild(file);

            },

Hello, thank you for your answer!

 

I can't see where you pass the parameter to "downloadFile".

 

I don't need to know how to download a file. I want to know how to pass a parameter to a function when I click on a button.

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 that in EmployeePage the Photo are not ReadOnly and it has funcionallity as in Contact. I saw that in attributes Section of EmployeePage(Base), there a attribute called ContactPhoto that refers to Contact.Photo and in the Init Method, this attribute is assigned to "primaryImageColumnName".I don't understand why "primaryImageColumnName" not is a attribute of Employee. What is its source?

To replicate this functionally, I did the following on EmployeePage (Custom):

  • I changed the attribute "ReadOnly" to False in array values of photoProperty in Diff section
  • I add "OnPhotoChange" attribute in array values of photoProperty in Diff section
  • I add OnPhotoChange and onPhotoUploaded to methods section 
//diff
{
	"operation": "merge",
	"parentName": "PhotoContainer",
	"propertyName": "items",
	"name": "Photo",
	"values": {
		"getSrcMethod": "getSchemaImageUrl",
		"readonly": false,
		"onPhotoChange": "onPhotoChange",
		"defaultImage": Terrasoft.ImageUrlBuilder.getUrl(resources.localizableImages.DefaultPhoto),
		"generator": "ImageCustomGeneratorV2.generateCustomImageControl"
	}
},
 
...
//methods
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) {
				debugger;
				var imageData = {
					value: imageId,
					displayValue: "Photo"
				};
				this.set(this.primaryImageColumnName, imageData);
			}

 

With this configuration, I can change the photo, but when I refresh or exit and return to the Page,the photo is reset with default image, I think it is not being recorded correctly in the contact photo column. What am I doing wrong? What is missing?

Thanks in advance.

King Regards,

 

Ezequiel

Like 0

Like

1 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

I would like to add a new field to the new lead mini page - "business phone".  what is the best or easiest way to do this?

Like 0

Like

2 comments

Dear John,

The minipage is edited in the same way the general page does. You need to find LeadMiniPage schema in the Configuration, replace it and apply the necessary changes. 

Lisa

Lisa Brown,

Can you please post the code how it will me i want to add date of birth

 

Show all comments
There is some OOTB functionality for tracking and notifications of changes in records to certain users similar to the 
feedtracking functionality that SalesForce has: https://trailhead.salesforce.com/en/modules/chatter/units/chatter_feed_tracking
Like 0

Like

1 comments

Dear Uriel,

 

We have the functionality called Change Log. I believe it will allow you to accomplish the tasks you mentioned. 

You can read about the functionality and its setup in our Academy here - https://academy.bpmonline.com/documents/service-enterprise/7-11/change-log-section.

Lisa

Show all comments

Hello everyone!

I hope you can help me!

I created a replacement client module of "EmployeeMiniPage". I made some customizations, but I can not find a way to set some fields like "lookups". For example Job is show as a list but I want it to be show as a lookup

I added the following in the attributes section but it does not work:

"Job": {

     "lookupListConfig": {

      "columns": ["Name"]

     }

I hope you can help me!

Regards

Like 2

Like

1 comments

Dear Ezequiel,

The task you are trying to accomplish is rather complex. It's difficult to achieve because one pop-up (minipage) is already opened in the system and it takes the implementation of multiple layers functionality to allow to open another one. The similar functionality is not present anywhere in the system so far and we are not planning to add it in the closest releases.

Lisa

 

Show all comments

Hello Community! 

Need add a button in the actions menu into detail. How can i do it?

Regards ,

 

Like 1

Like

1 comments

Sovled! 

addToolsButtonMenuItems: function(toolsButtonMenu) {
	this.callParent(arguments);
 
	toolsButtonMenu.addItem(this.getButtonMenuSeparator());
	toolsButtonMenu.addItem(this.getButtonMenuItem({
	  Caption: this.get("Resources.Strings.MyBoton"),
	  Click: {"bindTo": "OnButonClick"},
	  Visible: {"bindTo": "IsSelectRecord"}
        			}));

 

Show all comments

Hello community!!

I need construct a batchquery but in one column is necesary constuct a string with the id of the object. How can call the id object in the insert?

 

var insert = Ext.create("Terrasoft.InsertQuery", {
		                        rootSchemaName: "Entity"
			                    });
insert.setParameterValue("EmailURL", "?entityid=" + //Need put the Id of object Entity//, this.Terrasoft.DataValueType.TEXT);
 
bq.add(insert);

 

Like 0

Like

2 comments

Dear Federico,

In order to use the Id of the entity you created, you need to specify this ID before creation.

You can generate new Id by using Terrasoft.generateGUID() method:

var newGuid = Terrasoft.generateGUID();
var insert = Ext.create("Terrasoft.InsertQuery", {
   rootSchemaName: "Entity"
});
insert.setParameterValue("Id", newGuid, Terrasoft.DataValueType.GUID);
insert.setParameterValue("EmailURL", "?entityid=" + newGuid, this.Terrasoft.DataValueType.TEXT);
 
bq.add(insert);

Regards,

Anastasia

Anastasia Botezat,

 



Is there a way to do Terrasoft.generateGUID(); in server side web service?

 

 

Show all comments

Hello everyone!

I hope you can help me!

I have a"CUIL" field in the employee table and I want to apply the mask. Example: Enter 20352741729 and the mask would be 20-35274172-9.

I must validate that the entry/edition of this field is correct. How can i apply the mask to that field?

I aprreciate your help!

Regards.

Like 0

Like

4 comments

Hello Ezequiel!

There is a pretty universal instruction for adding a field mask. It is originally meant to create a mask for a phone number, but you can adjust it as much as required.

First of all there is a control attached, which allows you to enter information using the array of masks.

To use it you need to add this module to the page dependency and to define section and include in page diff that MultiMaskEdit class and its mask have to be used. 

{
                    "operation": "merge",
                    "name": "MobilePhone",
                    "values": {
                                         "controlConfig": {
                                                             className: "Terrasoft.controls.MultiMaskEdit",
                                                             mask: {
                                                                                 formats: ["+7(999)999-99-99", "+380(99)999-99-99"]
                                                             },
                                                             onBeforePasteFormatValue: TSCCommon.getDigitsFromString
                                         }
                    }
}



You include onBeforePasteFormatValue method only if you want to parse input value before pasting it into control. This method is not required - control will insert only allowed values, however if you, for example, need to parse the string and insert only numeric values - for the mask above, the phone number will be inserted completely, regardless which symbols were used additionally.

The default symbols for mask input are:

{
                    //numbers
                    "9": {
                                         re: "[0-9]"
                    },
                    //cyryllic
                    "к": {
                                         re: "[а-яА-ЯёЁ]"
                    },
                    //latin
                    "l": {
                                         re: "[a-zA-Z]"
                    },
                    //any letter
                    "c": {
                                         re: "[а-яА-ЯёЁa-zA-Z]"
                    },
                    //any letter or number
                    "#": {
                                         re: "[а-яА-ЯёЁA-Za-z0-9]"
                    }
}



You can choose your own symbol for mask template using maskConfig. You indicate the regular expression in re:. Also you need to indicate the symbol, that substitutes the empty values in placeHolderChar. For example you can create a mask that will allow you to enter ISBN codes where 978 are numbers and "0" is a substitute symbol.

{
                    className: 'Terrasoft.controls.MultiMaskEdit',
                    value: {
                                         bindTo: 'ISBN'
                    },
                    mask: {
                                         formats: ["978-0-000-00000-0"]
                    },
                    maskConfig: {
                                         definitions: {
                                                             //numbers
                                                             "0": {
                                                                                 re: "[0-9]"
                                                             },
                                                             placeHolderChar: "_"
                                         }
                    }
}



There is an issue, though, control validation is not passed to the card model, it means that even though the control shows that the value is invalid the card will be saved.

Hope it helps!

Hello Matt!

Thanks you for the response.

Can you said me how import the attached file in the system?. In the "Configuration" section, under "Actions" options, I do click in "Import from file", I select the file MultiMaskEdit.js and I get a error when want load the file. I appreciated your help!

King Regards,

Ezequiel Gómez

 

Hello Matt! How are you? I hope you are well. Any idea? Thank you! Regards!

Matt Watts,

Hello Matt. You know if there is a way to do this but dinamic. For example depends of the country change the format of the mask?

Thanks, 

 

Show all comments