- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 04:13 AM
We create Demand [dmn_demand] record, then create enhancement [rm_enhancement] record from the demand record. the demand state changes to Approved once enhancement is created.
My request is when we close enhancement record, update the demand state to Complete.
Any help/thoughts is be appreciated!
Regards
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2024 12:39 AM
The flow should look like this:
And if you insist on using a BR, why not make it simple? Trigger it after update of the enhancement with state = closed and use this:
var demand = new GlideRecord('dmn_demand');
demand.addQuery('enhancement',current.getUniqueValue());
demand.addActiveQuery();
demand.query();
while(demand.next()){
demand.setValue('state', 9); // completed
demand.update();
}
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 05:01 AM
Hi Mark, thanks for your help,
i created a flow but this will only trigger if Demand is updated. once Demand is updated will look at attached enhancement if closed then update the demand.
but my request is i want demand is updated automatically once enhancement is closed, then close/complete demand.
I don't mind to change from BR to Flow if there is a way to solve this.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 05:04 AM
Then you created your flow on the wrong trigger. Put the trigger on 'Enhancement changes to closed', look up the demand and update it. You are defining when the flow should run. Why did you put it on 'demand updated' if you need it to trigger on 'enhancement closed'?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 06:38 AM - edited 03-26-2024 01:42 AM
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2024 05:39 AM
I would create a flow, triggering on a demand going to complete, look up the attached enhancement record and close it.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 05:08 AM - edited 03-27-2024 05:09 AM
Hi @WaledBajukhaif ,
Create after update Business rule:
Conditition : (as per your needs)
1. state cahnge ot closed complete
2. more condition as needed....
(function executeRule(current, previous /*null when async*/) {
if (current.state.changesTo('Closed Complete')) {
var demand = new GlideRecord('dmn_demand');
if (demand.get(current.demand)) { //if your have demand field if not do a gliderecord of demand table and get sys_id
demand.state = 'Complete';
demand.update();
}
}
})(current, previous);
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....