cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding items on system forms with XML

Former Member
0 Kudos

Is it possible to hide items on system forms using XML with LoadBatchActions()?

I know this is possible using the standard UI API calls, e.g. oForm.Items.Item("394").Visible = false; // or something along those lines

But I'd like to do it in XML as I believe the performance is better, meaning there's less delay when opening the form (it's awfully slow when hiding lots of items in one go). I have the following XML but it doesn't work - I can change the caption of the item by adding this to the <specific> block (so I know I'm on the right lines), but I cannot change the visibility of the item. I've tried changing the frompane and topane attributes to -1 to hide, but that also doesn't work.

<?xml version="1.0" encoding="UTF-16"?>

<Application>

  <forms>

    <action type="update">

      <form FormType="134" uid="">

        <datasources />

        <Menus />

        <items>

          <action type="update">

            <item uid="394" frompane="-1" topane="-1">

              <AutoManagedAttribute>

                <Attribute description="visible" id="1" modeAdd="0" modeFind="0" modeOk="0" modeView="0" />

                <Attribute description="editable" id="2" modeAdd="0" modeFind="0" modeOk="0" modeView="0" />

              </AutoManagedAttribute>

              <specific />

            </item>

          </action>

        </items>

        <DataBrowser/>

      </form>

    </action>

  </forms>

</Application>

Does anyone know if this is possible, and if so how I can change the above XML to make it work?

Cheers.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

As promised, I've moved this question to the SDK forum for better exposure and hopefully to find an answer.

The moved thread is located here: http://scn.sap.com/thread/3388501

KennedyT21
Active Contributor
0 Kudos

Close the Thread here

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks to both of you for your replies.

@Beni Klein:

Yes - sorry I forgot to mention that in my original post. I've tried setting visible to 0 in the <item> tag and unfortunately that also does not work, unless visible is case-sensitive? I think I tried with 'visible' not 'Visible' as you've written it, but I would assume it does not matter unless you know otherwise?

@Kennedy T:

Thanks for the advice - I have since submitted this question to the B1 SDK forum, and it is awaiting approval due to my lack of points . As soon as it is accepted, I will close this thread and post a link to the moved thread - hope that's alright.

Former Member
0 Kudos

Hi Ted,

Looking in SDK documentation again, I've noticed that the <Items><action><type> attribute has only 2 available values: "add" and "group". You can not assign the "update" value.

So it seems that your request can not be acheived using LoadBatchActions method.

Beni.

Former Member
0 Kudos

Hi Beni,

That's weird - I went through the same thought process when I was investigating this, and decided to check if I could set *any* of the item's details using the update action. Turns out that you actually can - I managed to get the text box above with id 394 to change its caption using the <specific> tag inside the <item> tag.

So from that it seems that it is possible to change things using that update action on an item, but perhaps it doesn't always work? It's weird - why would they implement changing only a select few attributes by the XML method when there would be a minimal amount of extra work in making it fully-functional? Logically to me it makes no sense.

Hopefully the moderation on this post and my moved question to the SDK section of the forum don't take long, then somebody who has more knowledge on the subject could enlighten us 🙂

Ted

Former Member
0 Kudos

Hi,

Have you tried to set Visible attribute to "0"?

.

.

.

<item uid="394" Visible ="0">

.

.

.

Beni.

KennedyT21
Active Contributor
0 Kudos

Hi Ted Sales ..

Better Post the SDK Place to get quick response from the experts


scn.sap.com/community/business-one-sdk

Pls close the thread here

Hope helpful

Regards

Kennedy