How to create new cost type and expense type

MakhanlalM
Tera Contributor

I have a requirement in ServiceNow PPM/SPM Financial Management, and I would appreciate some guidance on the configuration.

Currently, in Demand and Project, we have the standard cost types:

  • capital_outlay (CapEx)

  • operational_outlay (OpEx)

  • other_cost (New field requirement)

These values roll up to Total Cost.

Requirement

We need to introduce a new cost category called "Other Cost", which may include multiple additional cost types. This new category should also contribute to the Total Cost calculation.

Current Situation

  • When creating a Cost Plan, we currently select a Cost Type (CapEx or OpEx).

  • Each Cost Type is associated with an Expense Type (either CapEx or OpEx).

  • We have already created:

    • A new Cost Type called  ="Other Cost"

    • A new Expense Type    = "other cost"

  1. How can we configure  so that "Other Cost" rolls up into the Total Cost field for Demand and Project?

    • What configurations or tables should be considered for this roll-up?

  2. How can this new cost category be configured at the Portfolio level?

    • We want to ensure that it is also considered when allocating budgets in the Financial Workspace tab.

  3. Is it possible to create a completely new Expense Type (other than CapEx and OpEx)?

    • If yes, how can it be mapped and rolled up correctly up to the Portfolio level?

Any suggestions on the correct configuration approach or best practices would be greatly appreciated.

Thank you in advance.

8 REPLIES 8

fknell
Tera Patron

Hi @MakhanlalM,

I can only reiterate what the other authors have already mentioned. Please refrain from customizing the expense types!

 

Apart from the immense effort required to adapt all out-of-the-box functionality, you will incur significant technical debt. You will be forced to redo all this with every update, including patches and family releases, and you will not benefit from future out-of-the-box developments. 

 

I’m curious to know if you’ve discussed this with ServiceNow and what recommendations they’ve provided for that specific situation. 

 

Hope this helps!

I created a new cost type(cost_plam) table which is called â€śOther Cost.” When I map this cost type to  expense type either CapEx or OpEx  ,for example CapEx, and then create a new cost plan selecting Other Cost, it automatically populates the Capital Cost field (R&D Costs attaced pic). Similarly, when mapped to OpEx, it populates the OpEx Cost field.

 

How can I map this to my custom fields?
If the cost type is Other Cost (with expense type OpEx), then when the cost plan is created, it should populate the value in the Other Cost custom field instead of Operational _outlay fields .

it should for the project as well .

MakhanlalM
Tera Contributor

Thank you @Vaishnavi Lathk @AlfrinAJ @Guido Bernuetz @fknell  you guys are awesome,

 

As per the recommendations, I am planning to keep only the OOTB expense types: CapEx and OpEx.

 

I created a new cost type(cost_plam) table which is called “Other Cost.” When I map this cost type to  expense type either CapEx or OpEx  ,for example CapEx, and then create a new cost plan selecting Other Cost, it automatically populates the Capital Cost field (R&D Costs attaced pic). Similarly, when mapped to OpEx, it populates the OpEx Cost field.

 

How can I map this to my custom fields?
If the cost type is Other Cost (with expense type OpEx), then when the cost plan is created, it should populate the value in the Other Cost custom field instead of Operational _outlay fields .

it should for the project as well .

 

 

Not considering : third expensive type "other cost" 

then i can map it easily without touching the OOTB flow 

(function executeRule(current, previous) {
// new cost type 
    var developmentType = "a546eaf79330120064f572edb67ffb70";

    // Get Demand ID from Cost Plan
    var demandID = current.getValue('task');
    if (!demandID) {
        return;
    }

    // Get Demand record
    var demand = new GlideRecord('dmn_demand');
    if (!demand.get(demandID)) {
        return;
    }

    var totalCost = 0;
    var otherCosts = 0;

    // Get all cost plans related to this demand
    var cp = new GlideRecord('cost_plan');
    cp.addQuery('task', demandID);
    cp.query();

    while (cp.next()) {

        var amount = Number(cp.getValue('cost_local_currency'));
        if (isNaN(amount)) {
            amount = 0;
        }

        totalCost += amount;

        // Check if cost type = Development
        var costType = cp.getValue('resource_type');

        if (costType == developmentType) {
            otherCosts += amount;
        }
    }

    // Update demand fields
    demand.setValue('total_costs', totalCost);
    demand.setValue('other_costs', otherCosts);

    demand.update();

})(current, previous);
 

 

MakhanlalM
Tera Contributor

Thank you @Vaishnavi Lathk  @fknell @AlfrinAJ @Guido Bernuetz  you guys are awesome

 

As per the recommendations : I am planning to keep the only OOTB expensive type is Capex and opex :

 

So I have created a new cost type which is other cost and if I am mapping with expensive type either capex or opex . for example Capex when I create a new cost plan if I select cost is other cost then it setting up the capital_outplay fields which is (R&D costs attached pic) : same for opex set up in Operational_outlay feilds .

 

How can map with my coustom fields if if cost type is other cost (expensive type is opex) when cost plan gets created then it should be setting up the value in other_cost fields . similarly for the project as well 

 

 

Not considering : No flow Override 

(function executeRule(current, previous) {

    var developmentType = "a546eaf79330120064f572edb67ffb70";

    // Get Demand ID from Cost Plan
    var demandID = current.getValue('task');
    if (!demandID) {
        return;
    }

    // Get Demand record
    var demand = new GlideRecord('dmn_demand');
    if (!demand.get(demandID)) {
        return;
    }

    var totalCost = 0;
    var otherCosts = 0;

    // Get all cost plans related to this demand
    var cp = new GlideRecord('cost_plan');
    cp.addQuery('task', demandID);
    cp.query();

    while (cp.next()) {

        var amount = Number(cp.getValue('cost_local_currency'));
        if (isNaN(amount)) {
            amount = 0;
        }

        totalCost += amount;

        // Check if cost type = Development
        var costType = cp.getValue('resource_type');

        if (costType == developmentType) {
            otherCosts += amount;
        }
    }

    // Update demand fields
    demand.setValue('total_costs', totalCost);
    demand.setValue('other_costs', otherCosts);

    demand.update();

})(current, previous);