- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 10:31 AM
Hi,
I have 2 methods within a script activity in the workflow for a catalog. I am trying to call <<current.fieldname>> and <<current.variables.variablename>> , but the value always comes as null.
If I print those values outside the method, I am able to print the values.
Can we not call Current within a method?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2018 01:43 AM
HI,
Try this :
gs.log("@@ first name "+current.variables.requested_for_first_name);
gs.log("@@ Short desc "+current.description); createRequest(current.description,current.company,current.variables.requested_for_first_name,current.variables.requested_for_last_name,current.variables.address1);
function createRequest(desc,comp,first,last,address) {
var restMessage = new sn_ws.RESTMessageV2('Order Request', 'Post');
restMessage.setAuthentication("basic", "Auth");
restMessage.setRequestHeader("Accept","application/json");
restMessage.setRequestHeader("Content-Type","application/json");
var addressBilling = {};
addressBilling.Description =desc;
addressBilling.CompanyName = comp;
addressBilling.Name_First = first;
addressBilling.Name_Last = last;
addressBilling.StreetAddress_Line1 = address;
gs.log("addressBilling "+addressBilling)
......
......
......
}
Thanks,
Ashutosh Munot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 11:47 AM
You shouldn't pass current as a variable and receive it as current. Just use the below code, since current will be available globally in the workflow.
gs.log("@@ first name "+current.variables.requested_for_first_name);
gs.log("@@ Short desc "+current.description); createRequest();
function createRequest() {
var restMessage = new sn_ws.RESTMessageV2('Order Request', 'Post');
restMessage.setAuthentication("basic", "Auth");
restMessage.setRequestHeader("Accept","application/json");
restMessage.setRequestHeader("Content-Type","application/json");
var addressBilling = {};
addressBilling.Description = current.description;
addressBilling.CompanyName = current.company;
addressBilling.Name_First = current.variables.requested_for_first_name;
addressBilling.Name_Last = current.variables.requested_for_last_name;
addressBilling.StreetAddress_Line1 = current.variables.address1;
gs.log("addressBilling "+addressBilling)
......
......
......
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 12:34 PM
Hi Sanjivmeher, I tried it and still no luck.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 12:50 PM
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2018 01:43 AM
HI,
Try this :
gs.log("@@ first name "+current.variables.requested_for_first_name);
gs.log("@@ Short desc "+current.description); createRequest(current.description,current.company,current.variables.requested_for_first_name,current.variables.requested_for_last_name,current.variables.address1);
function createRequest(desc,comp,first,last,address) {
var restMessage = new sn_ws.RESTMessageV2('Order Request', 'Post');
restMessage.setAuthentication("basic", "Auth");
restMessage.setRequestHeader("Accept","application/json");
restMessage.setRequestHeader("Content-Type","application/json");
var addressBilling = {};
addressBilling.Description =desc;
addressBilling.CompanyName = comp;
addressBilling.Name_First = first;
addressBilling.Name_Last = last;
addressBilling.StreetAddress_Line1 = address;
gs.log("addressBilling "+addressBilling)
......
......
......
}
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 02:55 AM