user_set_preferences ()

user_set_preferences ()

Function prototype

user_set_preferences (session, preferences_xml, [user])

API Version

2.7.8 and higher

Sets the preferences of the USER

Detailed explanation of the function

Input parameters:

  • session: is the session token obtained in the session_init() call

  • preferences_xml: XML with the preferences

    • editable: (true/false) Indicates if the active SESSION’s USER has privileges to modify the preferences

    • form_merge: (true/false) If true, the TASKS with more than one FORM will be treated as if they had only one FORM with all the ITEMS merged

    • map_service: Information about the preferred map service for displaying geographic information

    • notifications: Preferences of the USER about the channels of communication used to send notifications generated by the system.

      • channels: comma separated string indicating the channels enabled for sending notifications about TASKs and EVENTs

      • event_priority: Used to filter by priority the EVENTs that should send a notification. Possible values:

        • “all”: Send notifications about all EVENT

        • “flagged“: Send only notifications of flagged EVENTs (with a priority different than 0)

      • from_time: Minimum time to receive notifications about pending TASKS when the TASK is not scheduled for a specific time (can be done at any time of the day). The expected format is 'hh:mm:ss'. Introduced in API version 2.7.25

    • preference: Name of the preference. It is possible to add new individual preferences using case_set_preference () or USER_PREFERENCE_SET (). Introduced in API Version 2.7.20

      • ref: name assigned to the preference

      • value: value assigned to the preference

      • scope: defines in which scope the preference is used. Possible values are:

        • “USER”: Preference assigned to the USER

        • “PROGRAM”: Preference that is applicable only in the context of a PROGRAM OBJECT.

        • “APPLICATION”: Preference stored by an client application. For example it may be used to store preferences of the user about how to sort tables, colors of the interface, or any other setting that may affect the behavior of the client application

      • scope_ref: When the scope is different than “USER”, it is necessary to indicate the reference of the scope. For example, when defining a preference of a PROGRAM, then it is necessary to indicate the reference of the PROGRAM.

      • scope_description: Description of the scope object referenced by scope_ref. For example, if scope = “PROGRAM”, then scope_description will be the name of the PROGRAM

  • case: Reference of the CASE. By default the function will use the session’s CASE unless a different one is specified.

Output parameters:

  • result:

  • ErrorMsg: If any error occurs, then this value contains a description of the error translated to the current language

  • ErrorCode: If any error occurs, then this value contains any of the standard ERROR CODES

Request sample:

user_set_preferences ( “LCAAAAAAAAAAAA”, “

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <preferences> <editable>true</editable> <form_merge>false</form_merge> <map_service> <code>OPENSTREET</code> <description>OpenStreet Maps</description> </map_service> <notifications> <channels>email</channels> <event_priority>all</event_priority> <from_time>09:00:00</from_time> </notifications> <preference> <ref>patients.sort</ref> <description>HIDE_INSTRUCTIONS</description> <value>0</value> <scope>PROGRAM</scope> <scope_ref>383</scope_ref> <scope_description>COVID19</scope_description> </preference> <preference>...</preference> </preferences>

", 3243 );

Response sample:

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <result></result> <ErrorMsg></ErrorMsg> <ErrorCode></ErrorCode>

 

Notes:



Return Error codes

ERROR CODE



ERROR CODE



INVALID_TOKEN

The session token provided is not valid

INSUFFICIENT_PRIVILEGES

The session user does not have the necessary privileges to request the preferences of the CASE

USER.NOT_FOUND

The USER specified was not found

Related content