SetActionPlan not populating the correct Timings

58 views
Skip to first unread message

Salvinder Parhar

unread,
Jun 8, 2026, 12:56:41 PMJun 8
to CGRateS
Hello CGRateS team,

I'm setting up a new ActionPlan in CGRateS DataDB, and trying to use an existing TimingID in that ActionPlan, but the new ActionPlan gets created without the  "Years", "Months", "MonthDays" and "WeekDays" as defined in the assigned "TimingID". Please let me know if this is a bug OR if I'm doing something wrong.

1/ Confirm that the required TimingID already exists in DataDB.

{
  "id": {{$randomInt}},
  "method": "APIerSv1.GetTiming",
  "params": [
      {
        "ID": "TIMING_ID_01"
      }
  ]
}

{
    "id": 594,
    "result": {
        "ID": "TIMING_ID_01",
        "Years": [
            2026,
            2027
        ],
        "Months": [
            1,
            4,
            7,
            10
        ],
        "MonthDays": [
            1
        ],
        "WeekDays": [
            0,
            1,
            2,
            3,
            4,
            5,
            6
        ],
        "StartTime": "01:59:59",
        "EndTime": "02:59:59"
    },
    "error": null
}

2/ Create a new ActionPlan in DataDB, and use the existing TimingID "TIMING_ID_01".

{
    "id": {{$randomInt}},
    "method": "APIerSv1.SetActionPlan",
    "params": [
        {
            "Id": "ACTION_PLAN_01",
            "ActionPlan": [
                {
                    "ActionsId": "ACTION_RESET_TRIGGERS",
                    "TimingID": "TIMING_ID_01",
                    "Time": "01:59:59",
                    "Weight": 10
                }
            ],
            "Overwrite": true,
            "ReloadScheduler": true
        }
    ]
}
{
    "id": 396,
    "result": "OK",
    "error": null
}

3/ Fetch the newly created ActionPlan from DataDB.

{
    "id": {{$randomInt}},
    "method": "APIerSv1.GetActionPlan",
    "params": [
        {
            "Id": "ACTION_PLAN_01"
        }
    ]
}

{
    "id": 186,
    "result": [
        {
            "Id": "ACTION_PLAN_01",
            "AccountIDs": null,
            "ActionTimings": [
                {
                    "Uuid": "d8902e5f-bc8a-4f1e-81c4-89e844b83ff9",
                    "Timing": {
                        "Timing": {
                            "ID": "TIMING_ID_01",
                            "Years": [],
                            "Months": [],
                            "MonthDays": [],
                            "WeekDays": [],
                            "StartTime": "01:59:59",
                            "EndTime": "02:59:59"
                        },
                        "Rating": null,
                        "Weight": 0
                    },
                    "ActionsID": "ACTION_RESET_TRIGGERS",
                    "ExtraData": null,
                    "Weight": 10
                }
            ]
        }
    ],
    "error": null
}

Here, the response shows the ActionPlan we just created, but the Timings object is completely missing the values for "Years", "Months", "MonthDays" and "WeekDays", as they were defined in the assigned TimingID. The only value it populated from the TimingID is for "EndTime". Is this expected OR a bug?

Also, when creating a new ActionPlan, "Time" is a mandatory property in the request payload for method "APIerSv1.SetActionPlan", otherwise it gives an error back saying "MANDATORY_IE_MISSING:Action:ACTION_RESET_TRIGGERS:[Time]". But if I'm already assigning a "TimingID" to the new ActionPlan, and that  "TimingID" has a "StartTime" defined in it, why does it still need the "Time" property with a value? Isn't that a duplicated effort?

Thanks,
Sal

Armir Veliaj

unread,
Jun 11, 2026, 11:23:40 AMJun 11
to CGRateS
Hi Sal,

The right separator should be ";" instead of ",". If you specify Years/Months/MonthDays/WeekDays that are already present in the specified TimingID, they will be duplicated. You may open an issue on GitHub for duplication and we can check on it.

Regarding the error "MANDATORY_IE_MISSING:Action:ACTION_RESET_TRIGGERS:[Time]", it happens because Time is currently always overwriting StartTime from the specified Timing under TimingID. It ensures that in case of empty "StartTime" it always get populated so the ActionPlan can be executed correctly.

Hope it helps,

Thanks,
Armir

Salvinder Parhar

unread,
Jun 11, 2026, 12:00:52 PMJun 11
to CGRateS
Hi Armir,

Sorry, but I think there is some confusion here. When you say - The right separator should be ";" instead of "," - But I'm not using any separator in the "SetActionPlan" payload. Did you mean the separator in the response payload of method "APIerSv1.GetTiming" (Step 1 above)? Don't think I control that.
Instead of specifying the "TimingID", if I just directly specify Years/Months/MonthDays/WeekDays in the "SetActionPlan" payload like below, that works well. But I'm trying not specify individual timings per ActionPlan and use "TimingID" for easy future management of these ActionPlans and TimingIDs.

{
    "id": {{$randomInt}},
    "method": "APIerSv1.SetActionPlan",
    "params": [
        {
            "ID": "ACTION_PLAN_03",
            "ActionPlan": [
                {
                    "ActionsId": "ACTION_RESET_TRIGGERS",
                    "Years": "2026",
                    "Months": "8;9;10;11;12",
                    "MonthDays": "1",
                    "WeekDays": "*any",
                    "Time": "00:00:01",
                    "Weight": 10
                }
            ],
            "Overwrite": true,
            "ReloadScheduler": true
        }
    ]
}

Regarding the error "MANDATORY_IE_MISSING:Action:ACTION_RESET_TRIGGERS:[Time]" - Completely understand the logic that if "StartTime" in the specified TimingID is missing, and if "Time" is also not provided in the "SetActionPlan", this will cause issues with ActionPlan execution. But currently this mandatory "Time" field check happens at the very start of the function "SetActionPlan", before the "TimingID" is even fetched and evaluated. Shouldn't this check for the "Time" field be moved to after the  specified "TimingID" is fetched from DataDB and evaluated, and if its "StartTime" is empty then check if the "Time" was provided with the "SetActionPlan" payload? 

Thanks,
Sal

Armir Veliaj

unread,
Jun 12, 2026, 10:55:14 AMJun 12
to CGRateS
Hi Sal,

I was referring to setting timings not about the responses. As we have tested, using “,” creates empty fields, while “;” creates duplicate entries. Since your response showed empty fields, I assumed you had used “,”. However, this is not the root issue. At the moment, SetActionPlan correctly processes timings when fields are specified directly in the payload, same as in the last API you already tried.
As I mentioned earlier, you can open a GitHub issue, and we will revise it to also support correctly TimingID in SetActionPlan.

Regarding the Time field, making it mandatory was intended to prevent actions from not executing without a specified time, since timings were mostly set directly in the payload rather than via TimingID. Although this is not a bug, we could consider removing as mandatory and instead populate it from the StartTime of the TimingID if that is present.
You may open a GitHub issue for this as well, and we can revise it if others also consider this option needed.

Thanks,
Armir

Salvinder Parhar

unread,
Jun 14, 2026, 9:33:56 PM (12 days ago) Jun 14
to CGRateS
Thanks Armir. I've opened two new issues on Github for this, #5225 and #5226.
Reply all
Reply to author
Forward
0 new messages