Filters

Creatio extends its Marketplace offerings with 20 new solutions to simplify and accelerate everyday tasks. Follow the link to see what’s new out on the Creatio Marketplace for your business. 

#nocode 

Like 10

Like

Share

0 comments
Show all comments

Hello community,

 

I'm using isDetailEnabled method in client side to remove add button in detail based on specific conditions. For users in "System Administrator" role I want to allow the add button for every detail. 

 

 JSCODE:

isDetailEnabled: function(detailName) {
    			var esq =  Ext.create("Terrasoft.EntitySchemaQuery", {
						rootSchemaName: "SysUserInRole"
				});
				esq.addColumn("SysRole");
				// add filter for current user
				esq.filters.add("UserFilter", Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SysUser", Terrasoft.SysValue.CURRENT_USER.value
				));
				// add filter for role name, joining to SysRole (which is where the name is stored)
				esq.filters.add("RoleFilter", Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SysRole.Id", "83a43ebc-f36b-1410-298d-001e8c82bcad" 
				));
               esq.getEntityCollection(function(result) {
                        if (result.success && result.collection.getItems().length > 0) {
                              return true;
                        }
                       return false;
               });
                return this.callParent(arguments);
}

 

Like 0

Like

1 comments

Since EntitySchemaQuery is asynchronous, it doesn't wait for the results to return before the isDetailEnabled function returns. You'll need to pre-fetch if the user is in the role (maybe in the init, or elsewhere) and save that result in an attribute or something, then just check the attribute from the isDetailEnabled function. Does that make sense?

Ryan

Show all comments

Hi there,

 

I made a button that call ProcessModuleUtilities on click. Once clicked, the callback is called and a BodyMask is shown but never hidden.

 

Here is the button :

			{
				"operation": "insert",
				"name": "GetAccountBtn",
				"parentName": "LeftContainer",
				"propertyName": "items",
				"values": {
					"itemType": Terrasoft.ViewItemType.BUTTON,
					"caption": {
						"bindTo": "Resources.Strings.GetAccount"
					},
					"click": {
						"bindTo": "onGetAccountClick"
					},
					"visible": {
						"bindTo": "getGetAccountButtonVisible"
					},
					"enabled": {
						"bindTo": "getGetAccountButtonEnable"
					},
					"style": "blue",
					"classes": {
                        "textClass": ["actions-button-margin-right"]
                    }
				}
			},

Here is the methods :

			onGetAccountClick: function() {
				Terrasoft.showConfirmation("Effectuer une demande pour devenir l'AM de ce compte ?", function(result) { 
    				if (result === Terrasoft.MessageBoxButtons.YES.returnCode) {
        				this.processGetAbandonAccountPopupResponse("RequestGetAccount");
    				}
				}, ["yes", "no"], this);
			},
			processGetAbandonAccountPopupResponse: function (processName) {
				args = {
					sysProcessName: processName,
					parameters: {
						accountId: this.get("Id"),
						userId: Terrasoft.SysValue.CURRENT_USER.value
					},
					callback: this.callbackShowRequestMade,
					scope: this
				};
				ProcessModuleUtilities.executeProcess(args);
			},
			callbackShowRequestMade: function () {
				this.showInformationDialog("Votre demande a été effectuée.");
			},

Here is my business process :

And finally here is the result : https://vimeo.com/727290324/560dec0d61

 

I have this error in the console  :

XML Parsing Error: not well-formed Location: https://creatioBaseUrl/0/ServiceModel/ProcessEngineService.svc/RunProce… Line Number 1, Column 1

 

Here is the request made by my browser :

POST https://creatioBaseUrl/0/ServiceModel/ProcessEngineService.svc/RunProcess

Request body :

{
  "collectExecutionData": true,
  "parameterValues": [
    {
      "name": "accountId",
      "value": "b253a1de-10cd-452f-bd23-28ecb696b44a"
    },
    {
      "name": "userId",
      "value": "aa995be7-7611-43ea-a79d-19894080a976"
    }
  ],
  "schemaName": "RequestGetAccount",
  "resultParameterNames": []
}

Response body :

{
  "processId": "e3493a1e-0069-4164-81e1-47c7743146f0",
  "processStatus": 1,
  "resultParameterValues": null,
  "executionData": null,
  "success": true,
  "errorInfo": null
}

Do you have any idea what can I do to fix this bodyMask issue ?

 

Kind regards,

 

Julien

Like 0

Like

1 comments

When you use a callback with ProcessModuleUtilities, you're responsible for clearing the mask in the callback function.  Add MaskHelper module to the top of the code (like you did with ProcessModuleUtilities) and then call this in the callback function:

MaskHelper.HideBodyMask();

Ryan

Show all comments
Question

Hi,

Are there any pre-installed functions available to convert a Json object to a string? When I try to declare JsonSerializer, it doesn't find it. Wondering if I need to import it or if there is something else I could use.

 

Thanks!

Like 0

Like

5 comments

Hello Heather, if you need serialization in the source code you can just add using Newtonsoft.Json and work with it. 

Hi @Heather! How are you? Do you need in C#? You could use:
    string jsonString = Json.Serialize(response);
Adding this reference: using Terrasoft.Common.Json;

I hope you find it useful
Regards.

Uriel Nusenbaum,

Hi,

When I try to use it on my page, I get the following error.

message: Uncaught Error: Script error for "Terrasoft.Common.Json", needed by: UsrManifests1Page

 

I'm not sure how I'm supposed to add it to the Page. I tried it as follows but I guess this is not correct.

define("UsrManifests1Page", ["ProcessModuleUtilities","ConfigurationGrid", "ConfigurationGridGenerator", "ConfigurationGridUtilities","Terrasoft.Common.Json"], function(ProcessModuleUtilities) {
 

Thanks very much

Dmytro Vovchenko,

Uriel Nusenbaum,

I think my confusion may be that I am trying to read a message from the Sandbox, not real Json. So it is not recognizing it as Json. From the Sandbox documentation, I do not see how I am supposed to access the particular value of my Sandbox message from the args. Do you happen to know how to do this?

 

I have this in the Sandbox which I thought was Json. I need to get value: as a string.

{value: 'undefined; bb49d0ab-62fc-4009-ad35-6ff40bfb0476'}

Uriel Nusenbaum,

Dmytro Vovchenko,

Thank you for your help. I realized I can just get the value from the Sandbox like this. Did not turn out to be Json related but I appreciate your assistance.

onMessageSubscribe: function(args) {
				this.set("selectedDetailRows",args.value);
            },

 

Show all comments

Hi Community! Hope you are doing well.
My goal is to create leads from third party app, obviously avoiding loading duplicates.
I have those questions:

  1. I know that it exists in the process element "Find and Merge duplicate". What is the result of this item? Does it tell us what is the ID of the record that remains? The new record created or the merged record in which result/parameter? gOldRecordId?
  2. I'm working on a source code schema. Can I re use some code to achive my goal? I was reviewing some other services that create leads from landing pages or others, but they are not simple to adapt. Is there any method that allows me to validate duplicates or to do the merge by code after having saved a lead?

Any other comment or suggestion are welcome.

Thank you!

Regards.

 

 

Like 0

Like

0 comments
Show all comments