Mobile application - Enable uploading of contact picture in contact
Hi Community,
In mobile application how we can enable the uploading of contact picture in contact, the same functionality in web application.
Like
In order to implement the required functionality please do the following:
1. Use the attachments detail for uploading the image.
2. Create a business process that should be triggered when a new image was uploaded to the application.
3. In the business process, you should copy data of the created record from the “ContactFile” table to the “SysImage” table. Please note that in order to copy the value from the “Data” column you should use the “Script task” business process element. Please find the example of the code below:
var getAttachmentId = new Guid("78B9876B-61CE-4EAB-9424-E19E2CABD2BE");
var getImageId = new Guid("4C14605B-4904-43CE-8EC6-CD192222274A");
byte[] getData = new byte[1000000];
using (DBExecutor dbExecutor = UserConnection.EnsureDBConnection())
{
dbExecutor.StartTransaction();
var select = new Select(UserConnection)
.Column("Data")
.From("ContactFile")
.Where("Id").IsEqual(Column.Parameter(getAttachmentId)) as Select;
using (IDataReader dataReader = select.ExecuteReader(dbExecutor))
{
if (dataReader.Read())
{
getData = (byte[])dataReader[0];
}
}
}
var fileContent = new MemoryStream(getData);
var esqResult = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "SysImage");
esqResult.AddAllSchemaColumns();
var entity = esqResult.GetEntity(UserConnection, getImageId);
entity.SetStreamValue("Data", fileContent);
entity.Save();
return true;
Please do not forget to add the following namespaces to the business-process https://prnt.sc/s0ju9o
Additionally, please find more information about the “Entity” class in the article by the link below:
https://academy.creatio.com/documents/technic-sdk/7-15/working-database-entity-entity-class
Best regards,
Norton