I have the following script task in a bpm.
This is responsible for taking the results of this api and inserting the records into a Creatio object.

Script task:

 var baseUrl = "https://angelbaraldo.creatio.com";
    var authUrl = baseUrl + "/ServiceModel/AuthService.svc/Login";
    var apiUrl = baseUrl + "/0/rest/CustomStockService/GetNoConciliadosData";
    var username = "MyUser";
    var password = "MyPassword";
 
    // Cuerpo de autenticación
    var authBody = new
    {
        UserName = username,
        UserPassword = password
    };
 
    var authBodyJson = Newtonsoft.Json.JsonConvert.SerializeObject(authBody);
 
    // Solicitud de autenticación
    var authRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(authUrl);
    authRequest.Method = "POST";
    authRequest.ContentType = "application/json; charset=utf-8";
 
    using (var streamWriter = new System.IO.StreamWriter(authRequest.GetRequestStream()))
    {
        streamWriter.Write(authBodyJson);
    }
 
    string authCookies = null;
    string bpmcsrf = null;
 
    // Obtener la respuesta de autenticación
    using (var authResponse = (System.Net.HttpWebResponse)authRequest.GetResponse())
    {
        authCookies = authResponse.Headers["Set-Cookie"];
 
        // Buscar el token BPMCSRF en las cookies
        var cookies = authResponse.Headers.GetValues("Set-Cookie");
        if (cookies != null)
        {
            foreach (var cookie in cookies)
            {
                if (cookie.Contains("BPMCSRF"))
                {
                    bpmcsrf = cookie.Split('=')[1].Split(';')[0];
                }
            }
        }
 
        if (string.IsNullOrEmpty(authCookies) || string.IsNullOrEmpty(bpmcsrf))
        {
            throw new Exception("Autenticación fallida: no se obtuvieron cookies o token BPMCSRF.");
        }
    }
 
    // Solicitud autenticada a la API
    var apiRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(apiUrl);
    apiRequest.Method = "GET";
    apiRequest.ContentType = "application/json";
    apiRequest.Headers["ForceUseSession"] = "true";
    apiRequest.Headers["Cookie"] = authCookies;
    apiRequest.Headers["BPMCSRF"] = bpmcsrf;
 
    // Obtener respuesta de la API
    string apiResponseContent;
    using (var apiResponse = (System.Net.HttpWebResponse)apiRequest.GetResponse())
    {
        using (var streamReader = new System.IO.StreamReader(apiResponse.GetResponseStream()))
        {
            apiResponseContent = streamReader.ReadToEnd();
        }
    }
 
    // Parsear los datos de la API
    var jsonRecords = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, object>>>(apiResponseContent);
    // Procesar los registros (como en tu código original)
    var cantidadInsertados = 0;
 
    foreach (var record in jsonRecords)
    {
        var tipo = record.ContainsKey("Tipo") ? record["Tipo"]?.ToString() : null;
        var letter = record.ContainsKey("Letter") ? record["Letter"]?.ToString() : null;
        var cardCode = record.ContainsKey("CardCode") ? record["CardCode"]?.ToString() : null;
        var nroComprobante = record.ContainsKey("Nro Comprobante") ? record["Nro Comprobante"]?.ToString() : null;
        var nroOv = record.ContainsKey("Nro OV") ? record["Nro OV"]?.ToString() : null;
        var pymentGroup = record.ContainsKey("PymntGroup") ? record["PymntGroup"]?.ToString() : null;
        var docDate = record.ContainsKey("DocDate") ? record["DocDate"]?.ToString() : null;
        var vencimiento = record.ContainsKey("Vencimiento") ? record["Vencimiento"]?.ToString() : null;
        var docCur = record.ContainsKey("DocCur") ? record["DocCur"]?.ToString() : null;
        var docRate = record.ContainsKey("DocRate") ? record["DocRate"] : null;
        var debe = record.ContainsKey("Debe") ? record["Debe"] : null;
        var haber = record.ContainsKey("Haber") ? record["Haber"] : null;
        var debeUsd = record.ContainsKey("Debe USD") ? record["Debe USD"] : null;
        var haberUsd = record.ContainsKey("Haber USD") ? record["Haber USD"] : null;
 
        // Verificar si el registro ya existe
        var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "AgbCuentaCteSocioNegocios");
        var idColumn = esq.AddColumn("Id");
        esq.Filters.Add(esq.CreateFilterWithParameters(FilterComparisonType.Equal, "AgbCuemtaCteNumeroComprobante", nroComprobante));
        var entityCollection = esq.GetEntityCollection(UserConnection);
 
        // Consultar la cuenta relacionada
        var esq2 = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "Account");
        var accountIdColumn = esq2.AddColumn("Id");
        esq2.Filters.Add(esq2.CreateFilterWithParameters(FilterComparisonType.Equal, "AgbCodigoSocioDeNegocios", cardCode));
        var accountCollection = esq2.GetEntityCollection(UserConnection);
 
        Guid? accountId = accountCollection.Count == 1 ? accountCollection[0].GetTypedColumnValue<Guid>(accountIdColumn.Name) : (Guid?)null;
 
        // Insertar el registro si no existe
        if (entityCollection.Count == 0 && !string.IsNullOrEmpty(nroComprobante))
        {
            var newEntity = UserConnection.EntitySchemaManager.GetInstanceByName("AgbCuentaCteSocioNegocios").CreateEntity(UserConnection);
 
            newEntity.SetDefColumnValues();
 
            newEntity.SetColumnValue("AgbCuemtaCteNumeroComprobante", nroComprobante);
            newEntity.SetColumnValue("AgbCuentaCteCodigoSn", cardCode);
            newEntity.SetColumnValue("AgbCuentaCteCondicionPago", pymentGroup);
            newEntity.SetColumnValue("AgbCuentaCteCuentas", accountId);
            newEntity.SetColumnValue("AgbCuentaCteDebe", debe);
            newEntity.SetColumnValue("AgbCuentaCteDebeUsd", debeUsd);
            newEntity.SetColumnValue("AgbCuentaCteFechaDocumento", docDate);
            newEntity.SetColumnValue("AgbCuentaCteFechaVencimiento", vencimiento);
            newEntity.SetColumnValue("AgbCuentaCteHaber", haber);
            newEntity.SetColumnValue("AgbCuentaCteHaberUsd", haberUsd);
            newEntity.SetColumnValue("AgbCuentaCteLetra", letter);
            newEntity.SetColumnValue("AgbCuentaCteMoneda", docCur);
            newEntity.SetColumnValue("AgbCuentaCteNumeroOv", nroOv);
            newEntity.SetColumnValue("AgbCuentaCteTipoCambio", docRate);
            newEntity.SetColumnValue("AgbCuentaCteTipoDocumento", tipo);
 
            newEntity.Save();
 
            // Incrementar el contador de registros insertados
            cantidadInsertados++;
        }
    }
 
    // Establecer el valor de registros insertados en la variable del proceso
    Set<int>("CantidadInsertados", cantidadInsertados);
 
    return true;

 

But when I run the bpm I get this error

Error:

System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.GetResponse()
   at Terrasoft.Core.Process.AgbProcess_93e521fAngelBaraldo1MethodsWrapper.ScriptTask1Execute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessScriptTask.InternalExecute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.CallInternalExecute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.ExecuteItem(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.Execute(ProcessExecutingContext context)

 

Like 1

Like

2 comments

Are you trying to send requests from Creatio to the same Creatio environment? 

If that's so, it's really strange implementation. I think it's much better to call the service logic directly rather then  send an HTTP request to the endpoint and parse the response json. 

the mock code would look like this 

var service = new CustomStockServiceHelper(userConnection); 
var response = service.GetNoConciliadosData();

I assumed that you use a CustomStockServiceHelper in CustomStockService to retrieve the data. 

 

DM me if you need more help. 

Best regards, 
Yurii

 

Yuri Sokil,

Yuri thanks for you response.

Show all comments

Hi

I am trying to follow the example of building a custom components using remote module from this page: 

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/front-end-development/freedom-ui/remote-module/implement-a-remote-module/overview

But when I reach the part of building the project on VS code using "npm run build" I always get the following error:

 

Generating browser application bundles (phase: setup)...C:\Users\Lenovo\Downloads\example4\node_modules\webpack\lib\container\ModuleFederationPlugin.js:58
                       throw new TypeError(
                             ^
TypeError: The 'compilation' argument must be an instance of Compilation
   at ModuleFederationPlugin.getCompilationHooks (C:\Users\Lenovo\Downloads\example4\node_modules\webpack\lib\container\ModuleFederationPlugin.js:58:10)
   at C:\Users\Lenovo\Downloads\example4\node_modules\webpack\lib\container\HoistContainerReferencesPlugin.js:36:33
   at Hook.eval [as call] (eval at create (C:\Users\Lenovo\Downloads\example4\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:88:1)
   at Hook.CALL_DELEGATE [as _call] (C:\Users\Lenovo\Downloads\example4\node_modules\tapable\lib\Hook.js:14:14)
   at Compiler.newCompilation (C:\Users\Lenovo\Downloads\example4\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1121:30)
   at C:\Users\Lenovo\Downloads\example4\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\Compiler.js:1166:29
   at eval (eval at create (C:\Users\Lenovo\Downloads\example4\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:31:1)

   

Any help for this?

Like 0

Like

1 comments

Hello,
I do not believe this issue has something to do with the article you provided or the Creatio system. Try to look for this error in other sources for example here.

Show all comments

Hi

I need help from you please how can I upload any file inside Attachment file and store it inside SharePoint can you help me

Regards,

Like 0

Like

2 comments

Hi Muath,

You can use the following marketplace add-on:
https://marketplace.creatio.com/app/sharepoint-integration-creatio

If this connector is not sufficient, the only other option is custom development.

Have a great day!

the case is that i need to develop this without add-ons  from marketplace. can you provide any guidelines or article to help me

Show all comments

Hey Everyone,


I am trying to change the order of the address in full address field in Accounts section of Customer360 creatio. Instead of Zip + Country + State + City + Address I want it as Address + City + State + ZipCode + Country.

 

I tried overriding the BaseAddressEventListener with my custom event listener but it didn't worked

 

Can someone please guide me on how to do it?

Like 1

Like

2 comments

Hello Ansh,
 

I have contacted our R&D team regarding this question. First of all, this logic is implemented on the backend side, which means that even if it is possible, it would likely be extremely challenging to achieve.
 

To conclude, I believe it is not feasible at the moment. However, I will register this as a potential improvement, and hopefully, this feature will be implemented in the future.
 

Best regards

Yevhenii Grytsiuk,

Thank you
The issue is fixed now, As I added a CustomAddressEventListener to override the BaseAddressEventListener in the source code of my custom package.

Show all comments

I am currently customizing the Account module in the Freedom UI and encountering an issue with the PDS_UsrBillToNumber_volqoyn field. This field is an integer field bound to PDS.UsrBillToNumber in the model configuration.

My goal is to remove the comma separator from this field, but the solutions I have tried so far have not worked. These include:

  1. Using useThousandSeparators: false in controlConfig.
  2. Setting useGrouping: false in the numberFormat object within controlConfig.
  3. Modifying configurations in the format object for field values.
  4. Implementing custom methods for formatting.

Unfortunately, none of these approaches have yielded the desired result. Could you kindly guide me on the correct implementation or suggest an alternative solution?

Like 4

Like

1 comments

Hello Shraddha,

Currently this task is impossible to accomplish with no-code/low-code tools. I have tried to do similar approach as described here: https://community.creatio.com/questions/freedomui-format-number-list-view-without-commas but did not achieve anything. I tried to add eventListenere on the input and replace any non-digit character, but again i could not achieve anything. Anyway i will inform R&D team, so in the nearest future this might be implemented.
 

Show all comments

Hi,

 

I am trying to create a business rule that 'hides elements' based upon the 'current user account' as below. I interpreted this variable as the account that the current user's 'Contact' is assigned to. Is this correct? I can't seem to get it to work as intended.

 

 

I have added myself as a contact to an account as below.

 

Is there any way to set up a business rule to show/hide or set read/write permissions based upon whether the current user is assigned to an account?

 

Thanks in advance,

Brendon

 

Like 3

Like

3 comments

Bump.

Greetings!
 

If you want to hide the element for certain users and display it for others based on selected data, you need to hide the element by default first. Then, configure it to allow visibility under specific conditions.


If the element is displayed by default and you try to configure it to show for specific roles, it will not work as expected because the element is already visible to everyone by default. In such cases, you should configure it for hiding instead.


Additionally, please note that business rules should not conflict with each other. If they do, the business rules will not function correctly.


More information can be found in our documentation: 

https://academy.creatio.com/docs/8.x/no-code-customization/8.1/customization-tools/ui-and-business-logic-customization/freedom-ui-business-rules

Best Regards, 
Orkhan

Thanks Orkhan. Super helpful, much appreciated!

Show all comments

{
 "operation": "insert",
 "name": "ComboBox_asw7mde",
 "values": {
   "layoutConfig": {
     "column": 1,
     "row": 2,
     "colSpan": 1,
     "rowSpan": 1
   },
   "type": "crt.MultiSelectComboBox", or crt.ComboBox
   "label": "$Resources.Strings.PDS_GenContactRoles_vm2smp6", 
   "labelPosition": "auto",
   "control": "$PDS_GenContactRoles_vm2smp6",  
   "listActions": [],
   "showValueAsLink": true,
   "controlActions": [],
   "visible": true,
   "readonly": false,
   "placeholder": "Виберіть ролі", 
   "tooltip": "Вибір ролей контакту"
 },
 "parentName": "GridContainer_035sekm",
 "propertyName": "items",
 "index": 2
}

 

and my filter is: handlers: /**SCHEMA_HANDLERS*/[
 {
   "request": "usr.OpenLookupRequest",
   "handler": async (request, next) => {
     devkit.HandlerChainService.instance.process({
       type: "crt.OpenLookupPageRequest", // Відкриваємо сторінку пошуку
       scopes: [...request.scopes],
       $context: request.$context,
       entitySchemaName: "Contact", // Вибір контактів
       schemaName: 'DefaultLookupPage', // Загальнодоступна сторінка для вибору контактів
       itemAttributeName: 'ComboBox_asw7mde', // Вказуємо атрибут ComboBox для запису вибраних значень
       afterClosed: (result) => {
         if (result && result.selectedRows) {
           // Отримуємо всі вибрані значення
           const selectedValues = result.selectedRows.map(row => row.displayValue); // Вибираємо displayValue кожного елемента
           alert(`Вибрані значення: ${selectedValues.join(', ')}`); // Виводимо всі вибрані значення
         }
       },
       filtersConfig: {
         filterAttributes: [
           {
             name: 'MyFilter',
             loadOnChange: false
           }
         ],
         attributesConfig: {
           MyFilter: {
             value: {
               "items": {
                 "29e16d42-36f1-4e04-9029-4321cbb2494d": {
                   "filterType": 1,
                   "comparisonType": 11,
                   "isEnabled": true,
                   "trimDateTimeParameterToDate": false,
                   "leftExpression": {
                     "expressionType": 0,
                     "columnPath": "Name"
                   },
                   "isAggregative": false,
                   "dataValueType": 1,
                   "rightExpression": {
                     "expressionType": 2,
                     "parameter": {
                       "dataValueType": 1,
                       "value": "Super"
                     }
                   }
                 }
               },
               "logicalOperation": 0,
               "isEnabled": true,
               "filterType": 6,
               "rootSchemaName": "Contact"
             }
           }
         }
       }
     });
     return next?.handle(request);
   }
 }
]/**SCHEMA_HANDLERS*/,
 

Like 0

Like

1 comments

Hello,
I do not quite understand what you are trying to achieve, if you want to implement a multi-select, then this option will be fully available in version 8.2.1.

Show all comments

Hi, all senior mentors, 

 

   While configure the "Task" in business process,  I can see dozens objects in "Connected to" setting , however, I can't find "Product" object inside the selection list? How can I add these objects not in the list to this task?
    
   Thanks in adv. 

 

Jeffrey

File attachments
Like 0

Like

1 comments

Hello,

 

In order to achieve your business idea you firstly need to create a connection between the Activity object and the object of your need (Product). You can find an example of how that can be achieved in this community post:

https://community.creatio.com/questions/how-add-column-activity-connected-toentityconnection-detail

 

After that the needed object should appear in the "Connected to" list of objects.

Show all comments

Hello 

How can I get the information of this json to put in different fields so I can use them in business process. 

 

{"signer_data":{"name":"laura@artica.digital","authority":"Vinculada a Correo Electrónico por Liga","id":1655735,"email":"laura@artica.digital","fingerprint":"66bf3e0a67ba87d5aeae33e5e98db771968aae83","box_id":"wxjXMgLPz","box_data":"laura@artica.digital","signature_date":"2024-12-19T19:31:59Z"},"signer_email":"laura@artica.digital","signer_fingerprint":"66bf3e0a67ba87d5aeae33e5e98db771968aae83","signer":1655735,"user":233645,"notification_type":"original_signed","notification_id":"3639332","first_notification_date":"2024-12-19T19:32:03Z","document_title":"INFONAVIT. PM005690004564500002NUEVA ASIGNACION SIN BORRADO (1).pdf","firmamex_id":"af8b17ab-9dc0-4130-8f6e-65e24134e596","text":"Document af8b17ab-9dc0-4130-8f6e-65e24134e596.pdf just signed"}

 

i get this json for a webhook. 

 

 

Like 0

Like

2 comments

Hello!

 

Currently, to parse values from webhook via business process you would need to use a custom script task element. Also, you can read more information on how to process webhooks here.

 

Basically in this community thread is already was provided an answer - https://community.creatio.com/questions/parsing-webhooks

Hello 

 

Thank you, I manage to pass the json to the parameters using the next example https://community.creatio.com/questions/help-parse-json-i-get-webservice-variables-can-after-introduce-creatio-object

 

but i get an error in the process 

 

Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Terrasoft.Configuration.UsrForCustomObject.Meta]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List&lt;T&gt;) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'meta.signer', line 1, position 18.
   at Terrasoft.Common.Json.Json.Deserialize[T](String value, Func`2 func)
   at Terrasoft.Core.Process.UsrProcess_e6a76c0MethodsWrapper.PerformJsonDeserialize()
   at Terrasoft.Core.Process.UsrProcess_e6a76c0MethodsWrapper.ScriptTask1Execute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessScriptTask.InternalExecute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.CallInternalExecute(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.ExecuteItem(ProcessExecutingContext context)
   at Terrasoft.Core.Process.ProcessFlowElement.Execute(ProcessExecutingContext context)

 

 

The method that I use is this one 

 

public void PerformJsonDeserialize()
{
	var passedValue = Get&lt;string&gt;("PassedJSONString");
	if (!String.IsNullOrEmpty(passedValue))
	{
		UsrForCustomObject testCustObj =Json.Deserialize&lt;UsrForCustomObject&gt;(passedValue);
		Set&lt;string&gt;("Parsedname", testCustObj.name);
		Set&lt;string&gt;("Parsedauthority", testCustObj.authority);
		Set&lt;string&gt;("Parsedsigner", testCustObj.meta[0].signer);
		Set&lt;string&gt;("Parsedreason", testCustObj.meta[0].reason);
		Set&lt;string&gt;("Parsednotification_type", testCustObj.notification_type);
 
 
 
 
	}
}
return true; 

 

 

Can you help me know what is the problem? I think is related with this part UsrForCustomObject testCustObj =Json.Deserialize<UsrForCustomObject>(passedValue)  but I already try changing that to 
DeserializeDictionary(String) or Deserialize<T>(String, JsonSerializerSettings)

and i still have the error 

 

thank you 

Show all comments

Hi ,

 

I have installed 64 bit ms word plugin for creatio. In order to connect i am using the same password and user name which is reflected in the account but still it says log in incorrect.

Any inputs on this would be really helpful.

 

Thankyou

Like 0

Like

1 comments

Hello, 

Please note, that logging into Word Plugin with 2-factor authentication turned on is disabled for now, so please make sure it's turned off. Also make sure if the appropriate plugin version has been installed, verify if your System type is in compliance with plugin version 64 bit. 


Instruction for proper installation is available with this link: https://academy.creatio.com/docs/8.x/no-code-customization/customization-tools/print-ready-reports/install-creatio-plug-in-for-ms-word

Also use this insttuction to disactivate 2-FA, go to point 3 and instead of enabling it, please disactivate it: https://academy.creatio.com/docs/8.x/setup-and-administration/administration/user-and-access-management/authentication/set-up-two-factor-authentication

Thank you !

 

Show all comments