Время создания
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

1 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…

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

0 comments
Show all comments

Hello!

 

In this article, we will describe how to work with macros and filling in the values.

 

This functionality was added specifically so that the user could clearly see that there are no values in these fields and that it is necessary to manually edit such an email before sending it.
 

To solve this issue, you can configure the mandatory filling of the fields used in the template for the template to be sent correctly.

Also, as part of sending emails through a process, you can add additional logic to the process itself by setting up two branches (containing and not containing data) using two email templates:
1) with macros
2) without macros
 

In general, to resolve the issue, make these fields mandatory when creating a record, or edit emails before sending them (in the process, check the “Send email manually” box for the [Send email] element), or reconfigure the process by creating two branches as described above.

 

Also, there is another way to resolve it.

 

In the business processes and bulk emails, macros are already empty when the data is not filled in. In the UI you would need to do the following to remove the macro description: 

You would need to create your own service, copying InvokableMacrosHelperService, change macrosHelper instantiation to use Factory: 

            var macrosHelper = new InvokableMacrosHelper { UserConnection = UserConnection };
to 
            var macrosHelper = ClassFactory.Get()
After that, you would need to override the ReplaceMacros(string template, List macrosInfo) method in class InvokableMacrosHelper (using [Terrasoft.Core.Factories.Override]) to change the macro to an empty value instead of a highlight instead:
 protected override string ReplaceMacros(string template, List macrosInfo) {
      string result = template;
      foreach (MacrosInfo item in macrosInfo) {
        string macrosDisplayValue = string.Format(MacrosTemplate, item.Alias);
        result = result.Replace(macrosDisplayValue, "");
      }
      return result;
    }

You can find an original method in MacrosHelperV2. After that, you would need to change the calls of the service from OOB service to your service in the action dashboard or email page. 

Like 0

Like

Share

0 comments
Show all comments