Wednesday, February 21, 2007

Handling user roles in Lotus script

Problem description: In lotus notes development it is quite often, we developers face situations, where based on the user's role we have to grant/restrict some of the functions for him/her.

Solution: Solution is quite simple. we can use 'Evaluate' function as follows.

Step1:

Create a function in the script library as below.
%REM
=============================================================
Input: Role name should be passed to this function, without square brackets
Return value: True if the passed role is enabled for current user. Else false.
=============================================================
%END REM

Function CheckUserRole(RoleName As String) As Variant
Dim CheckRole As String
Dim Userroles As Variant
CheckUserRole=False
CheckRole="["+RoleName+"]"
UserRoles= Evaluate("@UserRoles")

If Not Isempty(UserRoles ) Then
If Not Isnull(Arraygetindex(UserRoles,CheckRole,0)) Then
CheckUserRole=True
End If
End If
End Function

Step2:

Now use the above function, wherever it is required as follows.

Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
'If the user do not have [Admin] role then do not allow him to delete a document

Dim Response As Integer

If Not CheckUserRole("Admin") Then
Msgbox "You are not authorized to delete document from the database", 16, "Warning"
Continue = False
Exit Sub
End If

End Sub

Thursday, February 15, 2007

IBM Lotus Notes Domino 7 Application Development Update Exam

When I decided to write Lotus notes R7 updation, I tried to serach for the resources (of course free) every where. But I found that very limited resources are available around. So i thought of collating the questions, I faced in the exam for the reference of the interested people. Here it is for you. (Verify the answers.)
Good luck..
Though I thought whether it is legal or ethical to post the questions like this. But if you see, there are plenty of mock exam providers and their questions will be more or less same to the actual questions.

if you feel like this is wrong or unethical please let me know.

Please don't use these questions for any commercial purpose.

1.Is it possible to have Exit prompt enabled for notes client but not for designer.
Ans: No Exit Prompt setting applies to both Client and Designer (even Admin client). It is not possible to have separate settings.

2. Where debugger status information is shown.
Ans: In Status Bar / Status line.

3. How to sign a java script library.
Ans: Select the script library in the designer and click on the SIGN cotton.

4. How to find whether shared action buttons are using custom images or notes standard image?
Ans: Notes designer, shared action list -> check the new column Icon type, which indicates above information.

5.New option available for adding a comment to a form.
Ans: Notes designer, form list -> Click on the comments column to edit it and enter the comments.

6. Quickest way of adding an Alias name to a form.
Ans: Notes designer, form list -> Click on the alias column to edit it and enter the alias name.

7. Where do you find web services in the designer?
Ans: Sheared Code -> Web services

8. Where do you set the auto save interval?
Ans: File -> Preferences->User preferences ->Auto save every --minutes

9.Mark wants to use @Command([DiscoverFolders]) to check which folder(s) contain a certain document. This command does not appear to be working for him. What property should Mark check?
Ans: Database Properties - Allow Folder Discovery

10.Rebecca has a number of shared actions in her Domino application, but she needs to quickly determine which actions display in the action bar and which actions display in the menu. What feature in Domino Designer can she check to find this information?
Ans: The shared actions design columns for action bar and menu locations.

11.Joanna needs to check to see if the Administration ECL in the name and address book is locked. What function will give her this information?
Ans: @AdminECLIsLocked


12.While using @Dblookup, what supported function, user has to use to catch the error returned?
Ans: @IsError

13.A user wants to use a shared column but want to have different look and feel for that column in different views, can he do that? What option he’ll have to choose while including the column in different views.
Ans: Use formula only…

14. In Web Service, what is purpose of ?
Ans: The data types used by the service.

15. In Web Service, what is purpose of ?
Ans: An abstract description of an action supported by the service.

16. What does WSDL stands for?
Ans: The web services description language.

17. How to allow only admins to edit a field?
Ans: Use @IsMember(“[Admin]”; @UserRoles) in the input enabled field formula.

18: Description of the web services
Ans: A Web service is a self-contained, self-describing, modular application, based on XML, that can be published to and invoked from the Web.

19. Some thing related to securing web service.
Ans: Some thing like set the ACL of the database where web service is written.

20: Some thing like How to preview web service.
Ans: Preview any Page or form then change the URL to ?OpenWebServices or
?WSDL.

21. What setting must be done in order to ensure DiscoverFolder works as excepted?
Ans: Ensure that at least one embedded outline property ‘Maintain folder unread information’ is selected.

22. Remote debugging of a java code is not working. Where to check in the first place?
Ans: File->Tools-> Java Debugging Preferences

23. Which port to be used for remote debugging?
Ans: Any unused port.

24. One question related to new accessibility feature of the table.
Ans : Selecting ‘Row header’

25: How to close all open window tabs?
Ans: File -> Close all open window tabs.

26. Method for validating the DXL being exported.
Ans: NotesDXLExporter.ValidationStyle.

27. The URI of the schema for the DXL being exported
Ans: NotesDXLExporter.SchemaLocation

28. Method which gets the documents in a database that are modified since a specified time.
Ans: NotesDatabase.GetModifiedDocuments( [ since ] , [ noteClass% ] )
But be careful there will be one more option like GetAllModifiedDocuments.

29. Function which indicates whether the application is running in the Workplace Client.
Ans: NotesUIWorkspace.IsEmbeddedInsideWCT

30. User wants to modify a shared column. How can he find, in which views they are used?
Ans: Button ‘Who is using shared column’

31. User wants to use a complex view column in another 4 views. How can he do that?
Ans: select the column and make it as shared column using ‘Copy as shared column’ option.

32. Already there are too many action buttons to be displayed. But user wants to include 5 more actions. What he can do, so that those 5 columns can be easily accessible without scrolling the action bar?
Ans. Action property -> Include in right click menu.

33. User finds that agent is running very slowly. What he can do to analyze the agent?
Ans: Profile the agent using the Agent security tab option ‘Profile this agent’.

34. What will be included in profiling results?
Ans: Class Method Operations Calls Time.

35. A developer wants to give the WSDL to another user. How can he do that?
Ans: Export WSDL -> then send the resultant file to the user.

36. A user wants to generate WSDL what he wants to do?
Ans: Nothing WSDL will be generated automatically, when web service is saved.


37. What developer has to design to retain the widths of design list columns?
Ans: Nothing, the setting will be persistent between the sessions.

38. What WSDL stands for?
Ans: Web Services Description Langage.

39. In Web Service, what is purpose of ?
Ans: An abstract definition of data being communicated to or from the service.

40: One question about view color columns.
Ans: Some thing like, now multiple user defined color columns are possible in notes views.

41. Quickest way of finding Agent trigger information.
Ans: trigger column in the Designer->Agent list.

42. What happens when a shared column is deleted?
Ans: Nothing. This column will remain in the views as normal columns.

43. What function we can use to indicates whether a field is locked by an administration policy and cannot be modified.
Ans: @PolicyIsFieldLocked( fieldName )