Salesforce

Triggering JavaScript Code from Magic xpa on Changing Custom Properties (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

Triggering JavaScript Code from Magic xpa on Changing Custom Properties

Magic xpa enables you to trigger JS code at Client-side when Custom Properties property is changed. You need to use the following method to accomplish the same:

PropertyChanged

The purpose of this method is to allow you to implement JS code on the Client-side once a Custom Property (in the given form) value is changing.

This method is triggered for each Custom Property that has changed with the co-related parameters being send to the method.

This method needs to be added to the component controller file (the .ts file).

Syntax:

PropertyChanged(propertyName: string, rowId: number, value: any): void {switchLogic}

Parameters:

propertyName: Name of Custom Property that was changed.

The format is <controlname>~<propertyname>

rowId: The row number of the updated property for controls in Table control (0 for the controls outside Table).

value: The new value of the Custom Property

Returns:

void

SwithLogic: here you need to add a condition on what need to be done based on the propertyName parameters.

if (propertyName == '<controlname>~<propertyname>')

<execute JS code>;

else if (propertyName == '<controlname>~<propertyname>')

<execute JS code>;

Code sample

PropertyChanged(propertyName: string, rowID: number, propertyValue: any): void{

if (propertyName == this.mgcp.<customer Property name>)

<execute JS code>;

else if (propertyName == this.mgcp.<customer Property name>)

<execute JS code>;

}

Since version: 4.7

Reference
Attachment 
Attachment