Update Demand state when Enhancement is Closed Complete

WaledBajukhaif
Tera Expert

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

1 ACCEPTED SOLUTION

Mark Manders
Mega Patron

The flow should look like this:

MarkManders_0-1711611011611.png

MarkManders_1-1711611044493.png

MarkManders_2-1711611074704.png

MarkManders_3-1711611102666.png

MarkManders_4-1711611121956.png

 

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

View solution in original post

12 REPLIES 12

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,

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 Manders
Mega Patron

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

Sohail Khilji
Kilo Patron
Kilo Patron

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....

LinkedIn - Lets Connect