I want to read all records and then update them using a sub process, but there is a limit to reading records. how can I read all records and update them?

Like 0

Like

6 comments
Best reply

Hi Valdimir, 

 

Sure, first off all add a new boolean column on you account object, like processed, your main process like this

 

As I remember, there was a limit of 5000 records. If we need to process more, we create a script

Vladimir Sokolov,

You can add a column to track processed records and loop the read collection until there not unprocessed records, using the track column, for example. In this way, you have no limits

Julio.Falcon_Nodos,

Can you give me an example?

Julio.Falcon_Nodos,

As I remember, process cannot loop more than 5000 times either

Vladimir Sokolov,

Can you give me a sample script to update it?

Hi Valdimir, 

 

Sure, first off all add a new boolean column on you account object, like processed, your main process like this

 

Show all comments

I’m currently working on establishing a two-way connection between two applications in Creatio for adding and modifying records.
 

  1. One-Way Connection: I successfully created two business processes that allow for one-way synchronization of records.
  2. Two-Way Connection Issue: However, when I attempt to set up the two-way synchronization, it leads to the creation of multiple records in an infinite loop instead of just one record being created or updated.

 

Could anyone provide guidance on how to avoid this infinite loop in a two-way connection? Any insights on best practices for implementing two-way synchronization in Creatio would also be greatly appreciated.
 

I can provide screenshots of my setup for further clarification if needed. I followed the same process for the one-way connection as shown in the attached business process screenshot.

Like 0

Like

2 comments

Good day,

The issue you're encountering is related to the number of records being passed to the subprocess. Here are some suggestions for resolving this situation:

1. Add or adjust recursion trigger conditions:
   - For instance, if the trigger is based on changes to the `Contact.Age` field, consider adding a condition to ensure the age is not empty before initiating recursion.

2. Redesign the process to avoid recursion:
   - Replace recursion with iteration: Instead of processing records one by one with recursion, you can read and process multiple records in a sequential manner, ensuring that you do not handle a new record until the current one is fully processed.
   - Consolidate changes into a single process: Rather than reacting to various changes across different processes, use one process to handle all necessary changes at once. For example, initiate triggers in a single business process (BP) with all modifications related to a specific entity, which helps in minimizing and managing recursion more effectively.

It is crucial to first review the process logic with the above suggestions, as increasing the `MaximumBackgroundRecursionDepth` parameter could lead to application performance issues, such as slowing down or exhausting server memory, which might result in application restarts or stops.

In your system, the `MaximumBackgroundRecursionDepth` parameter is currently set to 100 (default is 100). The issue arises when the number of subprocess calls exceeds this value.

To address this problem, you may need to increase the `MaximumBackgroundRecursionDepth` parameter to accommodate all records, rather than only the initial 100.

Regards,
Orkhan

You need to have some way to determine the source of a record, so if the record came from the other object, you don't send it back again. 

For records added in "Data App", you'd flag those as coming from "Data App" when adding in "Info App", so the process that syncs from "Info App" back to "Data App" knows to exclude it from sending back to "Data App", etc.

If the records need to sync updates as well, you'd want to store the original record's Id value so you know where to update. You could then use the column storing the Id to know to exclude sending it back to add.

Ryan

Show all comments

I am currently developing an application where I need to add a "Sync Data" button to both the Accounts and Contacts sections. This button will trigger a Business Process that needs to work dynamically based on the context from which it is called.
 

The key requirement is to use a single, common Business Process for both Accounts and Contacts. In this process, I need to determine whether the button was clicked from the context of Accounts or Contacts, so the appropriate actions can be taken accordingly.
 

I understand that creating separate Business Processes for Accounts and Contacts could achieve this, but my goal is to have a unified process or function that can be reused across multiple entities.
 

I would greatly appreciate any guidance or suggestions on how to implement this in Creatio.

Thank you in advance for your assistance!

Like 0

Like

1 comments
Best reply

Create a boolean parameter "IsContact"(it's just an example, you could create any parameter ) and pass true if the button is clicked on contact page and false if it's clicked in any other place 

Create a boolean parameter "IsContact"(it's just an example, you could create any parameter ) and pass true if the button is clicked on contact page and false if it's clicked in any other place 

Show all comments

Hello.

I have a freedom UI FormPage, which may be opened from Business process (Open edit page element). I want to override Cancel button handler in such way that to cancel current business process. I need to know process id (SysProcessLog table) or process element id (SysProcessElementLog table). How could I obtain them in Freedom UI? For example in Classic UI edit page there was dedicated attribute called ProcessData. I looked through request.$context and didn't find anything similar.

 

Creatio version is 8.1.2

Like 0

Like

2 comments

Hello!

 

To find information, you can read the data from SysProcessData, more information which contains the interrelationship between the process instance and the subprocess, the relationship to the process scheme, the relationship to the process scheme element if the instance is a subprocess, and the current status of the process instance. Also, the internal state of the process is a snapshot of the values of the parameters at times when the process elements are executed.

 

Also, this article could be useful:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/development-tools/external-ides/examples/develop-c-sharp-code-in-a-custom-project

 

Kyrylo Atamanenko,

Thanks for an answer. But to read all those information I need to know Id of an element being executed. For example in Classic UI it is obtained like 

this. 

const processElementUId = this.get("ProcessData").procElUId;

And the question is there analogue in Freeom UI page?

Show all comments

Hello,

 

I have a web service that generates a file. I need to attach that file to a record. I see there is an option to the Process File Component passing a File as parameter, but the Parameter is Expecting a IFileLocator. How can I use a script to create a IFileLocator from a full file path on Creatio Studio version 8.1? 

 

Thanks,

Jose

File attachments
Like 0

Like

2 comments
Best reply

Hello,

You should use a script task to work with files from the web service.

 

More details about the API file:



https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

Hello,

You should use a script task to work with files from the web service.

 

More details about the API file:



https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

Thanks Cherednichenko. Using the information provided I wrote the C# below to attach a generated file to a record.



public void AttachFile(string schemaName, Guid recordId, string fullFilePath) {

            /* Create a unique ID for the new file. */

            Guid fileId = Guid.NewGuid(); 

            /* Create a file locator for the new file. */

            var fileLocator= new EntityFileLocator("SysFile", fileId); 

            /* Get an IFile object for the new file. */ 

            IFile file = UserConnection.CreateFile(fileLocator); 

            /* There is no file metadata or file content in the available file storages. Specify the file name in the file metadata. */

            file.Name = (new System.IO.FileInfo(fullFilePath)).Name; 

            /* Set an attributes for the new file: */

            file.SetAttribute("RecordSchemaName", schemaName); 

            file.SetAttribute("RecordId", recordId);             

            /* Save the file metadata Do this BEFORE saving the content. */

            file.Save(); 

            using (var sourceStream = new FileStream( fullFilePath, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true)) {

                file.Write(sourceStream, FileWriteOptions.SinglePart);            

            }

        }

Show all comments

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
Question

Hi, 

Can you help me on this use case in which the activities are created based on the user input?

for example, if I input in the field:

Activity quantity: 3 

then 3 activites are created with 3 different Subjects: activity 1, activity 2, activity 3.

Thanks 

 

Like 0

Like

2 comments

Hello,



Your business task could be achieved by the business process. For example:

 

1. Create Parameters: Start by adding parameters to the process to input values such as "start date," "end date," and "user." 



2. Configure the Business Process:

Add a pre-configured page where you can input the required values.

Use formulas to set the start and end dates using the parameters you defined earlier.

Add an "Add data" element to create a new activity. Configure the columns for start and end date, type, and user.

 

3. Add a conditional flow with a condition to check if the date doesn't match the end date from the pre-configured page.

If the condition is true, proceed to the next formula element to increment

Nguyen Trang,

 

We are sending you the Conditional flow instruction, for your review. If you have any specific questions about this, please describe them in more detail.

 

Show all comments

Hi all,

 

How to copy a new business process from the development server to the production server?

 

Thank you.

Like 0

Like

1 comments

Hi David,



Processes are transferred to the same other custom changes. Please see this article about transferring changes from site to site:

https://academy.creatio.com/docs/7-17/developer/development_tools/packa…

Show all comments

I am trying to process a collection of objects. But I am unsure how to pass the collection from a read data element in a business process to a user task. I am also unsure what parameter type I should use on the user task. Can someone tell me the name of a process/user task in creatio I can look at for an example? Or tell me how I can do this?

Like 0

Like

2 comments

Hello, Josh.

I think you can find an example here 

https://academy.creatio.com/docs/user/bpm_tools/process_elements_refere…

Check the example with CompositeObjectList

Hello, Josh.

Check this article 

https://academy.creatio.com/docs/user/bpm_tools/process_elements_refere…

 

Example you need is CompositeObjectList

Show all comments

I am getting meaningless Compilation errors , any ideawhat it is about ? 

namespace Terrasoft.Core.Process
{
 
	using System;
	using System.Collections.Generic;
	using System.Collections.ObjectModel;
	using System.Drawing;
	using System.Globalization;
	using System.Text;
	using Terrasoft.Common;
	using Terrasoft.Configuration;
	using Terrasoft.Core;
	using Terrasoft.Core.Configuration;
	using Terrasoft.Core.DB;
	using Terrasoft.Core.Entities;
	using Terrasoft.Core.Process;
	using Terrasoft.Core.Process.Configuration;
	using Terrasoft.UI.WebControls.Utilities;
 
	#region Class: UsrProcess_7b09d28TravelAgencyDev1MethodsWrapper
 
	/// <exclude/>
	public class UsrProcess_7b09d28TravelAgencyDev1MethodsWrapper : ProcessModel
	{
 
		public UsrProcess_7b09d28TravelAgencyDev1MethodsWrapper(Process process)
			: base(process) {
			AddScriptTaskMethod("ScriptTask2Execute", ScriptTask2Execute);
			AddScriptTaskMethod("ScriptTask3Execute", ScriptTask3Execute);
			AddScriptTaskMethod("ScriptTask4Execute", ScriptTask4Execute);
		}
 
		#region Methods: Private
 
		private bool ScriptTask2Execute(ProcessExecutingContext context) {
			string sender="AutoAddVisits";
			string msgbody="something";
			MsgChannelUtilities.PostMessage(UserConnection,sender,msgbody);
			return true;
		}
 
		private bool ScriptTask3Execute(ProcessExecutingContext context) {
			var frequency="frequencyInDays";
			switch (frequency) {
			         case "Daily":
			            Set(frequency, 1);
			                        break;
			                    case "Weekly":
			                        Set("frequency", 7);
			                        break;
			                    case "Monthly":
			                        Set("frequency", 30);
			                        break;
			                    default:
			                       break;
			 }
			return true;
		}
 
		private bool ScriptTask4Execute(ProcessExecutingContext context) {
			var travelOfferId = "TravelId"; 
			var travelOfferSchemaName = "TravelOffers";
			var travelOfferEsq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, travelOfferSchemaName);
			travelOfferEsq.addColumn("TravelOfferFrequency");
			var travelOffer = travelOfferEsq.getEntity(travelOfferId);
 
			var tourSchemaName = "Tours";
			var tourEsq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, tourSchemaName);
			var tourCollection = new Collection();
 
			var currentDate = new Date();
			var firstTour = tourCollection.add(tourEsq.createEntity(UserConnection));
			firstTour.set("TravelOffer", travelOfferId);
			firstTour.set("TourDate", currentDate);
 
			var travelOfferFrequency = travelOffer.get("UsrTravelOfferFrequencyId").displayValue;
			var tourDate = currentDate;
			for (var i = 1; i < 8; i++) {
			    switch (travelOfferFrequency) {
			        case "Daily":
			            tourDate.setDate(tourDate.getDate() + 1);
			            break;
			        case "Weekly":
			            tourDate.setDate(tourDate.getDate() + 7);
			            break;
			        case "Monthly":
			            tourDate.setDate(tourDate.getDate() + 30);
			            break;
			        default:
			            throw new UnknownException("Invalid travel offer frequency");
			    }
			    var tour = tourCollection.add(tourEsq.createEntity(UserConnection));
			    tour.set("TravelOffer", travelOfferId);
			    tour.set("TourDate", tourDate);
			}
 
			tourCollection.saveAll({
			    isExternal: true,
			    success: function() {
			        // The tour entities have been saved
			    },
			    failure: function() {
			        // An error occurred while saving the tour entities
			    }
			});
		}
 
		#endregion
 
	}
 
	#endregion
 
}

 

Like 0

Like

2 comments

Hello,

We need more information to solve your problem, please contact our support team - support@creatio.com

Pavlo Sokil,

I sent you a mail 

Show all comments