E9.2 Environment Specific Values

jolly

VIP Member
Hi all,

Sometimes you have values which are environment specific. A common example is a connection object. You can create several with the same name but different environment, and at runtime the system will use the one for the current environment. So you can create same-named SFTP connections for test and production SFTP servers.

My question is: how would you create email addresses (and subjects) for a particular function, for specific environments? Say you have a Message service request and in DV you want that to email to the developer, but in PD you want it to email to a customer? Similarly in DV you might want the text "TEST: " prepended to the subject, but nothing in PD.

I envisage this could be done with a Soft Coding record and a Cross Reference service request. It would need to have an Environment attribute like Connections do and be selected automatically at runtime by Environment.

But that's as far as I have got with this. Any suggestions?

Thanks
JohnO
 

jileto

Well Known Member
Our client maintains a BSSV server instance. This is what we did... We created a NER BSFN that will execute Java code that will:
  1. Accept a SoftcodingKey (WSTPNAME) and a NodeText (BTNTEXT) as inputs.
  2. Use the SoftcodingKey to retrieve the Softcoding record appropriate for the logged in user and environment using SoftCodingRecordAccess.getSoftCodingRecord.
  3. Extract from the retrieved Softcoding record the NodeValue (BTNVALUE) corresponding to NodeText using SoftCodingRecordAccess.getSoftcodingRecordFieldvalue.
  4. Return the NodeValue to the caller.
If there's a way to do this without relying on the SoftCodingRecordAccess class, please post the alternative.

Thanks
 

craig_welton

Legendary Poster
Hi all,

Sometimes you have values which are environment specific. A common example is a connection object. You can create several with the same name but different environment, and at runtime the system will use the one for the current environment. So you can create same-named SFTP connections for test and production SFTP servers.

My question is: how would you create email addresses (and subjects) for a particular function, for specific environments? Say you have a Message service request and in DV you want that to email to the developer, but in PD you want it to email to a customer? Similarly in DV you might want the text "TEST: " prepended to the subject, but nothing in PD.

I envisage this could be done with a Soft Coding record and a Cross Reference service request. It would need to have an Environment attribute like Connections do and be selected automatically at runtime by Environment.

But that's as far as I have got with this. Any suggestions?

Thanks
JohnO
Maybe a little overly simple, but we have used a UDC that maps the ENV or PathCode to a Prod or Test description. Have the email function check the UDC and prefix the message subject if it's not Prod or whatever.

Craig
 

jolly

VIP Member
Maybe a little overly simple, but we have used a UDC that maps the ENV or PathCode to a Prod or Test description. Have the email function check the UDC and prefix the message subject if it's not Prod or whatever.

Craig
Makes sense...

I really do wonder what Cross Reference as a service request offers over a simple Data Request or X0005 custom request?
 

Stank1964

Active Member
Makes sense...

I really do wonder what Cross Reference as a service request offers over a simple Data Request or X0005 custom request?
I created a simple table that includes a set of key fields one of which is the environment. I have a field for the value itself, description etc as well. When I need a value in whatever app it is, a BSFN is called which pulls the value from the table including the key fields and the execution environment. Done.
 

Harry Chen

Active Member
One option is to create a custom Named Event Rule business function. You just need a few lines of event rules. For example your current environment (system value) is JPD920 or JPY920, or JDV920. If you get the sub-string of SUBSTRING("JPD920", 1, 2) (The starting is 0), then you get 'PD'. if it is not 'PD' then it is testing environment. You can return 0-means production environment. 1- means testing environment.
Then you can call this business function in your JDE program or Orchestration.
Also you can use 2 processing options to store the values you like to use for testing or PROD environment.
Hope it helps!
 

JohnDanter2

Well Known Member
Whenever I do this I go and ask what the ENV is in the code itself, a NER or UBE etc (SL LoginEnvironment = PD920 do prod stuff, else do non prod stuff)

If it's not PD920 I add the ENV to the subject. If it is PD920, I don't.

You could also change the values in F01151 (I have used GEN1 in the past to tell the system it's PROD)
 
Top