cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

globals variable in a rule MDK

former_member675984
Participant
0 Kudos
721

HI, Experts

How can I use a variable from the /globals directory in an MDK rule?

Accepted Solutions (1)

Accepted Solutions (1)

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

juanforero98

You can use Client API getGlobalDefinition to access a global variable.

Example:

export default function GetValueFromGlobalVariable(context) {
    let appVersion = context.getGlobalDefinition('/MDKTest/Globals/AppDefinition_Version.global');
    if (appVersion.getType() == 'string') {
        alert(appVersion.getValue());
    }
    //do something
}

Answers (0)