Forum Discussion
Hi @mmussitsch,
Problem I think was in this part
I don’t think that it can be mapped though multiple elements with only one set of square brackets.
Each square bracket is for only one element. I am not sure 100% about this but I think this was the problem.
I’ve changed the functions inside expression file a little bit.
Replaced projectPath with two other functions: getProjectSpace and getProject.
"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]
Here is the Accounts object.
"Accounts": {
"projectSpace": {
"projectName": {
"Salesforce": {
"Dev": {
"account_name": "Salesforce CIDEV"
}
}
}
}
}
And here is the output.
Hope this will help you 🙂
Regards,
Viktor
Thanks so much Viktor for the help. You’ve helped me simplify some things and build upon them. I now have a pretty comprehensive file. In addition to the other functions, I have new ones like getProjectSpace, getProject, findProject, findProjectSpace, findAreabyProject, findAreabyProjectSpace so that if an item doesn’t have a “Project” definition it will default to the Project Space definition. They all work together in one call pullObject(“Salesforce”). It’s working very well.
One quick question, your code snippet, what editor/file format is that with all the colors. Sure is nicer to read than an unknown .expr file via Notepad++.
Thanks!
Melissa
- dmiller4 years agoFormer Employee
@mmussitsch Viktor is using the code format option on this site (</> from the toolbar above the text box.)
- mmussitsch4 years agoNew Contributor II
Oh okay @dmiller - thank you! Do wish Notepad++ had these helpers. But good to know next time I post code.
- tlikarish4 years agoEmployee
The expression library should be fairly compatible with JavaScript syntax, so you could apply that syntax and formatting in Notepad++ (or other editors) for a decent way to grok the expression library.