Forum Discussion

Amitosh_Tripathy's avatar
7 years ago
Solved

getPreferenceItemProperty and setPreferenceItemProperty

Hi,

I am implementing a Generic action form UI to let user pick his default group among multiple groups he belongs to. 

I could achieve it with adding a property to Core_GlobalLayout and write getter and setter for this with sql, but when I use  API setPreferenceItemProperty / getPreferenceItemProperty, the value does not get saved or retried.

Also, I could not find in documentation if these APIs store and retrieve from client cache(in case database transaction happens only during logout) or from database. In my case, if any CAD connector or external system needs access to this property, I want to make sure I know when it goes to database.

Anyone has any previous experience with these APIs? 

  • christopher_gillis's avatar
    christopher_gillis
    7 years ago

    Hi amitosh,

    The setPreferenceItemProperties function does not save to the database. It updates a cached copy of the preference item that is saved when the user logs out of the system.

    In a similar manner, the getPreferenceItemProperty queries against this cached copy of the preference item. However, this function does do a get from the database if there is not already a cached copy stored locally.

    Chris

2 Replies

  • I am using the APIs like this, and it does not work : 

    Load form:

    var topWindow = aras.getMostTopWindowWithAras(window);
    var storedGroup = topWindow.aras.getPreferenceItemProperty('Core_GlobalLayout', null, 'user_loggedin_group');

    Ok Button click:

    aras.setPreferenceItemProperties('Core_GlobalLayout', null, {'user_loggedin_group': idItem.getProperty("id")});

    • christopher_gillis's avatar
      christopher_gillis
      Community Manager

      Hi amitosh,

      The setPreferenceItemProperties function does not save to the database. It updates a cached copy of the preference item that is saved when the user logs out of the system.

      In a similar manner, the getPreferenceItemProperty queries against this cached copy of the preference item. However, this function does do a get from the database if there is not already a cached copy stored locally.

      Chris