cancel
Showing results for 
Search instead for 
Did you mean: 

Expression File Functions and Read Expression

amit_saroha
New Contributor III

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”)

6 REPLIES 6

dmiller
Admin Admin
Admin

Looks like this comes from a post @viktor_n made in the thread (Expression Library) Pull Account based on Parsed Path call, correct?


Diane Miller
Community Manager

amit_saroha
New Contributor III

Yes, Can you help me understand?

dmiller
Admin Admin
Admin

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


Diane Miller
Community Manager

amit_saroha
New Contributor III

The documentation does not talk about it. I already searched for it.