- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 01:05 PM
how can I pass the incident category value dynamically in key value format
var inccategory = current.category.getDisplayValue();
var result = "{'category':inccategory} // this gives me error but if I print logs then I am able to see correct value
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 01:44 PM
Remove the quotes around the curly braces:
var result = {"category":inccategory};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 01:16 PM
What error are you getting? I am only see the unnecessary quotes before your curly bracket, otherwise should be fine.
var inccategory = current.category.getDisplayValue();
var result = {'category':inccategory};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 01:17 PM
Hi,
Do like below
var inccategory = current.category.getDisplayValue();
var result ={};
result.category=inccategory;
var strJSON=JSON.stringify(result)
gs.info(strJSON)
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 01:19 PM
I tried it gives me error in flow designer
I also tried .toString, in logs i can see the correct value but in flow designer it gives below error
unrecognized inccategory was expecting null, nan, string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 01:21 PM - edited 01-05-2023 01:24 PM
Hi,
It will not work in flow designer as current object is not available flow like this.
Thanks and Regards,
Saurabh Gupta