Hi Experts,
I have a account attribute of type [int], Using Transform, I’m trying to add the attribute value + 100. Is this possible in transform.
Hi Experts,
I have a account attribute of type [int], Using Transform, I’m trying to add the attribute value + 100. Is this possible in transform.
Hi @chandramohans27,
you can acheive that with static transform
Try this first version :
{
"name": "Add 100 do value",
"type": "static",
"attributes": {
"value": "#set($myAttValueInt=$myAttValue.toInteger()+100)#set($myAttValueStr=$myAttValueInt.toString())$myAttValueStr",
"myAttValue": {
"type": "accountAttribute",
"attributes": {
"attributeName": "attributeName",
"sourceName": "SourceName"
}
}
},
"internal": false
}
A second version if the first does not work :
{
"name": "Add 100 do value v2",
"type": "static",
"attributes": {
"value": "#set($myAttValue=$myAttValue.toInteger()+100)#set($myAttValue=$myAttValue.toString())$myAttValue",
"myAttValue": {
"type": "accountAttribute",
"attributes": {
"attributeName": "attributeName",
"sourceName": "SourceName"
}
}
},
"internal": false
}
You must readapt your attribute retrieving on :
"myAttValue": {
"type": "accountAttribute",
"attributes": {
"attributeName": "attributeName",
"sourceName": "SourceName"
}
}
Let me know if it’s work
Thanks for your reply!
I tried this, But it ended up in below error.
To convert string to Integer, we usually use Integer.parseInt($string). I tried that as well. but it didn’t work
Hi @chandramohans27, i will test now.
Hi @chandramohans27 ,
After testing on my tenant this work for me :
{
"name": "Add 100 do value",
"type": "static",
"attributes": {
"value": "#set($Integer = 0)#set($myAttValueInt=100+$Integer.parseInt($myAttValue))$myAttValueInt",
"myAttValue": {
"type": "static",
"attributes": {
"value": "100"
}
}
},
"internal": false
}
You can test this transform as given.
And after update myAttValue attribute recuperation :
"myAttValue": {
"type": "static",
"attributes": {
"value": "100"
}
}
It worked @baoussounda Thankyou!
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.