Vijayalakshmi,

I am glad you were able to get it to work.

Thanks for posting the final solution back to the list. That is a very
important part of being part of a community. It allows everyone to
later find the full answer instead of just a bread crumb that might,
or might not, point in the right direction. Also given that the
ARSList is searchable via Google (and other sources) this information
will say around for a very long time.


So in an attempt to round out the full solution a bit better... a few
corrections/additions for posterity...

Apparently I was pointing at the wrong constants for the value of that
Field's Display property.
   I actually think that is one of the worst parts of the ARS Java API
documentation. The constants are lumped into one big class and I think
the names and descriptions do not make it obvious when you would use
Constant X vs Y. I am not sure what Java design pattern guided Remedy
to make that choice, but it always seemed more like a "C" like thing
to do than an OO approach to me.


I guess based on your feedback about the constants maybe this are the
correct constants to use instead:
public static final int     AR_ATTRIB_HIDDEN     1
public static final int     AR_ATTRIB_VISIBLE     0

But wait.. those still do not match the values you used to make it
work. (reversed from what you said) hum...

Well the docs suggest this:
AR_ATTRIB_HIDDEN  (= 1)
    Hidden attribute for AR System objects.
AR_ATTRIB_VISIBLE  (= 0)
    Default attribute is visible.

--> My guess is this is the "Hidden/Visible" Form and Guide Objects.
And for some reason different values are used for "Hidden/Visible" for
field objects. *shrug*


And the two that I pointed at originally are documented as:
AR_DISPLAY_OPT_HIDDEN ( = 2)
    The field cannot be seen in the view, although users with
Customize permissions can make a hidden field visible.
AR_DISPLAY_OPT_VISIBLE ( = 1)
    The field can be seen in the view. (This is the default.)

Which still make the AR_DISPLAY_OPT_HIDDEN sound like the correct
constant to use.
I guess there must either be an error in the documentation, or in the
constants that I am pointing at. :(

However, in the end you need to make the system do what you want it to
do, so give the system the values that actually work. :) I am glad you
were able to figure out the correct values and shared them with
everyone. :)



How could I have forgot to identify that you need to "save" the objects. :(
   A silly over site on my part. Sorry about that.
   I think would have used the Field.setDisplayInstance(...) and
ARServerUser.setForm(Form_object) methods.


Also..

As just a final note, I think was quoting information out of the v6.3
ARS Java API Javadocs. However, I think, based on the way you were
using the ARServerUser that you might have been using the v7.1 or v7.5
ARS Java API? It may not matter much, but being specific may help
someone later. :)


Again, I am glad you got it to work. And thanks for filling in a few
steps that I over looked. Hopefully together we will be able to help
someone else without even knowing about it. :)

--
Carey Matthew Black
BMC Remedy AR System Skilled Professional (RSP)
ARS = Action Request System(Remedy)

Love, then teach
Solution = People + Process + Tools
Fast, Accurate, Cheap.... Pick two.


On Thu, Feb 18, 2010 at 12:45 AM, Vijayalakshmi Paulraj
<[email protected]> wrote:
>
> **
>
> Hurray!!! That worked..
>
> One thing -> Option to make the Filed Visible is 1 and Hidden is 0.
>
> Also I used 2 more steps at last, to update field with this dim and then 
> commit the changes to the server using ARServerUser object.
>
> Regards,
> Vijayalakshmi Paulraj
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList) 
> [mailto:[email protected]] On Behalf Of Carey Matthew Black
> Sent: Monday, February 15, 2010 6:11 PM
> To: [email protected]
> Subject: Re: Hide fields - Java api
>
> Vijayalakshmi,
>
> I have not tested this.. but I think this is correct...
>
> DisplayInstanceMap dim = Field.getDisplayInstance() ;
>
> dim.setProperty(int viewId, int propertyId, Value value);
>
> viewID = Field ID for the View of the ARS form that you want to hide
> the field on
>
> propertyId =
> public static final int AR_DPROP_VISIBLE 4
>
> Value =
> public static final int AR_DISPLAY_OPT_HIDDEN 2
> public static final int AR_DISPLAY_OPT_VISIBLE 1
> ( Which you may need to wrap up in an com.bmc.arsys.api.Value object.)
>
>
> Hope that helps.
>
> --
> Carey Matthew Black
> BMC Remedy AR System Skilled Professional (RSP)
> ARS = Action Request System(Remedy)
>
> Love, then teach
> Solution = People + Process + Tools
> Fast, Accurate, Cheap.... Pick two.
>
>
> On Mon, Feb 15, 2010 at 7:27 AM, Vijayalakshmi Paulraj
> <[email protected]> wrote:
> >
> > **
> > Hi All,
> >
> > Can anybody give me a pointer on how to Hide/Unhide fields in a form using 
> > Java API code.... (Just a pointer..)
> > Posting to a wider group - thought somebody might have already tried..
> >
> > Thanks,
> > Vijayalakshmi Paulraj

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor:[email protected] ARSlist: "Where the Answers Are"

Reply via email to