on 2018 Jun 11 10:48 AM
Hello Everyone ,
I want to access the value mapping in my Integration Flow.
Currently , In my graphical mapping, I have tried accessing value mapping using the standard Value Mapping function . But I want to access the value mapping using groovy script - no graphical mapping used. Whole mapping is written in groovy script only . But I am not able to access the value mapping in this scenario. Can you please help me out here?
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Hi Anita
Yes, it's possible to access value mappings from a Groovy script. Here's how to do it:
def valueMapApi = ITApiFactory.getApi(ValueMappingApi.class, null)
def value = valueMapApi.getMappedValue('source-agency', 'source-identifier', 'source-value', 'target-agency', 'target-identifier')
In order for this to work, include the following two import statements in your script:
import com.sap.it.api.ITApiFactory
import com.sap.it.api.mapping.ValueMappingApi
Javadoc documentation here: ITApiFactory ValueMappingApi
Regards,
Morten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Morten, works great.
How to pass a dynamic value for source-value?
def value= valueMapApi.getMappedValue('source-agency','source-identifier','source-value','target-agency','target-identifier').
I have tried the following code but it gives error as follows "Cannot retrive artifact for empty alias@"
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import com.sap.it.api.ITApiFactory;
import com.sap.it.api.securestore.SecureStoreService;
import com.sap.it.api.securestore.UserCredential;
import com.sap.it.api.ITApiFactory;
import com.sap.it.api.mapping.ValueMappingApi;
def Message processData(Message message) {
// get the message Properties
def mProp = message.getProperties();
String site = mProp.get("Local_Prop_site");
// read the value mapping to get the security credential
def valueMapApi = ITApiFactory.getApi(ValueMappingApi.class, null)
String secretCredID = valueMapApi.getMappedValue('SRC', 'Site', site , 'DEST', 'Credential');
Thanks,
Thosif Chand.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
52 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.