- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2019 01:35 AM
Hi all,
A little help please:
I have a catalog item variable (group) with the following value: 10:marketing
I am trying get the number (10) from the variable.
When running an after update business rule on the requested item, the number is returned properly. When running the exact same lines from a workflow activity, "undefined" is returned. The WF is a "run script" activity and is placed after the first approval (so it is way after the ritm is created).
The script:
var streamnumber = current.variables.group;
var num = streamnumber.match(/(.*)\:/).pop(); //this gets the number before the :
gs.addInfoMessage('hbs --> num ' + num);
Can't see any special logs with errors or warning...
Your thoughts,
harel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2019 02:20 AM
Hi Harel,
It might be worth adding a getValue() on the end of the streamnumber variable. I just tested this on a glide record and it seemed to do the trick.
var streamnumber = current.variables.group.getValue();
Cheers
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2019 02:20 AM
Hi Harel,
It might be worth adding a getValue() on the end of the streamnumber variable. I just tested this on a glide record and it seemed to do the trick.
var streamnumber = current.variables.group.getValue();
Cheers
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2019 02:30 AM
So... awesome. I thought it had to do something with the way the value is retrieved, but could not figure out what.
Thanks.
h
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2019 02:34 AM
Yeah, without the getValue it's just a pointer to a glide object, hence the undefined. It's more common to see this on glide records as opposed to when using the current object, must be something to do with how the current object is accessed in the workflow context.