Additional Asset Hardware Substate

djparkie
Tera Contributor

I'm having difficulties adding a Substate to an asset with State of "In use" which is OOTB. My Substate record is in place on sys_choice with the relevant dependency value set correctly. However, when selecting "In use" I cannot get Substate out of read-only.

I thought there was some UIP or CS at play, but couldn't find anything. Then thought it was related to Asset CI Install Status Mappings. I tried to create an entry for my new Substate but didn't make any difference.

I think I'm missing something simple; can someone help me understand what is making Substate read-only for some values but editable for others?

6 REPLIES 6

Community Alums
Not applicable

You're right - it was obvious, especially after your article came up at the top of my Google search 😄

Thanks!

Tom Siegel
Kilo Guru

There is also an on change client script written over the state field on alm_asset Named Correct substatus which clears the substatus field and makes it read only based upon the state

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (newValue == '') {
        return;
    }

    var setSubstatusReadOnly = false;
    if (newValue == '1' || newValue == '2' || newValue == '3' || newValue == '10') {
        if (!isLoading) {
            g_form.setValue('substatus', '');
        }
        setSubstatusReadOnly = true;
    } else if (newValue == '6' && !isLoading) {
		g_form.setValue('substatus', 'available');
	}
    g_form.setReadOnly('substatus', setSubstatusReadOnly);
	
	if (g_form.getTableName() === 'alm_license' && !isLoading && !g_form.isNewRecord() && parseInt(oldValue, 10) === 1 && parseInt(newValue, 10) !== 1) {
		g_form.addWarningMessage(getMessage('You have changed the state of this entitlement. This entitlement will no longer be available for reconciliation.'));
	}else if(g_form.getTableName() === 'alm_license' && !isLoading && !g_form.isNewRecord() && parseInt(newValue, 10) === 1 && parseInt(oldValue, 10) === parseInt(newValue, 10)){
		g_form.clearMessages();
	}
	
    return;
}