Make Capital Budget and Operating Budget mandatory to create project in PPM

MBarrott
Mega Sage

I have a requirement where we don't want to convert a demand into a project unless the capital budget or operating budget has a value entered. 

 

I've set them to mandatory via the dictionary but from what I can see it isn't pulling that setting.

 

It looks like both get their data from the Capex and Opex budgets.

 

What is the best way to check these values and ensure at least one of them is greater than the defaulted $0.00?

 

Figured maybe check against these values within the Create Project onClick script. 

 

var capital = parseFloat(g_form.getValue('capital_budget')); // added 
var operating = parseFloat(g_form.getValue('operational_budget')); // added 
 
function convertDemandToProject() {
    if (g_form.modified) {
        return g_form.addErrorMessage(getMessage('You have not saved all your changes, save the demand record before creating project'));
    } if(g_form.getValue('type') == 'project'&& g_form.getElement("calculation_type") && !g_form.getValue('calculation_type')) {
return g_form.addErrorMessage(getMessage('Please select a project calculation type under preferences.'));
}
if(capital == 0.00 && operating == 0.00) // added
{
return g_form.addErrorMessage(getMessage('Capital budget or Operating budget must be over $0.00'));
}
1 ACCEPTED SOLUTION

The two fields do exist on dmn_demand in my instance.  the following script logic works in a UI Action I have defined on dmn_demand form named "Check Budget"

 

function checkDemandBudget() {
//	var capital = parseFloat(g_form.getValue('capital_budget')); // added 
//	var operating = parseFloat(g_form.getValue('operational_budget')); // added
	var capital = g_form.getValue('capital_budget'); // added 
	var operating = g_form.getValue('operational_budget'); // added
	var capitalValues = capital.split(';');
	var operatingValues = operating.split(';');
	var capitalVal = parseFloat(capitalValues[1]);
	var operatingVal = parseFloat(operatingValues[1]);
	var total = capitalVal + operatingVal;
	alert ("capital = " + capital + ", operating = " + operating + ", total = " + total);
}

The first two lines do not result in a number, since the two fields are defined as type: Currency.

 

Screenshot 2023-12-23 113336.png

View solution in original post

6 REPLIES 6

This did the trick, I was able to use the cap/oper values from the split array to create a check within the Create Project function. 

Sohail Khilji
Kilo Patron
Kilo Patron

@MBarrott,

 

see if this help...

You can control the visiblity of 'Create Project' button to show only if both the fields are not empty and a ui policy to make capex and opex field mandatory wen demand is approved state.

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect