While we are working on a PM/PR, we create property/variables whose scope defined on that applet or view inside PM/PR only. So, what we can do if we want an enhancement which can be remembered even after:
– navigate to other screen and then navigate back
– Logoff and login again
Yes, we can create and set our custom User Prefrences which can remember custom behavior of applet even after logout or screen navigation.
How it works?
Create a property set as we do in escripts
var pm = this.GetPM(); var inputPS = CCFMiscUtil_CreatePropSet();
Set name of User Preference
inputPS.SetProperty("Key", "user_preference_name");
Set value of User Preference
inputPS.SetProperty("user_preference_name", "user_preference_value");
this line call siebConsts “SWE_MTHD_UPDATE_USER_PREF” with Propertyset as input to create it
pm.OnControlEvent(siebConsts.get("PHYEVENT_INVOKE_CONTROL"), pm.Get(siebConsts.get("SWE_MTHD_UPDATE_USER_PREF")), inputPS);
set User Pref as property in Presentation Model as well
pm.SetProperty("user_preference_name", "user_preference_value");
Example
Its an example from bookshelf, create a collapsible applet but User wants to find applet in same state (Collapsed/Expanded) when it came back after navigation or logoff. In my previous post, I have explained collapsible applets.
Steps to follow:
– add custom button html from ShowUI
– create property set with User Preference name and value
– set custom User Preference
– set PM property for same User Preference
– Bind click on custom button
– Put code inside Bind Events
Here is the complete code (self explained):
[su_document url=”http://www.askmesiebel.com/wp-content/uploads/2016/08/SAVELASTAPPLETSTATPR.txt” width=”450″ height=”400″]
[su_divider style=”dotted”]
@skmeSiebel
1 comment for “How to Add Custom User Preferences to Applets in Siebel OpenUI ?”