- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2015 01:54 PM
I have a table u_enhancement_task that contains:
u_task_type, u_state, u_assigned_to, u_requirements_state, u_requirements_assigned_to
I'm trying to update the value in the u_requirements_state with u_state and u_requirements_assigned_to with u_assigned_to
where u_task_type = "Requirements".
Here's what I have set up using a business rule (not sure this is the best way):
In the Condition field, I have:
current.u_task_type == "Requirements"
In thescript window, I have:
updateRequirementsStateandAssign();
function updateRequirementsStateandAssign() {
var req = new GlideRecord("u_enhancement_task");
req.addActiveQuery();
req.addQuery("u_task_type", "Requirements");
req.query();
while (req.next()) {
req.setValue(req.requirements_state, current.state);
req.setValue(req.requirements_assigned_to, current.assigned_to);
}
}
If I have the When the run set to :before or display,in a FORM it shows correctly, but it doesn't reflect the updates when I list table.
What did I miss?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 12:11 PM
Ok, I wouldn't have done this way but it does work
If you want, you can mark the answer as a solution (so people would see the issue has been answered)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 10:10 AM
Life is good. I changed my advanced tab to:
condition: current.u_task_type == "Requirements"
setValue(current.u_requirements_state, current.u_state);
setValue(current.u_requirements_assigned_to, current.u_assigned_to);
Thanks for pointing me in the right direction!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2015 12:11 PM
Ok, I wouldn't have done this way but it does work
If you want, you can mark the answer as a solution (so people would see the issue has been answered)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2015 12:20 PM
even though it works, i'd really like to hear a better way of doing this. basically, the requirement was to create a spreadsheet with added columns (requirements state, requirements assigned to, etc.) based on each task type (requirement, design,build, QA). The added columns are in a reference table which I would then map into a report before exporting to excel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 09:25 AM
add req.update(); at the end of the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2015 12:59 PM
I thought I read somewhere that for scripting in business rules, you don't want to use update(). However, I will try it and let you know how it goes.