06-02-2022 10:15 AM
Hi,
Below is a sample expression file is shown in another thread and I want to understand what exactly the functions are doing and their purpose. I also want to understand how the expression works to read the file values.
File contents -
“Accounts”: {
“projectSpace”: {
“projectName”: {
“Salesforce”: {
“Dev”: {
“account_name”: “Salesforce CIDEV”
},
“PRD”: {
“account_name”: “Salesforce CIDPRD”
}
}
}
}
}
"getOrgName": pipe.plexPath.split("/")[1],
"getProjectSpace": x => x.split('/')[2],
"getProject": x => x.split("/")[3],
"whereAmI": this.getOrgName.toLowerCase().contains("prod") ? "Prod" : (this.getOrgName.toLowerCase().contains("test") ? "Test" : "Dev"),
"getAccount": (path,type) => this.Accounts[this.getProjectSpace(path)][this.getProject(path)][type][this.whereAmI]
Expression - (How it works)
lib.expr_lib.getAccount(pipe.projectPath,“Salesforce”)
06-02-2022 10:20 AM
Looks like this comes from a post @viktor_n made in the thread (Expression Library) Pull Account based on Parsed Path call, correct?
06-02-2022 10:21 AM
Yes, Can you help me understand?
06-02-2022 10:48 AM
Let me look over the initial use case for the specifics, but general information on how to add and call an expression library can be found here: https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438110/Expression+Libraries
06-02-2022 11:52 AM
The documentation does not talk about it. I already searched for it.