Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All of the above methods can be called from the frontend using invokeServerTask. They all accept as input a custom serializable parameter (UserProfileCustomPropertyParameter) which contains the following extra parameters (in addition to the existing UserProfileaParameterUserProfileParameter):

  • CustomPropertyName - character field used when specifying a single property to fetch/delete
  • CustomPropertyObject - JSON object used when returning one or more properties to the frontend; also used when saving one/more properties to the database

...

This was extended with the methodName and oData parameters to allow for more control when saving a custom property.


The methodName parameter is used to specify the method to call in from the backend, in the UserProfileBT.cls (see above).

The oData parameter is used to specify the UserProfileCustomPropertyParameter data to be sent to the backend.

Both those parameters should be used together.


Examples

    akioma.swat.UserProfile.loadFromServer();  // loads the user profile from the database

    // deletes all custom properties from the database, then triggers a reload from server

    akioma.swat.App.invokeServerTask({
      name:'Akioma.Swat.UiInteraction.UserProfileBT',
      methodName:'DeleteAllCustomProperties',
      paramObj: { plcParameter: {User: '', Context: ''}}
    }).then(() => {
      akioma.swat.UserProfile.loadFromServer();
      akioma.swat.Message.message({ type:'success', text:'Properties deleted successfully.' });
    }).catch(() => {
      akioma.swat.Message.message({ type:'error', text:'Error deleting properties.' });
    });



    akioma.swat.App.setProfileAutoStore('onChange')// sets the autostore to onChange so properties are automatically stored in the database

    akioma.swat.App.saveCustomLocalProfileProperty({testProp: 'testValue' })// set a new custom property which will be stored in the database because of the autoStore


Testing

For testing this, there is a new sample dialog: UserProfileCustomPropertySampleDialog UserProfileCustomPropertySampleDialog. This dialog is accessible from the Samples desktop. Here you can set/delete properties. 

...