Время создания
Filters

Greetings Community,

 

     Could someone provide me with references for Script Task queries related to CRUD operations on Creatio objects?

 

      Are there any examples or references available for sample scripts and C# functions regarding the Script Task element suitable for beginners?

Like 0

Like

2 comments

Hello,

 

As the first step, we recommend you to check our Academy article on Script Task process element that includes both instructions and examples of working with it. You can also use Academy and Community for searching examples of implementation of some more specific requests using the key words.

https://academy.creatio.com/docs/8.x/no-code-customization/bpm-tools/pr…

Hello Mira,

 

Thank you for your reply. I have reviewed the Academy article on the Script Task Process element. Also, executed on Creatio platform.

 

I am now interested in learning more about what we can accomplish with the Script Task element. Is there any additional information or examples available for Script element? 

 

regards, 

Ajay

Show all comments

Hi,

Is there a way to get the process log id generated by the current running business process?
I want to know what is the process log id while the business process is running.

Like 0

Like

0 comments
Show all comments

For instance, I've crafted a function to generate a contact:

 

void InsertContact(string contactName) {
   UserConnection userConnection = Get("UserConnection");

   contactName = contactName ?? "Unknown contact";


   var ins = new Insert(userConnection)
       .Into("Contact")
       .Set("Name", Column.Parameter(contactName))
       .Set("JobTitle", Column.Parameter("Consultant"))
       .Set("Notes", Column.Parameter("C# Script Test"));

 

   var affectedRows = ins.Execute();
}

 

However, I desire the function to be more versatile:

void InsertObject(string contactName, string ObjectName, var Object) {


   UserConnection userConnection = Get("UserConnection");

 

   // Generate a query dynamically using Object Name, Contact Object Columns, and Values

   var ins = new Insert(userConnection)
       .Into(ObjectName)
       .Set(Object["key"], Column.Parameter(Object["value"]));

 

   var affectedRows = ins.Execute();
}

This enhanced function can be dynamically utilized within the Script Element.

 

Is it possible to create the dynamic functions in Creatio like this?

 

Like 0

Like

1 comments

Hello, Ajay!

You can implement any logic with the code in the Creatio configuration, and any realization in C# is supported. Your code example looks logical and you can add it to the script task in business process, for example. 
More information about Script tasks:

https://academy.creatio.com/docs/8.x/no-code-customization/bpm-tools/process-elements-reference/system-actions/script-task-process-element

Back-end (C#) development basics:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/architecture/development-in-creatio/back-end-c-sharp

Also, you can register a background operation by following this article and use it in any part of application:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/back-end-development/data-operations-back-end/execute-operations-in-the-background/examples/register-a-background-operation

Show all comments

Hello,

 

Does Creatio have any implemented logic for versioning the files? I see that the base File object has a "Version" column that is always set to 1, it seems. Can this behaviour be changed? 

 

Thank you!

Like 0

Like

1 comments

Hello,
 

The logic of the Version column value for the file object is located at the event level of the "File" object process as part of the CrtCoreBase package.



You can use development to create a replacement for the object, where you use your own custom logic to assign a value to the Version column when the object event occurs. This implementation requires knowledge of development and writing source code.
You can learn more about events in the system on Creatio Academy.

You can also create a business process (no-code) that will make the necessary changes to the column values when adding/modifying a record.
 

Thank you.

Show all comments
Question

Hi Team, somebody knows how to get the UId for an schema on a Freedom Page? I was using Terrasoft.EntitySchemaDesignerUtilities.getEntitySchemaUIdByName(EntityName) on classic, but seams not be working.

Like 0

Like

6 comments
Best reply

This will work, even from Freedom UI pages:

const entityName = "Account";
const entityUid = Terrasoft.configuration.ModuleStructure[entityName].entitySchemaUId;

Ryan

Hello,

 

Can you please describe the approach that is not working a little bit more? Here is an example for the "Knowledge Base" section which is a Freedom UI section:

Also works properly for the custom section created in FreedomUI.

Oleg Drobina,

I'm trying to do it from a handler trigger from a button. For some reason is not getting there.

My version is 8.1.0.6672

 

Federico Buffa,

 

you can try another approach:

{
				request: "usr.CustomButtonClicked",
				handler: async (request, next) => {
					const sysSchemaModel = await sdk.Model.create("SysSchema");
					const filters = new sdk.FilterGroup();
					await filters.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Name", "Account");
					const result = await sysSchemaModel.load({
						attributes: ["Id", "UId", "Name"],
						parameters: [{
							type: sdk.ModelParameterType.Filter,
							value: filters
						}]
					});
					console.log(result);
				}
			}

Create an instance of the SysSchemaModel and load results based on the object name.

 

I couldn't locate the scenario for retrieving the UId of SysSchema directly, but you can try using this approach.

 

Or another option:

 

var currentSchemaUId = Terrasoft.configuration.ModuleStructure.Account.entitySchemaUId;

 

This will also return the UId of the SysSchema of the section entity (just replace Account with the needed object name).

Oleg Drobina,

Thank you Oleg. I think to do the query as well, but perhaps some class was available. I will try this approch.

This will work, even from Freedom UI pages:

const entityName = "Account";
const entityUid = Terrasoft.configuration.ModuleStructure[entityName].entitySchemaUId;

Ryan

Ryan Farley,

Yes that works for me.

Show all comments