How do I keep the Record Type but remove from its dropdown menu?

craigalanleigh's picture

We have a Clearquest application solution for internal audit tracking.

One record type as parent is the audit "Finding". The other record type as child is "Action". Of course both record types appear on the dropdown menu to create new records, but I don't want actions created without parents from that menu which happens from time to time.

How to remove the child "Action" record type just from the menu? Or prevent it from being created as a new record when not linked to a parent record?

Any solution is welcome.

Thanks
--Craig

5 Answers

Mnemonic's picture
Mnemonic replied on March 2, 2011 - 6:46pm.

I'm not sure if I understand you correctly. It seems that you have parent-child relationship between two Record Types. You do NOT want to have 'orphaned' children, i.e. a child record created without being tied to a parent. Is that correct?
If yes, then what you could do is to have a _mandatory_ field in your child record with a link to a parent. Without the field being filled with a valid parent record, the child record should not be possible to submit.
This would require some hook coding, but would be much cleaner solution imho.

charan's picture
charan replied on March 2, 2011 - 6:51pm.

I had a situation like this once, even though I did not fully implement it, the idea was as follows:

Set the submit action restricted to groups and restrict it admin groups. This will disable it from showing up on the drop down list

When the parent record is created, in the hook to create the child record, use an admin session or an admin logon and associate it to the parent record.

Cheers--
Charan

craigalanleigh's picture

My predecessor wrote code which is running in a "New" button on the child tab to set (preaction) a NameValue and reset (postaction) once finished. This value can easily be tested as long as the "New" button is used, but doesn't work from the menu obviously.

Thanks for the replies Mnemonic & charan. Sounds like promising approaches both. We'll give one or both a try.

--Craig

craigalanleigh's picture

Here's a solution:

If you don't need the record type at all, take it off the menu by setting it's action "Submit" to script and in the script return $result = 0; It will not show on the menu.

Now if the record type is a child you are using and you want to control access and when it can be submitted:

You will need to create the reference relationship to its parent and in the New button you may want to do access control code for the Submit action of the child by setting a SESSION variable to true there and checking for it and with IsMemberOf in the child Submit action.

Cheers..
--Craig

craigalanleigh's picture

Here's a solution:

If you don't need the record type at all, take it off the menu by setting it's action "Submit" to script and in the script return $result = 0; It will not show on the menu.

Now if the record type is a child you are using and you want to control access and when it can be submitted:

You will need to create the reference relationship to its parent and in the New button you may want to do access control code for the Submit action of the child by setting a SESSION variable to true there and checking for it and with IsMemberOf in the child Submit action.

Cheers..
--Craig

CMCrossroads is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.