app_user.id

Ask your questions here.
Post Reply
pepe
Sponsor
Sponsor
Posts: 556
Joined: 25 Aug 2015, 21:35
Name: Pepe
Location: Graz, Austria
Contact:

app_user.id

Post by pepe »

Hi,
I use an Ajax request field to transfer the app_user array via json to Javascript. This works fine after function $(document).ready(function() { ....
However, I need that information about app_user.id before (or at the end of ready function). I have tried to use some dummy and programmatically fired change function like $("#fields_2117").trigger('change');
This does not evoke the Ajax Request fields to execute.
Does somebody no a solution? Thank you in advance for your input.
Regards, Pepe
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: app_user.id

Post by support »

Can you give me more example what do you need, please.
pepe
Sponsor
Sponsor
Posts: 556
Joined: 25 Aug 2015, 21:35
Name: Pepe
Location: Graz, Austria
Contact:

Re: app_user.id

Post by pepe »

In my task entity I do have various user lists:
1. created_by (this is not a list, obviously I use the created_by field)
2. Responsible user (single choice user field, later I will change it to approve field to sign off on a task)
3. Attendants: One or more users who need to participate on finishing the task (checklist user field)
4. Copy to: One or users who need to get notification but do not actively work on task (checklist user field)

Some fields in task entity are not required in other tasks. Therefore, I use display fields rules feature to show/hide fields in form. The show/hide depends on type of user (owner which is the creator of task, responsible user, .... as described above). Also, some user shall have edit access to fields others view only.

Because of the above, I need to know the current user_id right at the time when form has been loaded. This causes the field display rules to fire. Currently, I am using a small work around by loading the form and starting with a tab that only holds some dummy explanations about tasks. AT this point, the app_user.id cannot be accessed in Javascript because the Ajax Request field which sends the app_user array via json to JS has not been executed. When user clicks the next tab then the Ajax Request executes and app_user array (or app_user.id value) is available in form.

I hope this explains in more detail my problem. I am looking forward for a simple solution!
Thank you, regards, Pepe
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: app_user.id

Post by support »

Still not clear. Can you provide example in personal demo https://www.rukovoditel.net/account_dem ... quest=demo
and send me link to demo. I will check how it can be solve.
pepe
Sponsor
Sponsor
Posts: 556
Joined: 25 Aug 2015, 21:35
Name: Pepe
Location: Graz, Austria
Contact:

Re: app_user.id

Post by pepe »

I did a setup of DB on demo page. Also, sent PM with all details.
Regards, Pepe
User avatar
support
Site Admin
Posts: 6215
Joined: 19 Oct 2014, 18:22
Name: Sergey Kharchishin
Location: Russia, Evpatoriya

Re: app_user.id

Post by support »

File from archive replace to includes\classes\
And now in js code you can use:

Code: Select all

var user_id = [current_user_id]
var user_group_id = [current_user_group_id]

alert(user_id+' - '+user_group_id)
Attachments
global_vars.zip
(811 Bytes) Downloaded 53 times
Post Reply