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.
Functions in this particular expressions file all together are used to map to particular “account_name” depending in which projectSpace, project and environment you are.
pipe.plexPath - Returns path of the snaplex which is executing the process.
pipe.projectPath - Returns path of the project that is executing at the time.
Expressions file functions:
getOrgName - Returns the name of the organization. It is splitting the path from plexPath by “/” and selects the second element(index of 1). This also can be get from pipe.projectPath function.
getProjectSpace - Returns the name of the projectSpace. Selects the projectSpace on the same way as the organization is selected. Difference is that the pipe.projectPath is not hardcoded in the expressions file as the pipe.plexPath is, but is passed as parameter.
getProject - Returns the project name. Works exactly the same as for the projectSpace but is selected different element.
whereAmI - This returns the environment.
this keyword is used when you referring to some element that is on the same scope, as the function that you use, and you need to access. As it is in the expression file, from whereAmI is called getOrgName function.
getOrgName will return the organization name and it will check if the organization have “prod” then will return “Prod”, otherwise will check for ‘test’ and at the end if there is not prod and test inside organization will return ‘Dev’.
Keep in mind that returned value from this function needs to be the same as the environment element inside Accounts object.
5.getAccount - This function maps through the Accounts object with help from the functions above.
Accepts two parameters:
First one is the projectPath that getProjectSpace and getProject are using.
Second is string that will be used for the mapping to the correct object beside the values from the functions.
So, this is what will look like after the above functions are called: this.Accounts['projectSpace']['projectName']['Salesforce']['PRD']
And will return that what will find on that location, if finds anything. If we get Accounts from the sample above will return this account number.