array.push[] is not working in workflow approval group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 07:00 AM
Hi all,
I am trying below code in workflow approval group activity where i want to push group sys_id based on certain condition.
I am getting below error in logs "Cannot find function push in object servicenow".
Can someone help me on this.
var answer = [];
// Assuming current.variables.oracle_custom_roles contains the data as a string.
var rolesArray = JSON.parse(current.variables.oracle_custom_roles.toString());
// Loop through each item in the rolesArray
for (var i = 0; i < rolesArray.length; i++) {
var businessFlow = rolesArray[i].business_flow.toString(); // Extract the business_flow value
// Check if the business_flow is 'P2P'
if (businessFlow == 'P2P') {
answer. Push('31ea3d7e1b7b8e582be1eac82d4bcb09'); // Push specific value to answer array
}
if (businessFlow == 'R2P') {
answer. Push('31ea3d7e1b7b8e582be1eac82d4bcb09'); // Push specific value to answer array
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 10:14 AM
it needs to be
answer.push('31ea3d7e1b7b8e582be1eac82d4bcb09')
No space after the . and push needs to be lowercase, not Push