How to compare String variable in catalog item with integer field on user record (requested for user record) in if activity in workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 01:58 AM
Hi Team,
my requirement is
i have a string variable(requested_amount) in my catalog item
and i have a integer field(available_amount) on user table (sys_user)
and i have requested_ for variable in my catalog item.
Now in my workflow if activity or Approval group activity i need to compare requested amount and available amount(requested for.available_amount). and if requested amount is greater than available amonut approval will go to ABC Group. if requested amount is less than available amount approval will go to DEF group.
i am stuck at how to convert my string variable value to integer to compare the two values? and how can i compare the two? like which operators i need to use?
can anyone Please provide the solution/ sample script for comparision?
Thanks in advance,
Hari Kishan.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 02:06 AM
Hi,
You can use parseInt() to convert string to number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2022 02:14 AM
Hello @HARI KISHAN GVS
You can direct check the condition as below syntax
if(parseInt(current.variables.requested_amount)==ParseInt(current.variables.requested_for.available_amount))
{
return "Yes";
}
else
{
return "No";
}
Thanks