Person variables
perform as filters inside varieties, permitting customers to slim their focus to
particular members, like a division. Previous to linking a consumer variable to a
type, it is advisable to set up the consumer variable. When designing varieties with consumer
variables, customers are required to initially designate values in preferences for
the variable previous to accessing the varieties. Subsequently, customers can modify the
variable throughout the type provided that it is dynamic. If not, they have to persist in
setting the variable in preferences. For example, if a consumer variable named
“Price Middle” is created, customers should designate a Price Middle earlier than
partaking with the shape.
When customers work together with a type for
the primary time, they set their most well-liked variable, corresponding to a division or
division, of their preferences. This preliminary choice is essential because it helps
customise their form-viewing expertise.
After the preliminary setup, customers have
the pliability to replace this variable. They will both return to their
preferences and make modifications there, or they will straight alter the variable
throughout the type itself. This flexibility permits customers to adapt their type
interactions based mostly on altering wants or contexts while not having to navigate
away from the shape.
Total, this method ensures that
customers have management over their viewing preferences and might tailor their
expertise to swimsuit their particular person necessities.
On this weblog lets see the right way to set the
Person Variables for the primary time utilizing a Groovy Enterprise rule, so the customers
haven’t got set them manually and might change it latter as per their want or
requirement.
This rule will assist to avoid wasting lot of
time and let the top customers to make use of the appliance with none hurdle.
The Full Code:
This
code units the consumer variable for all of the customers
/*——————————————————————————-*/
/*
Set Person Variable for all of the Customers */
/*——————————————————————————-*/
//
Get the username for the logged-in consumer
String
userName = operation.consumer.getName();
println
“Updating the Person Variables for the consumer : ” + userName
/*
Set consumer variables for all of the customers */
//
Outline consumer variable mappings for various customers
Map
userVarMap = [
1: [username:’default’,
‘CC’:’Total Cost Centres’,
‘Account-Account’:’Net Income’,
‘Scenario-CompareScenario’:’Forecast’,
‘Version-CompareVersion’:’Final’,
‘Years-CompareYear’:’FY25′,
‘Currency-Currency’:’USD’,
‘Entity-Entity’:’No ENTITY’,
‘Years-ForecastYear’:’FY25′,
‘Period-Period’:’Dec’,
‘Entity-Review Entity’:’No ENTITY’,
‘Scenario-Scenario’:’Actual’,
‘Version-Version’:’Working’,
‘Years-Years’:’FY24′,
‘Intercompany’:’Total
Intercompany’],
This
code units the consumer variable for the desired the consumer
// Set consumer variables for a particular consumer
2:
[username:’testuser@testdomain.com’,
‘Years-Years’:’FY26′]
]
//
Discover the consumer variable string for the logged-in consumer
String
userVarString = userVarMap.discover { it.worth.username == userName }?.worth
if
(userVarString == null) {
// Use default entry if user-specific entry
not discovered
userVarString = userVarMap.discover {
it.worth.username == ‘default’ }?.worth
}
println
“Person Variables for $userVarString”
//
Convert consumer variable string entry again to Map object kind
Map
userMap = [:]
userMap
+= userVarString.replaceAll(‘\’, ”).cut up(‘,’).collectEntries { entry
->
def pair = entry.cut up(‘=’)
[(pair.first().trim()): pair.last().trim()]
}
//
Set consumer variables for the appliance
for
(i in userMap) {
// Skip ‘username’ entry
if(i.key == ‘username’)
proceed
// Extract dimension and consumer variable
data
String mapKey = i.key.toString()
def dimPair = mapKey.cut up(‘-‘)
def dimName = dimPair.first().trim()
def userVar = dimPair.final().trim()
String userVarValue = i.worth.toString()
// Get dimension, consumer variable, and member
objects
Dimension appDim =
operation.software.getDimension(dimName)
UserVariable appUserVar =
operation.software.getUserVariable(userVar)
Member appUserVarMember =
appDim.getMember(userVarValue)
// Set consumer variable worth and print standing
String standing =
operation.software.setUserVariableValue(appUserVar,appUserVarMember)
println “Person Variable set as
Dimension: $dimName, Person Variable: $userVar, Person Variable Worth: $userVarValue”
}
Person Variables earlier than working the rule
Case 1: Operating the rule for the particular Person to replace solely a particular Person variable.
Job Particulars
Person Variables after working the rule
Case 2: Operating the rule for the all of the Customers for updating all the desired Person Variables.
Job Particulars
Person Variables after working the rule.
Hope this Helps, Joyful days on the Cloud!!!