Hello ,

 

I am willing to configure queues and was wondering what is the best practice? Do I configure them on the dev environment and bind them to my working package or shall I create them in prd environment directly?

 

thanks,

Like 0

Like

3 comments

Hello Mariam,

 

Please find the all necessary information on how to work with the Queues section here



Best regards,

Bogdan

Hello Bogdan,

 

Thank you for your response ;

I am able to create and configure queues, my question is regarding transporting queues between instances.

 

Regards,

mariam moufaddal,

 

You can transfer configurations by package. 



We recommend transferring packages between environments deployed on the same version of Creatio in order to avoid unexpected issues after or during the process. 



Best regards,

Bogdan

Show all comments

Hi Community,

 

We are trying to integrate the Zadarma Widget with Creatio. Our main objective is to load this widget every time we press the "Phone" button (marked with red square in the following image).

In order to achieve this, we need to call the necessary dependencies, so it's possible to execute the "zadarmaWidgetFn" function, as you can see on the next image.

require.config({
	paths: {
		loader_phone_lib: '//my.zadarma.com/webphoneWebRTCWidget/v8/js/loader-phone-lib.js?sub_v=62',
		loader_phone_fn: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/loader-phone-fn.js?sub_v=62"
	},
});
 
define("CtiPanel", ["ServiceHelper", "loader_phone_lib", "loader_phone_fn"], function(ServiceHelper) {
	return {
		messages: {},
		mixins: {},
		attributes: {},
		methods: {
			callPhoneNumber: function (){
				var number = this.get("PhoneNumber");
				window.console.log(number);
 
				var sipValue = "SIP";
 
				var payload = {
					sip: sipValue
				};
 
				ServiceHelper.callService("ImdZadarmaWebHookService", "ZadarmaWebRTCKey", function(response) {
					var result = JSON.parse(response.ZadarmaWebRTCKeyResult);
					window.console.log(result.key);
					zadarmaWidgetFn(result.key, 'SIP', 'square', 'en', true, "{left:'10px',top:'5px'}");
				}, payload, this);
			}
		},
		diff: []
	};
});

However, we are getting the following error while loading these dependencies, because one of the files "loader_phone_lib" (https://my.zadarma.com/webphoneWebRTCWidget/v8/js/loader-phone-lib.js?s…) has other dependencies that are called through tags.

We would like to know, how can we load these dependencies, that are inside the "loader_phone_lib" file, without getting this error?

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

Like 3

Like

4 comments

Hi Pedro,

 

According to https://requirejs.org/docs/errors.html#mismatch there should be the anonymous define() method inside the script HTML tag in one of the dependencies that are loaded. So to fix the error you need to check all the steps described in the requirejs.org document.

 

Best regards,

Oscar

Hi Oscar,

 

Thank you for the response.

 

Yes, some of the scripts have the anonymous define() method inside, so by following the documentation you provided, I removed the dependencies from the "loader_phone_lib" script and added them using the code bellow:

....
require.config({
	paths: {
		zadarmaSocket: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/socket.io",
		zadarmaDetectWebRTC: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/detectWebRTC.min",
		zadarmaJssip: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/jssip.min",
		zadarmaMd5: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/md5.min",
		zadarmaWidgetAPI: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/widget-api.min.js?sub_v=62",
		zadarmaWidget: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/widget.min.js?sub_v=62",
		loader_phone_fn: "//my.zadarma.com/webphoneWebRTCWidget/v8/js/loader-phone-fn.js?sub_v=62"
	}
});
 
define("CtiPanel", ["ServiceHelper", "zadarmaSocket", "zadarmaDetectWebRTC", "zadarmaJssip", "zadarmaMd5", "zadarmaWidgetAPI", "zadarmaWidget", "loader_phone_fn"], function(ServiceHelper) {
	return {
		messages: {},
		mixins: {},
		attributes: {},
		methods: {
			callPhoneNumber: function (){
				var number = this.get("PhoneNumber");
				window.console.log(number);
 
				var sipValue = "SIP";
 
				var payload = {
					sip: sipValue
				};
 
				ServiceHelper.callService("ImdZadarmaWebHookService", "ZadarmaWebRTCKey", function(response) {
					var result = JSON.parse(response.ZadarmaWebRTCKeyResult);
					window.console.log(result.key);
					zadarmaWidgetFn(result.key, 'SIP', 'square', 'en', true, "{left:'10px',top:'5px'}");
				}, payload, this);
			}
		},
		diff: []
	};
});

This piece of code manage to "fix" the previous error. However, I'm getting a new error, which is related to the Socket.Io (zadarmaSocket), as you can see on the next image:

I think this error is caused by the fact that one of the dependencies cannot reach specific functions/vars from other dependencies. I've tried to use the "shim" attribute, in order to create a sequence for loading the dependencies and it didn't work.

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

 

Pedro Pinheiro,

 

Hello,

 

The new code returns another error message on my side, but it happens since there is no ImdZadarmaWebHookService service and ZadarmaWebRTCKey method in my app. Can you please also share the code of this part?

 

Thank you!

 

Best regards,

Oscar

Hello Oscar Dylan,

 

The ZadarmaWebRTCKey method is responsible for requesting the WebRTC key from a specific "Client Key", "Client Secret" and SIP Number. I use this key to start the communication between the widget and Zadarma.

 

ImdZadarmaWebHookService.cs

 /* The custom namespace. */
namespace Terrasoft.Configuration.ImdZadarmaWebHookServiceNamespace
{
    using System;
    using System.ServiceModel;
    using System.ServiceModel.Web;
    using System.ServiceModel.Activation;
    using Terrasoft.Core;
    using Terrasoft.Web.Common;
    using Terrasoft.Core.Entities; 
	using System.Web;
	using System.Collections.Generic;
	using Terrasoft.Configuration.ImdZadarmaAPI;
	using System.Net.Http;
 
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class ImdZadarmaWebHookService: BaseService
    {
        [OperationContract]
       	[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
		public string ZadarmaWebRTCKey(string sip){
 
            //ZadarmaApi is a class that contains all the methods to work with Zadarma API
			var zadarma = new ZadarmaApi("KEY", "SECRET");
 
 
			SortedDictionary<string, string> parameters = new SortedDictionary<string, string>();			
			parameters.Add("sip", sip);
 
            var response = zadarma.Call("/v1/webrtc/get_key/", parameters, HttpMethod.Get);
            string str = (string) response.Content.ReadAsStringAsync().Result;
            return str;
		}
    }   
}

The code for ZadarmaApi class can be found here:

https://github.com/zadarma/user-api-cs-v1/blob/master/ZadarmaAPI/ZadarmaApi.cs

 

Best Regards,

Pedro Pinheiro

Show all comments

Hello,

 

For some technical issues, I had to reinstall database. so I exported the package "Custom" to be able to import it via application install. while trying to import it, it fails to restore configuration from backup.

How can I retrieve configuration done on this custom package? is there any best practice to export packages?

 

Thanks,

Like 0

Like

4 comments

Hello Mariam,

 

You can export the package from the Configuration section:

 

But we recommend installing the package in the Installed application section. So you will be able to download the application log to check the errors.

 

Best regards,

Bogdan

Hello Bogdan,

 

Thank you for the reply. in fact this is what I have done and then I tried to import the package from the installed application section. bellow is the screen of import failure. 

Bellow is a snippet of the errors in log file.

Error occured while performing operation on "Custom" item, UId = a00051f4-cde3-4f3f-b08e-c5ad1a5c735a.

2022-04-15 10:15:43,737 System.AggregateException: One or more errors occurred. (Error occured while saving resources for schema 'UsrServiceCatalogc9afd9b9Section' in 'Custom' package for 'pt-PT' culture) (Error occured while saving resources for schema 'UsrServiceCatalogc9afd9b9Section' in 'Custom' package for 'ro-RO' culture) (Error occured while saving resources for schema 'CaseInFolder' in 'Custom' package for 'pt-BR' culture) (Error occured while saving resources for schema 'UsrSchema6cea64dfPage' in 'Custom' package for 'it-IT' culture) (Error occured while saving resources for schema 'UsrSchema6cea64dfPage' in 'Custom' package for 'vi-VN' culture) (Error occured while saving resources for schema 'CaseInFolder' in 'Custom' package for 'he-IL' culture) (Error occured while saving resources for schema 'UsrSchema6cea64dfPage' in 'Custom' package for 'ar-SA' culture) (Error occured while saving resources for schema 'UsrSchema6cea64dfPage' in 'Custom' package for 'fr-FR' culture) (Error occured while saving resources for schema 'UsrCaseVisa' in 'Custom' package for 'en-US' culture) (Error occured while saving resources for schema 'UsrSchema6cea64dfPage' in 'Custom' package for 'cs-CZ' culture) (Error occured while saving resources for schema 'UsrRentalVehicle' in 'Custom' package for 'nl-NL' culture)

Thanks,

mariam moufaddal,

Did you ever find a solution?

The package "Custom" cannot be exported between environments. A solution would be to add a new package and add the same dependencies as in the package "Custom" and move files from Custom to the new created package. then you can export that package between environments.

Show all comments

Hello community,

 

I need to filter a detail grid in order to show only a specific type of object.

To be more precise: the detail CI Users displays Contacts and Accounts...

Has anybody done anything similar and could you provide me with a code sample?

 

Thank you in advance, have a nice day

Like 0

Like

3 comments
Best reply

If you'd like to filter out the record, rather than just hide them, you can filter the detail using a filter method. I have outlined how to do that here: https://customerfx.com/article/filtering-a-detail-list-in-creatio-forme…

Ryan

Solved like this: 

methods: {
			prepareResponseCollectionItem: function(item) {
				var account = item.$Account && item.$Account.value; 
				debugger;
				if(account){
					item.customStyle = {
						"display":"none"
					}
				}
			}
		},

 

If you'd like to filter out the record, rather than just hide them, you can filter the detail using a filter method. I have outlined how to do that here: https://customerfx.com/article/filtering-a-detail-list-in-creatio-forme…

Ryan

Thank you Ryan!

Show all comments

Hello,

 

I am willing to add the attachments detail (available in Case page) to the Case Portal Page. I have created a replacing object on the BaseCase object and tried to add the following code to my client module: 

details: /**SCHEMA_DETAILS*/{
			"Files": {
				"schemaName": "FileDetailV2",
				"entitySchemaName": "CaseFile",
				"filter": {
					"detailColumn": "Case",
					"masterColumn": "Id"
				}
			}
		}/**SCHEMA_DETAILS*/,

and then added the following code on the diff:

diff: /**SCHEMA_DIFF*/[
{
				"operation": "insert",
				"name": "NotesFilesTab",
				"values": {
					"items": [],
					"caption": {
						"bindTo": "Resources.Strings.NotesFilesTabCaption"
					},
					"order": 2
				},
				"parentName": "Tabs",
				"propertyName": "tabs",
				"index": 3
			},
			{
				"operation": "insert",
				"name": "Files",
				"values": {
					"itemType": 2
				},
				"parentName": "NotesFilesTab",
				"propertyName": "items",
				"index": 0
			},
			{
				"operation": "insert",
				"name": "NotesControlGroup",
				"values": {
					"itemType": 15,
					"items": [],
					"caption": {
						"bindTo": "Resources.Strings.NotesGroupCaption"
					}
				},
				"parentName": "NotesFilesTab",
				"propertyName": "items",
				"index": 1
			},
			{
				"operation": "insert",
				"name": "Notes",
				"values": {
					"contentType": 4,
					"layout": {
						"column": 0,
						"row": 1,
						"colSpan": 24
					},
					"labelConfig": {
						"visible": false
					},
					"controlConfig": {
						"imageLoaded": {
							"bindTo": "insertImagesToNotes"
						},
						"images": {
							"bindTo": "NotesImagesCollection"
						}
					}
				},
				"parentName": "NotesControlGroup",
				"propertyName": "items",
				"index": 0
			},
			{
				"operation": "remove",
				"name": "Header"
			}
		]/**SCHEMA_DIFF*/,

but nothing is visible on the portal Case page.

 

Can you please help ?

 

Thank you

Like 0

Like

1 comments
Best reply

Hello,

 

You should add the same code to the replaced PortalCasePage module (not to the BaseCase object) and also don't forget to add localizable strings to the module.

 

Best regards,

Oscar

Hello,

 

You should add the same code to the replaced PortalCasePage module (not to the BaseCase object) and also don't forget to add localizable strings to the module.

 

Best regards,

Oscar

Show all comments

Hi,

How can I break the connection between "Contacts" and "Accounts"?

I added the contact and account field in the "Case" section as shown below.

 

What I want is, if possible, to break the connection between these two objects. It is possible?

 

Thank you!

 

Kind regards,

Andreia

 

Thank you!

Like 0

Like

1 comments

Hello Andreia,

 

This might be connected through a business rule of your page. (in this example the case section wizard)

 

You can disable it there. 

 

 

Kind regards,

Yosef

Show all comments

Hi,

 

How can I break the connection between Contacts and Accounts? For example, I create a new contact "andreia" then choose an account that "andreia" does not belong to the contact, the contact disappears but I don't want that. I want to cut this connection, it is possible?

 

Thank you!

 

 

 

 

File attachments
Like 0

Like

6 comments

Hello Andreia,

 

Thank you for your question!

 

Could you please elaborate more on yout business task? If a contact does not belong to the account, it's normal behaviour that they are not compatible together.

 

Best regards,

Anastasiia

Hi Anatasiia,

 

What I need to do, if possible, is the following:

1. I have these two fields, ("Account" and "Contact") in the Case section

 

 

2. First fill in the "Account", then my question is, if it is possible to create a new contact, here on this page, that is not yet associated with this account, but when creating, associate the contact with this account.

 

My question is whether this is possible.

I hope you can understand!

 

Thank you.

 

Best regards,

Andreia

 

Hello Andreia,

 

Thank you for your clarification!

If I understood your question correctly - unfortunately, you are not yet able to create new contacts through the case section without summoning any other additional fields.

 

Although, you are able to create a new contact by filling out the mini page that appears after you click on "new contact" button:

After which the mini page will appear where you can add the needed account:

 

I will create a request for our R&D team so they will develop the desired functionality in future releases. 

Hope it helps! 

 

Thank you, 

Artem. 

Thank you for the help Artem,

 

Best regards,

Andreia

Hi Artem,

 

But in relation to my first question "How can I break the connection between Contacts and Accounts?" how can I do that? 

 

Thank you.

 

Kind regards,

Andreia

 

 

I would like to do this as well. We have Different Account types that we use for Vendors on Projects.   If I add an account lookup and filter by the type, the Contact gets removed when I hit Save. I need to be able to add accounts where the contact is not associated with it.  Is this possible?

Show all comments

Hi

I want to send a notification to a case owner and an escalation manager when a case has not been updated in 48 hours.

For this I found in the admin guide a reference to performing a pipeline condition (https://academy.creatio.com/docs/7-18/user/bpm_tools/business_process_setup/formulas/process_formulas) and used this to create the following condition:

 

(decimal)RoundOff(([#System variable.Current Time and Date#]-[#Read modified time.First item of resulting collection.Modified on#]).TotalHours) > 48

However, when trying to save I get the following error - Formula value error: Invalid Operator. I cannot see why this is the case, as it follows the guide exactly with just the variable values updated.

 

thanks in advance

 

Mark

 

Like 0

Like

0 comments
Show all comments

Hi Community,

 

We've this requirement where we need to change the "PlayBook" component visibility based on the "ServiceItem" lookup value.

 

 

This visibility rule must be defined following the same principle used for the "Estado (Status)", which is located on the "Playbook" detail inside "KnowledgeBasePageV2".

 

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

 

 

 

Like 0

Like

6 comments
Best reply

Hi Pedro,

 

You need to override the logic of the _updatePlaybookData method in the CaseSectionActionsDashboard and also set the value for the IsShowPlaybookButton attribute to false. To get data from the master case entity you can use the this.getMasterEntityParameterValue() method.

 

Best regards,

Oscar

Hi Pedro,

 

You need to override the logic of the _updatePlaybookData method in the CaseSectionActionsDashboard and also set the value for the IsShowPlaybookButton attribute to false. To get data from the master case entity you can use the this.getMasterEntityParameterValue() method.

 

Best regards,

Oscar

Hi Oscar,

 

Thank you for the response.

 

I've managed to solve my problem by overriding the method __getPlaybookEsq which is called by the _updatePlaybookData. I simply added the following code to the CaseSectionActionsDashboard:

 

/**
 * @private
 */
_getPlaybookEsq: function() {
	var serviceItem = this.getMasterEntityParameterValue("ServiceItem");
 
	const esq = this.Ext.create("Terrasoft.EntitySchemaQuery", {
		rootSchemaName: "VwSysDcmLib"
	});
	const caseUid = this.$DcmSchema.uId;
	const currentCultureId = Terrasoft.SysValue.CURRENT_USER_CULTURE.value;
	esq.addColumn("=[Playbook:Case:Id].KnowledgeBase", "KnowledgeBase");
	esq.filters.addItem(this.Terrasoft.createExistsFilter("=[Playbook:Case:Id].KnowledgeBase"));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "UId", caseUid));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "=[Playbook:Case:Id].StageId", this.$ActiveActionId));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "=[Playbook:Case:Id].[SysCulture:Language:Culture].Id", currentCultureId));
	esq.filters.addItem(this.Terrasoft.createColumnFilterWithParameter(this.Terrasoft.ComparisonType.EQUAL, "=[Playbook:Case:Id].UsrServiceItem", serviceItem.value));
 
	return esq;
}

 

One more thing. Is there a method that I can override or call, in order to reload the DCM automatically after changing my ServiceItem?

 

Thank you.

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

There is a reload method in the SectionActionsDashboard module, try calling it.

 

Best regards,

Oscar

Oscar Dylan,

 

I tried to call the reload method on my CasePage but its returning undefined. How/Where should I call this method?

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

You need to reload the SectionActionsDashboard not the CasePage since you need to reload the DCM (according to your question, correct me if I am wrong). And the reload method is the method of the CaseSectionActionsDashboard.

 

Best regards,

Oscar

Oscar Dylan,

 

Correct, I need to refresh the DCM of the CasePage. However, the reload should happen after I change the value of the field ServiceItem, which is located on my CasePage.

 

Best Regards,

Pedro Pinheiro

Show all comments

Hi Community,

 

I have this situation where I need to create a filter for the lookup Group (Fig. 2) based on my custom field that I've created on SysAdminUnit object (Fig.1).

 

Fig. 1

 

 

Fig. 2

 

I've managed to add the custom field to the SysAdminUnitPage (Fig.3). However, the custom field is not "connected" to the object field, because this page is different from the others and does not have entitySchemaName attribute (Fig. 4).

 

Fig.3

 

Fig.4

 

I would like to know:

  1. How can I "connect" the field that I've created on my SysAdminUnitPage to the field I've created on the SysAdminUnit object?
  2. How can I create a filter for the lookup Group inside CasePage using my custom field?

Any suggestion on how to achieve this? Thank you.

 

Best Regards,

Pedro Pinheiro

Like 0

Like

5 comments

Hi Pedro,

 

If you need to create a filter of the Group lookup on the case page then why do you replace the SysAdminUnitPageV2? And which case and account do you expect to see on the SysAdminUnitPageV2 for some role (for example for "System administrators")? Also I cannot see any filtration logic on the SysAdminUnitPageV2 module code you've shared.

 

You need to create a filter on the CasePage using an example provided here.

 

Best regards,

Oscar

Hi Oscar,

 

Thank you for the response.

 

My question consists of two parts:

 

1) I've created a replacing page of the "SysAdminUnitPageV2", so I could add my custom boolean field "Case" and the pre-built lookup field "Account". Since the "Account" field is not custom, I only added the field on my "SysAdminUnitPageV2" page through the “diff” array (image below). Every time I change and save my "Account" value, it will automatically update the value in the database for my specific record. However, the same does not happen to my custom field "Case".

I’ve created the “Case” field the same way "Account" field was created, but I think I'm missing some page logic that is responsible to store my “Case” values in the database.

 

 

2) The lookup filter that I want to add is for the "Group" lookup field inside the "CasePage". This filter should use the "Case" field, previously added to the "SysAdminUnit" object. With the example you provided I was able to complete this second part.

 

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

In the Fig.4 modify the "bindTo": "Case" to "bindTo": "UsrCase", save the schema and refresh the "role" page after that. Try saving some value and let me know about the result.

 

Best regards,

Oscar

Oscar Dylan,

 

I've made the changes, but my page cannot find the UsrCase column. I think it's because this page does not have the "entitySchemaName" attribute. But even if I try to add the "entitySchemaName" attribute the page will throw an exception.

 

 

Error Translation: "It was not possible to find the column through the following configuration."

 

 

Best Regards,

Pedro Pinheiro

Pedro Pinheiro,

 

To achieve your first result you need to:

 

1) Create a replacing object selecting the VwSysAdminUnit object as a parent

2) Create the lookup column with the "UsrCase" code and "Case" title inside the object from step 1.

3) Save and publish the object from step 1.

 

As a result here you should get this result:

4) Execute the following query in the database (please note that if you already have customizations in the VwSysAdminUnit table (new columns inside it) then the query that should be executed in your case can differ (all the columns of the already existing replacement should be mentioned in the query, study it before running)):

IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[VwSysAdminUnit]'))
DROP VIEW [dbo].[VwSysAdminUnit]
GO
CREATE VIEW [dbo].[VwSysAdminUnit]
AS
SELECT [SysAdminUnit].[Id]
	,[SysAdminUnit].[CreatedOn]
	,[SysAdminUnit].[CreatedById]
	,[SysAdminUnit].[ModifiedOn]
	,[SysAdminUnit].[ModifiedById]
	,[SysAdminUnit].[Name]
	,[SysAdminUnit].[Email]
	,[SysAdminUnit].[Description]
	,[SysAdminUnit].[ParentRoleId]
	,[SysAdminUnit].[ContactId]
	,[SysAdminUnit].[IsDirectoryEntry]
	,[TimeZone].[Id] AS [TimeZoneId]
	,[SysAdminUnit].[UserPassword]
	,[SysAdminUnitType].[Id] AS [SysAdminUnitTypeId]
	,[SysAdminUnit].[AccountId]
	,[SysAdminUnit].[Active]
	,[SysAdminUnit].[LoggedIn]
	,[SysAdminUnit].[SynchronizeWithLDAP]
	,[LDAPElement].[Name] as [LDAPEntry]
	,[LDAPElement].[LDAPEntryId]
	,[LDAPElement].[LDAPEntryDN]
	,[SysAdminUnit].[SysCultureId]
	,[SysAdminUnit].[ProcessListeners]
	,[SysAdminUnit].[PasswordExpireDate]
	,[SysAdminUnit].[HomePageId]
	,[SysAdminUnit].[ConnectionType]
	,[ConnectionType].[Id] AS [UserConnectionTypeId]
	,[SysAdminUnit].[ForceChangePassword]
	,[SysAdminUnit].[LDAPElementId]
	,[SysAdminUnit].[DateTimeFormatId]
	,[SysAdminUnit].[Id] as [SysAdminUnitId]
	,[SysAdminUnit].[SessionTimeout] as [SessionTimeout]
	,[SysAdminUnit].[UsrCaseId] as [UsrCaseId]
FROM [SysAdminUnit]
INNER JOIN [SysAdminUnitType] ON [SysAdminUnitType].[Value] = [SysAdminUnit].[SysAdminUnitTypeValue]
LEFT JOIN [ConnectionType] AS [ConnectionType] ON [ConnectionType].[Value] = [SysAdminUnit].[ConnectionType]
LEFT JOIN [TimeZone] AS [TimeZone] ON [TimeZone].[Code] = [SysAdminUnit].[TimeZoneId]
LEFT JOIN [LDAPElement] ON [LDAPElement].[Id] = [SysAdminUnit].[LDAPElementId]
GO
CREATE TRIGGER [dbo].[ITR_VwSysAdminUnit_I]
ON [dbo].[VwSysAdminUnit]
	INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO [SysAdminUnit](
	[Id]
	,[CreatedOn]
	,[CreatedById]
	,[ModifiedOn]
	,[ModifiedById]
	,[Name]
	,[Email]
	,[Description]
	,[ParentRoleId]
	,[ContactId]
	,[IsDirectoryEntry]
	,[TimeZoneId]
	,[UserPassword]
	,[SysAdminUnitTypeValue]
	,[AccountId]
	,[Active]
	,[LoggedIn]
	,[SynchronizeWithLDAP]
	,[LDAPEntry]
	,[LDAPEntryId]
	,[LDAPEntryDN]
	,[SysCultureId]
	,[ProcessListeners]
	,[PasswordExpireDate]
	,[HomePageId]
	,[ConnectionType]
	,[ForceChangePassword]
	,[LDAPElementId]
	,[DateTimeFormatId]
	,[SessionTimeout]
	,[UsrCaseId])
SELECT [Id]
	,[CreatedOn]
	,[CreatedById]
	,[ModifiedOn]
	,[ModifiedById]
	,[Name]
	,[Email]
	,[Description]
	,[ParentRoleId]
	,[ContactId]
	,[IsDirectoryEntry]
	,(SELECT COALESCE(
		(SELECT [TimeZone].[Code] FROM [TimeZone]
			WHERE [TimeZone].[Id] = [INSERTED].[TimeZoneId]), ''))
	,[UserPassword]
	,ISNULL((SELECT [SysAdminUnitType].[Value] FROM [SysAdminUnitType]
		WHERE [SysAdminUnitType].[Id] = [INSERTED].[SysAdminUnitTypeId]), 4)
	,[AccountId]
	,[Active]
	,ISNULL([LoggedIn], 0)
	,[SynchronizeWithLDAP]
	,(SELECT COALESCE(
		(SELECT [LDAPElement].[Name] FROM [LDAPElement]
			WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId]), ''))
	,(SELECT COALESCE(
		(SELECT [LDAPElement].[LDAPEntryId] FROM [LDAPElement]
			WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId]), ''))
	,(SELECT COALESCE(
		(SELECT [LDAPElement].[LDAPEntryDN] FROM [LDAPElement]
			WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId]), ''))
	,[SysCultureId]
	,[ProcessListeners]
	,[PasswordExpireDate]
	,[HomePageId]
	,COALESCE([INSERTED].[ConnectionType],
		(SELECT [ConnectionType].[Value] FROM [ConnectionType]
		WHERE [ConnectionType].[Id] = [INSERTED].[UserConnectionTypeId]), 0)
	,ISNULL([ForceChangePassword], 0)
	,[LDAPElementId]
	,[DateTimeFormatId]
	,[SessionTimeout]
	,[UsrCaseId]
FROM [INSERTED]
END
GO
CREATE TRIGGER [dbo].[ITR_VwSysAdminUnit_U]
ON [dbo].[VwSysAdminUnit]
	INSTEAD OF UPDATE
AS
BEGIN
SET NOCOUNT ON;
UPDATE [SysAdminUnit]
SET [SysAdminUnit].[CreatedOn] = [INSERTED].[CreatedOn]
	,[SysAdminUnit].[CreatedById] = [INSERTED].[CreatedById]
	,[SysAdminUnit].[ModifiedOn] =[INSERTED].[ModifiedOn]
	,[SysAdminUnit].[ModifiedById] = [INSERTED].[ModifiedById]
	,[SysAdminUnit].[Name] = [INSERTED].[Name]
	,[SysAdminUnit].[Email] = [INSERTED].[Email]
	,[SysAdminUnit].[Description] = [INSERTED].[Description]
	,[SysAdminUnit].[ParentRoleId] = [INSERTED].[ParentRoleId]
	,[SysAdminUnit].[ContactId] = [INSERTED].[ContactId]
	,[SysAdminUnit].[IsDirectoryEntry] = [INSERTED].[IsDirectoryEntry]
	,[SysAdminUnit].[TimeZoneId] =
		(SELECT COALESCE(
			(SELECT [TimeZone].[Code] FROM [TimeZone]
				WHERE [TimeZone].[Id] = [INSERTED].[TimeZoneId]), ''))
	,[SysAdminUnit].[UserPassword] = [INSERTED].[UserPassword]
	,[SysAdminUnit].[SysAdminUnitTypeValue] =
		(SELECT [SysAdminUnitType].[Value] FROM [SysAdminUnitType]
			WHERE [SysAdminUnitType].[Id] = [INSERTED].[SysAdminUnitTypeId])
	,[SysAdminUnit].[AccountId] = [INSERTED].[AccountId]
	,[SysAdminUnit].[Active] = [INSERTED].[Active]
	,[SysAdminUnit].[LoggedIn] = [INSERTED].[LoggedIn]
	,[SysAdminUnit].[SynchronizeWithLDAP] = [INSERTED].[SynchronizeWithLDAP]
	,[SysAdminUnit].[LDAPEntry] =
		CASE
			WHEN (UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 1 AND [INSERTED].[LDAPElementId] is not null)
					OR (UPDATE(LDAPElementId) AND [INSERTED].[LDAPElementId] is not null)
				THEN (SELECT [LDAPElement].[Name] FROM [LDAPElement] WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId])
			WHEN UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 0
				THEN ''
			ELSE [SysAdminUnit].[LDAPEntry]
		END
	,[SysAdminUnit].[LDAPEntryId] = 
		CASE
			WHEN (UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 1 AND [INSERTED].[LDAPElementId] is not null)
					OR (UPDATE(LDAPElementId) AND [INSERTED].[LDAPElementId] is not null)
				THEN (SELECT [LDAPElement].[LDAPEntryId] FROM [LDAPElement] WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId])
			WHEN UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 0
				THEN ''
			ELSE [SysAdminUnit].[LDAPEntryId]
		END
	,[SysAdminUnit].[LDAPEntryDN] = 
		CASE
			WHEN (UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 1 AND [INSERTED].[LDAPElementId] is not null)
					OR (UPDATE(LDAPElementId) AND [INSERTED].[LDAPElementId] is not null)
				THEN (SELECT [LDAPElement].[LDAPEntryDN] FROM [LDAPElement] WHERE [LDAPElement].[Id] = [INSERTED].[LDAPElementId])
			WHEN UPDATE(SynchronizeWithLDAP) AND [INSERTED].[SynchronizeWithLDAP] = 0
				THEN ''
			ELSE [SysAdminUnit].[LDAPEntryDN]
		END
	,[SysAdminUnit].[SysCultureId] = [INSERTED].[SysCultureId]
	,[SysAdminUnit].[ProcessListeners] = [INSERTED].[ProcessListeners]
	,[SysAdminUnit].[PasswordExpireDate] = [INSERTED].[PasswordExpireDate]
	,[SysAdminUnit].[HomePageId] = [INSERTED].[HomePageId]
	,[SysAdminUnit].[ConnectionType] = COALESCE([INSERTED].[ConnectionType],
		(SELECT [ConnectionType].[Value] FROM [ConnectionType]
		WHERE [ConnectionType].[Id] = [INSERTED].[UserConnectionTypeId]), 0)
	,[SysAdminUnit].[ForceChangePassword] = [INSERTED].[ForceChangePassword]
	,[SysAdminUnit].[LDAPElementId] = [INSERTED].[LDAPElementId]
	,[SysAdminUnit].[DateTimeFormatId] = [INSERTED].[DateTimeFormatId]
	,[SysAdminUnit].[SessionTimeout] = [INSERTED].[SessionTimeout]
	,[SysAdminUnit].[UsrCaseId] = [INSERTED].[UsrCaseId]
FROM [SysAdminUnit]
INNER JOIN [INSERTED] ON [SysAdminUnit].[Id] = [INSERTED].[Id]
END
GO
CREATE TRIGGER [dbo].[ITR_VwSysAdminUnit_D]
ON [dbo].[VwSysAdminUnit]
	INSTEAD OF DELETE
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM [SysAdminUnit]
WHERE EXISTS(SELECT * FROM [DELETED] WHERE [SysAdminUnit].[Id] = [DELETED].[Id])
END
GO

This query is for MS SQL, if your application is hosted using the PostgreSQL database then your query should be written using PostgreSQL syntax (you can copy the OOB VwSysAdminUnitPostgreSql SQL-script from the LDAP package, add your custom columns inside the ready script and execute it after that).

 

5) In the replaced SysAdminUnitPageV2 module add the following code to the diff array of the module:

{
					"operation": "insert",
					"parentName": "Header",
					"propertyName": "items",
					"name": "UsrCase",
					"values": {
						"bindTo": "UsrCase",
						"dataValueType": this.Terrasoft.DataValueType.LOOKUP,
						"layout": {
							"column": 0,
							"row": 1,
							"colSpan": 24
						}
					},
				}

6) Add the entitySchemaName: "VwSysAdminUnit", part to the replaced SysAdminUnitPageV2 module (below you can find an example of the correctly replaced module):

define("SysAdminUnitPageV2", [],
	function() {
		return {
			entitySchemaName: "VwSysAdminUnit",
			details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
			diff: /**SCHEMA_DIFF*/[
				{
					"operation": "insert",
					"parentName": "Header",
					"propertyName": "items",
					"name": "UsrCase",
					"values": {
						"bindTo": "UsrCase",
						"dataValueType": this.Terrasoft.DataValueType.LOOKUP,
						"layout": {
							"column": 0,
							"row": 1,
							"colSpan": 24
						}
					},
				}
			]/**SCHEMA_DIFF*/,
			attributes: {},
			methods: {}
		};
});

7) Save the module and refresh the page

 

As a result you will get a working lookup that references the "Case" object:

and

PS: also please share code itself, but not its screenshots, sometimes copying some ready code can save the time:)

 

Best regards,

Oscar

Show all comments