In Business rule and able to assign value to an object using current.variable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 10:31 PM
When I logging the current.variables.environment then it is giving correct value but when
var x={
"environment":current.variables.environment
}
then it is giving
{
"environment":{}
}
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2023 07:15 AM
You can use this approach instead:
var x = {};
x.environment = current.variables.environment;
gs.addInfoMessage('x environment = ' + x.environment);
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2023 10:36 AM
Hi @rvranjan_99
If current.variables.environment is indeed an object, you can use JSON.stringify to convert it into a JSON string, making it easier to log and inspect:
var x = {
"environment": JSON.stringify(current.variables.environment)
};
OR
var x={};
x.environment = current.variables.environment;
Please mark it as an accepted solution & HIT helpful if it suffices your requirement.
Thanks, Sohith
Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)