Oracle APEX, populate field as ldap current user - ldap

When I create a record I'd like to populate one of the fields (P34_CONTACT) with current ldap user.
I am creating a dynamic code with (picture above):
apex.item("P34_CONTACT").setValue(:FULL_USER_NAME)
I am getting an error:
Uncaught SyntaxError: Unexpected token ':'
When I remove colon, I get:
Uncaught ReferenceError: FULL_USER_NAME is not defined
My authetentication schema is as below:
When I set a fixed name:
apex.item("P34_CONTACT").setValue("FULL_USER_NAME")
Field is being populated with "FULL_USER_NAME", so basically I need a correct variable or proper syntax
Could anybody please assist?

First, you should modify your PL/SQL code in the authentication scheme to set the :FULL_USER_NAME value. Below is the example:
apex_util.set_session_state('FULL_USER_NAME', util_ldap.gv_displayName);
Then, create a hidden page item, for example, P1_FN and set its default value as the item, and specify that application item FULL_USER_NAME. Then you would be able to get it using the following:
apex.item("P34_CONTACT").setValue(apex.item("P1_FN").getValue());

Related

How to find an internal identifier for an Odoo database?

In Python, I want to pass a unique identifier for an Odoo database to a third-party application so that I can identify which DB the request has come from.
Where can I find a unique identifier?
You can use Odoo standard context variable.
For example:
self.env.cr.dbname
or
self._cr.dbname
The Unique ID of your database can be found like this:
env['ir.config_parameter'].search([('key','=','database.uuid')])[0].value
Output:
'7571db5a-4f28-442e-b701-c391a7b13abe'
Or with the following SQL query: select value from ir_config_parameter where key = 'database.uuid'
Or in the UI : in App Settings :
Switch to debug mode by adding "?debug=1" in your url, reload the page: Then go to the last item in the top menu bar: Technical
in the dropdown menu > System settings ... And in the displayed table, look for database.uuid

How to get date in a Custom Object from a date field in Archer?

I have tried getting the value with JavaScript functions but getting Invalid date.
Also,
var dat = new Date(String(Archertech.UI.GenericContent.GetInstance().getFieldValue(ScheduledDate,false)));
gives the date from one field only, but there are two date fields.
I wonder where can I get the list of functions like
Archertech.UI.GenericContent.GetInstance().getFieldValue(ScheduledDate,false)
There is a Client Manager frontend API that is available which has many functions that will give you the values from fields in the Application.
To get all the function list :
Add a new Custom Object named "debugger" with the code debugger;
Save that object > Open Application > Add a new / Open a record
Open Browser's Console i.e F12 > Developer Tools > Console
Set Target to frame : Record.aspx
type "$CM." will get you a list of supported functions
Now, to get a date field value, use $CM.getFieldValue(fieldId);
Sourabh, you'd have to call the CM.getFieldValue() function for each date field you want to get the value of. There is no such function to retrieve all date fields at once.
RSA Archer doesn't provide any documentation for client-side functions.

how to get JSON data from an API in robot framework

I am trying to get JSON data from an API in robot framework which has data with id's. I have to get the count of id's present in the data obtained from the API.
I have tried the below code:
${result} = get ${API_JSON_PATH}
Should Be Equal ${result.status_code} ${200}
${json_data} = Set Variable ${result.content}
Log ${json_data}
I am getting the below mentioned error:
No keyword with name '${result} = get' found.
Is the approach correct or is there any other better ways for getting the JSONS data?
I'm using the RequestsLibrary and it's slide different from what you are doing.
the credential are not needed in your case but this is the example:
#{credential}= Create List Your_Username Your_Password
Create Session YOUR_API_ALIAS YOUR URL auth=#{credential}
${api}= Get Request YOUR_API_ALIAS YOUR_URI
if you want get the content of the JSON:
${api.json()}
Documentation: https://bulkan.github.io/robotframework-requests/
You need to have two or more spaces after the =. Robot looks for two or more spaces to find keywords and arguments, so it thinks your first statement begins with the keyword ${result} = get. Since that's not a valid keyword, you get that error.

Getting reference from model One2many relationship comodel inside an ir.actions.act_window

Would like to ask on how you can get the id of the comodel inside the ir.actions.act_window.
See my source code: https://gist.github.com/renesansz/2642b02875475383605e
Currently, I cannot get the sprint_id.project_id.current_sprint reference since it's giving me an error of Uncaught Error: NameError: name 'sprint_id' is not defined. So what I wanted to happen is that upon opening the project it should add a default filter for the current sprint of the project.
Do I have any alternative for this kind of approach?
Tried doing domain, but still no luck solving the issue.
Try this: make related field and then use this field in xml view.

Validate number of attributes with date_select

I'm doing something like the following: Validate number of nested attributes.
I'm checking for existence of at least one nested attribute.
This was working fine when I was using a text input for the date but I've changed it to use a date_select instead and now the same validation code shows an error saying that not enough have been chosen.
When it fails validation and reloads the form it also doesn't "build" an instance of the nested attribute either so it just shows my "[+]" link
Anybody got any ideas?
Failing everything I'll just have to put the text field back (probably using type=date).
Col
I decided to just put the text field back.