base package
Replacing Cliente Module
client code
disable
8.0

Hello fellow creators! I have problems with extending BaseSectionV2 schema. I want to disable View button , so I  created a replacing module of BaseSectionV2 and wrote some code, but it's not working. Any advice would be much appreciated

 define("BaseSectionV2",[],function(){
	 return {
		 entitySchemaName:"Base",
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
				{
					"operation": "merge",
					"name": "AnalyticsModeViewOptionsButton",
					"parentName": "AnalyticsModeActionButtonsRightContainer",
					"propertyName": "items",
					"values": {
						"itemType": Terrasoft.ViewItemType.BUTTON,
						"caption": { "bindTo": "Resources.Strings.ViewOptionsButtonCaption"},
						"enabled": { "bindTo": "checkIsAdmin"},
					 }
				}
 
		 ]/**SCHEMA_DIFF*/
	 };
  });
File attachments
Like 0

Like

2 comments
Best reply

Hi,

You need to override shema BaseDataView and modify the button SeparateModeViewOptionsButton:

  define("BaseDataView",[],function(){
	 return {
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
			 {
				"operation": "merge",
				"name": "SeparateModeViewOptionsButton",
				"values": {
					"enabled": { "bindTo": "checkIsAdmin"}
				}
			}
		 ]/**SCHEMA_DIFF*/
	 };
  });

 

Hi,

You need to override shema BaseDataView and modify the button SeparateModeViewOptionsButton:

  define("BaseDataView",[],function(){
	 return {
		 details:/**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		 attributes:{},
		 methods:{
			 checkIsAdmin:function() {
				 var user = Terrasoft.SysValue.CURRENT_USER;
				 var name = user.displayValue;
				 if(name==='Supervisor')
					 return true;			 
				 		return false;
			 }
		 },
		 diff:/**SCHEMA_DIFF*/[
			 {
				"operation": "merge",
				"name": "SeparateModeViewOptionsButton",
				"values": {
					"enabled": { "bindTo": "checkIsAdmin"}
				}
			}
		 ]/**SCHEMA_DIFF*/
	 };
  });

 

Dmytro Vovchenko,

Thanks a lot! It worked!

Show all comments
Client-side
Replacing Cliente Module
tags
7.12
studio

I would like to get rid of tag button on all my pages. Is it possible to use replacing client modules to remove TagUtilitiesV2 from the list of dependencies of BasePageV2? Or maybe there's a better way to do that?

Like 0

Like

2 comments

You can write something like the code below in the BaseModulePageV2 and in the BaseSectionV2

define("AccountSectionV2", [], function() {
	return {
		entitySchemaName: "Account",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		attributes: {
			"UseTagModule": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN,
				value: false
			}
		},
		methods: {},
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
	};
});

 

Thank you very much.

Show all comments

Hi,

I need to know what is the logic to know exactly what code we must introduce in a Custom Module created using "Replacing Cliente Module", in our case the only stuff we need to do is to change some LocalizableStrings.

We experience problems copying the full code of the parent Object, but doesn't works always, the article in https://academy.bpmonline.com/documents/technic-sdk/7-8/how-create-page-or-section-replacing-page isn't clear on this point.

We are working with bpmonline vs 7.6.0.938.

Thanks in advance

File attachments

Like

9 comments

Dear Julio,

 

Even though you need to alter only some of the localizable strings, you need to copy the full code to the replacing module. 

In case you face any difficulties, feel free to contact our support team at support@bpmonline.com and provide us with the custom code debugging, so we could assist with the specific issues.

Lisa

Thanks Lisa, the module I'm trying to do this is EmailItemSchema, but when I did it, all the content of the right panel related to email, dissapears, please indicate us if this is thje module I must to work on it, or another and what sourco code must we introduce,

Thanks in advance

Hi Julio,

If you choose the parent object, all the content should appear on the right panel as in the screenshot below:

Regards,

Lily

 

Thanks Lily, this is not my problem, the problem is when I save, refresh and run the app, all the mail content in the right panel dissapears.

Hi Julio,

Probably you copied the code from base EmailItemSchema (in UIv2 package). 

You need to copy the code from the schema based in the last package in hierarchy. Or better to leave only schema frame (see example below). 

If you still face difficulies, please contact support@bpmonline.com specifying instance and test credentials.

define("EmailItemSchema", ["BusinessRuleModule", "EmailConstants"], function(BusinessRuleModule, EmailConstants) {
    return {
        entitySchemaName: EmailConstants.entitySchemaName,
        methods: {},
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
        rules: { }
    };
});

Best regards,

Diana Adams

Thanks Diana, it works!

How we must determine/identify "the schema based in the last package in hierarchy"?

Thanks again!

Hi Julio,

The Diana meant the last matching schema from the last package in the package hierarchy. 

So, for example, if you have 2 'LeadPageV2' schemas in the 'Lead' and 'Custom' packages, copy the code from the one in 'Custom'.

Thanks Adam, then in our case if we are looking for wich code to put on the replacing module to EmailItemSchema, and looking for the packages / modules with this name I get only one: EmailItemSchema, inspecting the last package in the hierarchy (always shows the same?) I didn't saw any special in the hierarchy, I think it an static image, or not?, how can we interpret it?

In the case of EmailItemSchema, from where we get the code given by Diana?

Thanks in advance

Dear Julio,

As Diana mentioned in her comment, she provided the examplary schema frame. This is how just an empty shcema would look like.

Package Dependencies is not a static image. The same schema can exist in multiple packages. As you know, they are all being combined from top to bottom on the client's side. That's why you are overriding base methods in the Custom package, as it is loaded last. Diana advised you copying the code from the schema in the lowest package as the schemas in the core packages (top ones) contain a lot more code as the inheriting ones.

Show all comments