Skip to Content

Workflow rules - Automatic close of the opportunity if the close date has passed

Hello

we would like to get the possibility to automatically close the opportunity if the close date has passed (overdue). I tried to use the workflow rules, but in "Define Actions" :

- if i use the rule type "Field Update", I don't find the opportunity status field

- if i use the rule type "Action", i don't find the "close opportunity" action

Do you know if it's achievable. Can you please help ?


Thank you

Jérémie Waltman

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 19 at 05:11 PM

    Hi,

    Instead of using Workflow rules to do so please evaluate if you can make use of MDR(Mass Data Run) functionality where using ABSL code you can use first filter all the opportunities and then use action "STOP" to close the opportunities.

    import ABSL;import AP.CRM.Global;
    
    var CurrrentDate = Context.GetCurrentSystemDate();
    
    var query = Opportunity.QueryByElements;
    var p = query.CreateSelectionParams();
    p.Add( query.SalesForecastExpectedProcessingDatePeriod.EndDate,"I","LT",CurrrentDate);
    p.Add( query.Status.LifeCycleStatusCode,"I","EQ","1");
    p.Add( query.Status.LifeCycleStatusCode,"I","EQ","2");
    var res = query.ExecuteFromDB(p);
    
    
    foreach( var Opp in res)
    {	
    	Opp.Name.content = "Stalled Opportunity. Automatically Closed";
    	Opp.Stop();
    }
    

    You can schedule the MDR Monthly or Weekly based on your amount of client data.

    https://blogs.sap.com/2016/05/17/how-to-schedule-a-batch-job-using-mdr-in-c4c/

    Thanks

    Saurabh

    Add comment
    10|10000 characters needed characters exceeded