Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Add new rates to an existing Cost Rule via Web Service

Highlighted
ArunKr
Super Collector

Add new rates to an existing Cost Rule via Web Service

Hi,

I'm trying to update an existing Cost Rules and add a new rate for provided date range. However with the code provided in the FM example, when I try to add a new rate to the existing cost rule, it deletes all the existing rates for all the date ranges and inserts the new rate with specified data range.

example:

If I have a cost rule with existing rate $90 from Jan 01, 2016 and I try to insert new rate $100 from Oct 01, 2016 it deletes the existing rate and udpates the new rate from Oct 01, 2016.

 

So, I have to sepcify all the previous rates in the code and then give the new rate in the last line so previous cost rates for old date ranges are not removed.

Is there another way to insert only the new rates for existing cost rule by providing only the new rates instead of providing all the rates?

Any help is appreciated.

WS java code:

public void testUpdateCostRule() throws Exception {
final CostRule costRule = CostRule.Factory.newInstance();
costRule.setId (30010); //Set the cost rule id.
costRule.setRateArray(new CostRate[] {
this.costRate("Jan 02, 2016", "Oct 01, 2016", 80f),
this.costRate("Oct 02, 2016", null, 100f)
});
updateCostRules(new CostRule[] { costRule });
}

 

2 REPLIES
Gunajn_1234
Acclaimed Contributor

Re: Add new rates to an existing Cost Rule via Web Service

Hi Arun,

I am facing the same issue. Were you able to resolve it? Appreciate your help.

Regards,

GV

 

 

ArunKr
Super Collector

Re: Add new rates to an existing Cost Rule via Web Service

Hello Gunjan,

No, there is a function to read the cost rules. May be this function could be utilised to read and then update the rule once by one.. I havent got a chance to proceed with my analysis further. let me know if you are able to complete.

//Add this to "OnDomLoad" event