Expand my Community achievements bar.

How to trigger <leave> in referenced container?

Avatar

Level 2

I have a custom container which I am including in nms:delivery input form like this:

 <container ref="cus:outboundPhone:outboundPhoneContainer" xpath="."/>

I am trying to add a validation-method, by adding a <leave>-tag in the container mentioned above but the only way I have got the leave-tag to trigger is by placing it in the nms:delivery input form itself.
It would be nice to have minimal adjustments to the OOB-schemas, which is why I would like the to place the leave-tag in the custom built input form.
Has anyone got a solution for this?

2 Replies

Avatar

Community Advisor

Hello @_lukas_ 

I had this problem long time ago. I remember having to put the &gt;leave> tag on directly in the parent form, but at the end, I managed to get it work.

Not sure but try to use sub &gt;container> into your custom built subform. I have working (and complex) subforms just right here so I think it works, but don't have any exact rules to give

 

Cedric

 

Avatar

Level 2

Thanks for pointing out that it should be possible. I gave up last time, spending too many hours to solve this.
So now that I have forgotten how frustrated I was last time, I decided to give it a new try.
However I am still struggling. I have managed to refer to my custom leave-tag, from the oob input form, explicitly in this way:

 

<leave ref="test:offer:leave">
    <check expr="![category/env/@live]">
      <error>You may not make changes to an offer in production.</error>
    </check>
    ....
<leave/>

 

The problem is that everything inside the leave tag in the OOB input form is "overwritten" by my custom referenced leave tag. So for example, when referencing from the OOB nmsoffer input form, like the example above, I am able to edit offers in the live environment without error messages.

I have found a similar OOB example in the landingPageWiz.xml (./nl6/datakit/crm/eng/form/landingPageWiz.xml) where this type of reference is made (open leave-tag with reference along with other content), but I don't now how to test if that works or not:

<leave ref="crm:landingPage:leave">
	<if expr="[/ignored/selectedFolder]=0">
		<if expr="[/ignored/@folderId]!='' AND [/ignored/@folderId]!=0">
				<set xpath="@folder-id" expr="[/ignored/@folderId]"/>
		</if>
			
		<if expr="[/ignored/@operationOrgUnitId]!='' AND [/ignored/@operationOrgUnitId]!=0">
			<set xpath="@folder-id" expr="DefaultFolder('crmLandingPage', 0, [/ignored/@operationOrgUnitId])"/>
		</if>
	</if>
</leave>