Insert MIS ID Profile data
Data from a user profile, such as the first name and last name, can automatically be inserted into customizable documents using Autofill Forms, which is limited to the fields that are available in the user’s profile. But say you want to retrieve other data, such as a person’s job title and personnel ID code, to use in a business card. These could be stored in the MIS ID field: the data is separated with a colon.
Figure 10.117: Additional profile data in the MIS ID field
Insert MIS ID profile data 
1 Create a business card using the Online Editor.
2 Add two variables 'title' and 'id' and mark these as hidden so they do not show up in the form that the user needs to fill in.
3 Insert these two variables in the layout.
4 Create a variable called ASF_USERMISID and set it to be visible. This variable is used to retrieve the data from the MIS ID field of the user profile, so its name must be ASF_USERMISID.
5 Create an additional variable of any type called dofirst which is set to visible. This variable will contain the action that does all the work.
6 Add a Validate action for the dofirst variable. Its syntax is:
1 if variable dofirst visible is true
2 set variable dofirst visible = false
3 set variable title value = stringFunctions substring string variable ASF_USERMISID displayValue
4 startindex number 0
5 length stringFunctions indexOf string variable ASF_USERMISID displayValue
6 find string :
7 caseSensitive false
8 set variable id value = stringFunctions substring string variable ASF_USERMISID displayValue
9 startindex stringFunctions indexOf string variable ASF_USERMISID displayValue + number 1
10 find string :
11 caseSensitive false
12 length number 6
13 set variable ASF_USERMISID visible = false
14 end if
How it works
The dofirst and ASF_USERMISID variables initially need to be visible because otherwise the action does not work. Since they should not be visible to the user, the script hides them.
The bulk of the code is for pulling apart ASF_USERMISID and putting the data in the title and id variables. In this script it is done using the 'substring' function. For more complex sets of data you can use regular expressions.
The following restrictions apply:
The MIS ID field is limited to 255 characters.
If you change the MIS ID field of a user while that user is logged in, the old values remain in use while that user customizes the document.
Whenever you tweak this document in StoreCenter using the Online Editor, you need to make sure that the dofirst and ASF_USERMISID variables are visible in the form when you save the customizable document. If they are hidden, the script will not work when a user attempts to edit a business card.
doc. version 6.0.4