Allowing a User to Control their own language, location and other settings

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

Allowing a User to Control their own language, location and other settings

  • Comments 3
  • Likes

A customer had a requirement for their users to be able to control some additional preferences.

In Sage CRM most user preferences are held in the usersettings table.  These are the settings that control the way in which CRM information is displayed to the user and are found under the Preferences tab on the My CRM menu.

But there are other settings that control the users experience that are held in the users table and are controlled by default only by the System Administrator.

There are found under User Admin screens e.g.

Administration -> Users -> Users -> Susan Maye 

These settings include items such as

  • Language
  • Office Location
  • Desk Location

These settings can include any number of additional fields that the customer needs. I have discussed addition new fields to the user table in the Video: Adding a New Field to a User Admin Screen

Note:

In Sage CRM v7.1 The language field (user_language) has to be treated differently because in Meta Data this field is not normally exposed for use in custom screens.

To allow a custom screen to reference the user_language field you have to run the following SQL against the database


update Custom_Edits
set ColP_System = 'N',
colp_entrytype = 21,
colp_lookupfamily = 'user_language',
colp_entrysize = 1, 
colp_required = 'Y'
where ColP_ColName = 'user_language'

This is allow the field to be referenced and will correctly link the field to the language selection list.

Once that has been done you will need to run a full meta data refresh.

Administration -> System -> Metadata

The field is then available.

Creating the Screen

I created a new screen under

Administration -> Customization -> Users

called UserPreferenceBox and added in the fields I needed

I then created an ASP page called userpreferences.asp to reference this new screen.  I could have used a .NET assembly just as well.  

Creating the ASP page


<!-- #include file ="sagecrm.js"-->
<%
var intRecordId = CRM.GetContextInfo("user","user_userid");
var myBlock = CRM.GetBlock("UserPreferenceBox");
myBlock.Title = CRM.GetTrans("GenCaptions","UserPrefs");
var myRecord = CRM.FindRecord("users","user_userid="+intRecordId);
CRM.AddContent(myBlock.Execute(myRecord));
Response.Write(CRM.GetPage("user"));
%>
 

I called the ASP page from the User system menu 

Administration -> Advanced Customization -> System Menus

And this now allows the user to control their own Language, and location details, or indeed any other field I want to add to the user table.

Note: The change to the language will only take effect if the user logs out and logs back in.

 


 

 

NoteThe only thing to watch out for is if you are using e-marketing and if the CRM user is mapped to a  Swiftpage user - when you edit the user language on the standard Admin screen, it will update the swiftpage user with the new language. But if you had it on your own custom screen then you wouldn't get that update.

Comments
  • Hi Jeff,

    well done job.

    Christian

  • Hi Jeff,

    great !

    that's, what I need :-)

    Cheers

    Hardy

  • Please see the additional Note added to the article about systems integrated with Sage E-marketing.