Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove a subform field?

SOLVED
Go to solution
Highlighted
Michael Daly_2
Collector

How to remove a subform field?

I have set up a Generic Relation and UI rule for a Change to add an custom organisation field (called 'Customer') to the common left hand pane of my Change form when a specific Customer name is added to this 'Customer' field. That is working okay.

Now I want to know how to remove this field when the 'Customer' field is made blank or changed to another customer name.

Here is what I have done so far:
1. Added a new (2nd) Insertion Marker on my Change form right underneath the first Insertion Marker (so I have two Insertion Markers together between two fields) in the common left-hand pane of my Change form.
2. Created a new Generic Relation that links the Organisation-Category to my Blank form (a new sub-form with only a separator line on it).
3. I then created a new Change UI rule that has ticks in Apply this rule: items of 'After existing item has been opened', 'After new item has been opened' and 'When a value has changed'. I then have a condition that works because I have two actions and the second one fires - which is to display a banner message. The first action to remove a field from the left hand pane of my Change form is configured with the Insertion Marker of 'chgBlank', and Paths to try are 'Customer;Category -> Blank Change form'.

If I blank out the Customer field it fires the Banner test message, but does not remove the 'Billing Ref' field. If I enter another customer name I also get the Banner test message but I also get two error message box popups with the old JavaLong:NullPointerException error message.

What am I doing wrong. Can you please advice?

Regards

Michael Daly
11 April 2007
9 REPLIES
George M. Meneg
Honored Contributor

Re: How to remove a subform field?

Hello Michael,

In your UI rule, instead of checking for a particular 'Customer' value, just check 'Customer' is not empty.

If you have created a generic relation between person and subform and there are relations of this type, for all the persons listed the subform will be presented and for all other persons will not.
menes fhtagn
Michael Daly_2
Collector

Re: How to remove a subform field?

Hi George

I modified my UI rule so that the condition is if the 'Customer' field 'is empty'. That had no effect to make the removal of the 'Billing Ref' field off my Change form.

I then tried to modify the Generic Relation as I think that is where my problem is. I had it set up to link the 'Organisation Category' field to my Blank form (frmBlank) but that didn't work either. So I changed the Generic Relation to use the Organisation field. This then forces me to select a specific Organisation from the list of all Organisations. I choose the root of the tree or the parent Organisation's name. This seems to be a direct contradiction to the UI rule. This still didn't work. I then tried to put in the name of another Organisation but that didn't work either.

I am still struggling to understand these Generic relations as I can't understand how the list is built when it displays Organisation, Organisation - Code 1, etc., but it is only a very small list of possible attributes for an Organisation. Maybe it's a limit of SP-20.

I look forward to more advice. Many thanks.

Michael Daly
12 April 2007
Jonathon Druce
Honored Contributor

Re: How to remove a subform field?

Michael,

You have struck the limitations of the inssert subform action. The insert works fine as you have found but there needs to be a corresponding "Remove subform" action. I have used subforms only on CI forms adding fields and tabs based on the category of the CI and setting this when the item is opened or category changes (which does not happen much).

Your requirement is more dynamic than this and shows that there is a need for additional functionality. I would raise an Enhancement request to ask for this. I would definitely support it.
Jonathon Druce
Honored Contributor

Re: How to remove a subform field?

Michael,

You have struck the limitations of the insert subform action. The insert works fine as you have found but there needs to be a corresponding "Remove subform" action. I have used subforms only on CI forms adding fields and tabs based on the category of the CI and setting this when the item is opened or category changes (which does not happen much).

Your requirement is more dynamic than this and shows that there is a need for additional functionality. I would raise an Enhancement request to ask for this. I would definitely support it.
Jonathon Druce
Honored Contributor

Re: How to remove a subform field?

Only meant to submit this once but this web site seems to be a bit flakey today.
Michael Daly_2
Collector

Re: How to remove a subform field?

Thanks Jonathon

I think you are right. I've spent more time on this issue than it's worth, as it's not the end of the world to leave the extra field on the form.

But from a program/form design I like to get it right, and it seems to me that if the functionality is there to 'add' a field to a form you should also have the corresponding functionality to 'remove' a field from a form.

Thanks for your reasoning and advice.

Michael Daly
12 April 2007
Michael Daly_2
Collector

Re: How to remove a subform field?

George and Jonathon

I'll assign once HP's system is operational. I keep getting error messages that their system is out of service every time I try and assign points.

Michael Daly
12 April 2007
George M. Meneg
Honored Contributor
Solution

Re: How to remove a subform field?

Hello,

I don't get it. Here it is straightforward.

I have a Generic Relation between Workgroups and Forms.

There are three relations of this type, Wog1, Wog2, Wog3.

The *ONLY* UI rule I use is:

When Service Call is modified
Assignment;To Workgroup is ANYTHING

At the insertion marker I insert the subform with Source Field set to Assignment; To Workgroup and relation type "Workgroup To Form".

When a workgroup is insterted at assignment;to, when it is one of these three the subform appears. When it is not, it disappears. No need to "remove subform".

The Steps:

Define a Generic Relation between an Item and Forms.

Instert EACH and EVERYONE nonempty relation between Item and Subforms

Eg, Item; Value1 -> Form1
Item; Value2 -> Form2
...
Item; ValueN -> FormN

In the ui rule INSTEAD of Checking for Particular value of the Item just check for "Item is ANYTHING". Select the insertion marker defined on the main form, select as Source field your Item and as relation type, the relation type you defined above.

Each time Item;Value Changes form Changes. For Item;Values that have NO generic relation to a subform, the subform is dissapear.
menes fhtagn
Michael Daly_2
Collector

Re: How to remove a subform field?

George

Thanks for that clarification. I have misunderstood why there seemed to be two competing 'conditions' of connecting the 'Customer' field value with the specific customer. One condition I had in my UI rule that linked the specific Customer (an Organisation) value, and again in my Generic Relation that inserts the subform also has the specific Customer linked to the subform to insert.

I took your advice and changed my Change UI rule to have the 'Condition' to be simplified to 'Customer is anything', and now it works. As you say if the Customer field is the specific Customer (Organisation) I enter in this field the additional field from the subform appears, and if I change this Customer field to anything else then the added subform disappears!!!

I have thus removed my second insertion point from my Change form, and I've deleted the Generic Relation I had to remove this subform, and I've deleted the Change UI rule that was to remove the additional form.

But I still have a problem.

When I enter the organisation into my 'Customer' field a "Quick Find - Organisation" form is displayed asking which specific organisation from the list is the one to choose? I choose the correct one from the list and click the [OK] button which is then immediately proceeded by a MessageBox form with 'Customer' in the title bar, and the old 'java.lang.NullPointerException' error message with an [OK] button. I click the [OK] button and get a second MessageBox with 'Error' in the title bar, and 'java.lang.NullPointerException' in the body and an [OK] button. The correct Customer Organisation name is inserted into my Customer field but the 'Quick Find - Organisation' form is still visible behind my Change form.

I don't know why I am getting these error messages, and why the 'Quick Find - Organisation' form is still visible in the background when it normally disappears after you click the [OK] button.

Any suggestions?

Thanks again. Regards

Michael Daly
13 April 2007
//Add this to "OnDomLoad" event