Hallo All,
I have two systems.
So sending system has a Json format A. But receiving system B a different Json format .
Currently I have solved this via a Javascript...like
function executeScript(event) {
var Payload = event.getParameter("Payload_Sub");
var PayloadUserNameChange = event.getParameter("PayloadUserNameChange");
PayloadUserNameChange.Operations[0].value = Payload.HR_Core.PRS.Person_NAME[0].PRS_MLNG_Person_MiddleLegalNameGlobal.attr_value;
PayloadUserNameChange.Operations[1].value = Payload.HR_Core.PRS.Person_NAME[0].PRS_FLNG_Person_FirstLegalNameGlobal.attr_value;
PayloadUserNameChange.Operations[2].value = Payload.HR_Core.PRS.Person_NAME[0].PRS_LLNG_Person_LastLegalNameGlobal.attr_value;
event.setParameter("PayloadUserNameChange", PayloadUserNameChange)
I wonder if this could be solved by using the graphical
Data Mapping Task Editor or
Data transformer Task editor
Could you me somebody give a hint ?
Hi @HansGeorg,
Both of these task editors can help achieve this goal, but choosing the Data Mapping Task editor is considered a more straightforward and feasible approach if your goal is to simply map values from the Payload object to the PayloadUserNameChange object.
Based on your given sample code, I structured a sample JSON format for both objects:
For Payload object:
{
"HR_Core": {
"PRS": {
"Person_NAME": [
{
"PRS_MLNG_Person_MiddleLegalNameGlobal": "MiddleName",
"PRS_FLNG_Person_FirstLegalNameGlobal": "FirstName",
"PRS_LLNG_Person_LastLegalNameGlobal": "LastName"
}
]
}
}
}
For PayloadUserNameChange object:
{
"Operations": [
"MiddleName",
"FirstName",
"LastName"
]
}
Then I tried to replicate what it would be like if I used the Payload json as an input structure and PayloadUserNameChange json as the output structure through the Data Mapping Task editor like this:
Though I’m not sure if all of these are matched with the exact scenario you had in mind, generally, using this task editor is a good choice for this purpose even if both JSON structures are different.
The Data Transformer task also assists in meeting the same outcome but this is more appropriate if you want to implement other complex tasks that may go beyond just simple field mappings (and if your data needs to undergo further manipulation before passing it to the receiving system).
I hope the above information is helpful.
Hallo KyliMari,
sounds that I simply was not aware of this function.. Thank you fro your time you spend on it.
But this requires that all input fields are in the same sequence like fields in the output Json. Correct ?
Further, would it be possible that you export your test as XML and send it via mail ? .. Would like to see it in detail how it is working and add my own tests to it
Hi KyleMari,
I tried to replicate your solution..
Going into the details I saw that the PayloadUserNameChange is slightly different.
But this was not recognizable by you seeing my example.. Sorry for that.
here is the correct one :
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations": [{
"op": "add",
"path": "name.middleName",
"value": "middleName_Updated"
}, {
"op": "add",
"path": "name.givenName",
"value": "givenName_Updated"
}, {
"op": "add",
"path": "name.familyName",
"value": "FamilyName_updated"
}]
}
Appreciate your time to look into this again ..