Wednesday, June 9, 2021

Oracle ADF: af:query hide Add Fields button

Requirement-In Oracle ADF we use af:query along with resulting table in advance mode.When use  af:query in advance mode the UI is displayed as something like below. Usually clients dont want add fields option in advance search as it has all fields that doesn't makes sense to user.

Unfortunately there is no attribute in af:query components that allows us to remove this button.

Screenshot with add field option .








Now to hide this add fields button do below steps

1.Take the Id of Add field button using inspect element in browser .In my case id was "pt1:r2:0:qryId2:adFlds".It will vary based on id of query component and page you are using.















2.At the end of jsff file create a output text that has no next and creating component  binding in backing bean as below.

Please note this need to be at the end of jsff file so that it is rendered at the last in lifecycle.





In Getter method of above created binding right code to get the add fields button component using java script by component id we got in step 1 .Once you find the component set display =none to hide the add fields button.

Backing bean code,as shown below i have written hideAddFieldSection method.


Now if you run the page again you dont see add fields button .Hope this helps






Friday, June 4, 2021

Error: [ADF security error] -while adding transient expression in ADF 12c

In ADF 12c when we want to have transient expression in entity object for example primary key of Entity object is coming from DB sequence then we declare the expression as shown in below

(new oracle.jbo.server.SequenceImpl("SEQUENCE_NAME", adf.object.getDBTransaction())).getSequenceNumber()






















After this if you compile the project you get below error

Error(10,1): [Static type checking] - [ADF security error] Calling the constructor for class oracle.jbo.server.SequenceImpl is not permitted.
 @ line 10, column 1.


Which means that the entity is not trusted the expression changes. To solve this follow below steps

1.Go to the source of the entity object xml file 

2. go to  "TransientExpression" of the attribute which you are adding expression as shown in      screenshot   below 

3.Check the value of the attribute "trustMode"

4.By default  it is "untrusted", change it to "trusted" or remove it

Now recompile the project. Compiler issue doesn't occur








hope this helps