Hi,

I want to run a web service on combobox changed event.

What is the syntax of register the handler in the client module file? 

(What do I need to write in viewConfigDiff --> values to execute the handler on the change event?)

 

Thanks,

Smadar

Like 0

Like

2 comments
Best reply

You can see how to respond to the change event here: https://customerfx.com/article/responding-to-an-event-when-a-field-is-c…

Also, for calling the web service see here https://customerfx.com/article/calling-configuration-web-services-from-…

Ryan

You can see how to respond to the change event here: https://customerfx.com/article/responding-to-an-event-when-a-field-is-c…

Also, for calling the web service see here https://customerfx.com/article/calling-configuration-web-services-from-…

Ryan

Thanks! It solved my problem :)

Show all comments

Hi, I've got a page holding two new checkboxes. If the first checkbox (let's say "A") is marked, the second (let's call it "B") has to be unmarked and the other way around. I set the condition in the rules tab, in the page wizard, and each time I clicked on one of the boxes, the second became unavailable as it was projected. However, clicking on the labels of those boxes allowed for marking both of them! I thought I made a mistake and removed the condition.

Having known that both checkboxes are defined in diff array, I declared two schema attributes controlling if they are enabled/disabled. I also glued to the definition of checkboxes event-handlers in this way that each checkbox has its own click event-handler. Event handlers are defined in the section for methods.

Each event handler is responsible for controlling the state of the second checkbox if the first is marked/unmarked. And this time, it also works like a charm, but only when I click on checkboxes. Again when I click on labels of checkboxes, it's possible to mark both checkboxes at the same time. Moreover, it's impossible to handle click-events from these labels.

If it were "normal" js or ts I would handle that easily. Here, I'm running out of ideas. Could you advise me on how to achieve control on those labels, as well (to be precise, I need to have responsive labels to improve user experience)? What I've done wrong so far?

Like 0

Like

1 comments

Dear Duffy,

 

Thank you for submitting your question!

 

Could you please elaborate more on your question and possibly provide some screenshots?

 

Thank you!

 

Regards,

 

Danyil

Show all comments



Dear Community,

 

I am trying to copy values from a field and lookups to put it in the "Name" fields before saving.

I use the following code in the script task but I don't know how to get the value from a lookup:

Entity.Name = $"{Entity.Code } - {Entity.Description}";

Code being the lookup.



So if you create a record in a lookup it would go like this:

[Name][Code][Description]

[           ][ 001 ][Code for info]



The Name should automatically be filled with "001 - Code for info" after saving.

What is the correct way to set the script?

Thank you!

 

 

Kind regards,

Yosef

 

Like 0

Like

2 comments

Hi!

 

Just add on saving event in your lookup entity, and add a script

 

Entity.SetColumnValue("Name", string.Format("[{0}][{1}]", Entity.GetTypedColumnValue<string>("Code"), Entity.GetTypedColumnValue<string>("Descritpion"));

 

Dmytro Oliinyk,

 

 

Thank you but that didn't seem to work for me, this was the solution for me:

 

var name = Entity.GetColumnValue("Name");
var description = Entity.GetColumnValue("Description");
 
var esq = new EntitySchemaQuery(Entity.Schema);
esq.AddColumn("Code.Name");
 
var CodeEntity= esq. GetEntity(UserConnection, Entity.PrimaryColumnValue);
if (CodeEntity != null) {
 
	var columnUsrCodeName = CodeEntity .GetTypedColumnValue<string>("Code_Name");
 
	string fullName= $"{name}: {columnUsrCodeName } - {description}";
	Entity.SetColumnValue("Name", fullName);
}
return true;

Let me know if there's an easier way to do this.

 

 

Kind regards,

Yosef

Show all comments

Hi,

I would like to know how can i trigger 'someMethod' by adding, editing or removing something in my detail.

 

Like 1

Like

4 comments

Dear Pedro,

Please find the options to trigger your custom method:

adding:

you can override the addRecord method of BaseGridDetailV2 to launch your custom method along with parent realization.

editing:

You can create a new attribute on the page schema, which will trigger method "methodName" based on the changes in indicated columns:

"Probability": {
    // Determination of the column dependency.
    "dependencies": [
      {
        // Depends on the "Stage" column.
        "columns": [ "Stage" ],
        // The name of the handler method for the "Stage" column change.
        // setProbabilityByStage() method is defined  in methods property
        // of schema object.
        "methodName": "setProbabilityByStage"
      }
    ]
  }

delete:

you can override the basic deleteRecords method on the detail schema, so to run your custom method after, or before parent realization of the method.

Regards,

Anastasia

Anastasia Botezat,

 Hi,

I've tried to override "deleteRecords" method on my detail schema page, and didn't work, I think its because of package dependencies but I'm not sure.

Pedro Pinheiro,

The "deleteRecords" method does work on the detail schema. Please debug the code, so to narrow down the possible cause. Here is an instruction on the client side debug:

https://academy.bpmonline.com/documents/technic-sdk/7-13/client-code-debugging

Regards,

Anastasia

Anastasia Botezat, I manage to fix my problem using "onDelete" instead of the "deleteRecords" method.

Thanks for your response.

Show all comments

I have an requirement to change city lookup whenever zip code is changed so is there any event that will do my work?

Thanks

Like 0

Like

2 comments

If you have a ZIP code field or similar in City to filter it by, you can set up a business rule similar to this, with your field in place of Description:

If you require more complex logic, go to the edit page in the backend and add a dependency to the attributes section:

attributes: {
    "City": {
	dependencies: [
	    {
		columns: ["Zip"],
		methodName: "doSomething"
	    }
	]
    }
}

And include your logic in the doSomething method, which will be called every time Zip is changed.

Dear Agha,

Please check the example provided by Darian. For the simple business task it is recommended to use business rules. 

In case you need more complex logic, including if clause, or evaluation on Id, or any other logic, which cannot be implemented by business rules, please use attributes.

In order to add an attribute you need to go to Advanced settings --> create a new replacing module for your page --> add an attribute and save the schema --> clear browser cache. 

Please see articles on schema attributes:

https://academy.bpmonline.com/documents/technic-sdk/7-13/attributes-attributes-property

Regards,

Anastasia

Show all comments

I have  string text field, I want to pop up look up upon hitting [enter] or [tab] keys

Like 0

Like

1 comments

It will be hard to catch the [tab] click event. The problem is that the [tab] key is reserved for changing an active element in a browser.

The [Enter] key will be easy to catch. I would do the following:

define("ContactPageV2", [], function() {
	return {
		entitySchemaName: "Contact",
		attributes: {},
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		methods: {
			onEntityInitialized: function() {
				this.callParent(arguments);
			},
			onPhoneClick: function(e) {
				if (e && e.keyCode === 13) {
					console.log("show popup");
				}
			}
		},
		dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "merge",
				"name": "AccountPhone",
				"values": {
					"layout": {
						"colSpan": 24,
						"rowSpan": 1,
						"column": 0,
						"row": 4
					},
					"keyup": {
						"bindTo": "onPhoneClick"
					}
				}
			}
		]/**SCHEMA_DIFF*/
	};
});

 

Show all comments